Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions ansible/group_vars/all/websites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ websites:
- "www.stichtingsticky.nl"
state: "absent"

# Commented out because this website is currently hosted on github.io
# - name: "studytrip.{{ canonical_hostname }}"
# user: "studytrip"
# alternative_names:
# - "studiereis.{{ canonical_hostname }}"
# state: "present"
- name: "studytrip.{{ canonical_hostname }}"
user: "studytrip"
alternative_names:
- "studiereis.{{ canonical_hostname }}"
state: "present"

- name: "{{ canonical_hostname }}"
user: "static-sticky"
Expand Down
2 changes: 2 additions & 0 deletions ansible/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
tags: "committeeclash"
- role: "rottenspringbok"
tags: "rottenspringbok"
- role: "studytrip"
tags: "studytrip"
# We only want to deploy the crazy88 role when specifically requested
- role: "crazy88bot"
tags: ["never", "crazy88bot"]
Expand Down
50 changes: 50 additions & 0 deletions ansible/roles/studytrip/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
- name: "create user for studytrip"
ansible.builtin.user:
name: "studytrip"
home: "/var/www/studytrip"
shell: "/usr/sbin/nologin"
state: "present"
system: true
groups: "docker"
append: true

- name: "copy nginx configuration"
ansible.builtin.template:
src: "studytrip.conf.j2"
dest: "/etc/nginx/sites-available/studytrip.{{ canonical_hostname }}.conf"
notify: "reload nginx"

- name: "enable nginx configuration"
ansible.builtin.file:
src: "/etc/nginx/sites-available/studytrip.{{ canonical_hostname }}.conf"
path: "/etc/nginx/sites-enabled/studytrip.{{ canonical_hostname }}.conf"
state: "link"
notify: "reload nginx"

- name: "set up studytrip"
become_user: "studytrip"
become: true
block:
- name: "clone studytrip repository"
ansible.builtin.git:
repo: "https://github.com/svsticky/Studytrip.git"
dest: "/var/www/studytrip/studytrip"
depth: 1
force: true
version: "master"
diff: false

- name: "Build docker image"
community.docker.docker_image:
build:
path: "/var/www/studytrip/studytrip"
source: "build"
name: "svsticky/studytrip:latest"

- name: "Start docker container"
community.docker.docker_container:
name: "studytrip"
image: "svsticky/studytrip:latest"
published_ports:
- "{{ studytrip_port }}:3000"
18 changes: 18 additions & 0 deletions ansible/roles/studytrip/templates/studytrip.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name studytrip.{{ canonical_hostname }} studiereis.{{ canonical_hostname }}

ssl_certificate /etc/letsencrypt/live/studytrip.{{ canonical_hostname }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/studytrip.{{ canonical_hostname }}/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/studytrip.{{ canonical_hostname }}/chain.pem;

location / {
proxy_pass http://localhost:{{ studytrip_port }}/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
2 changes: 2 additions & 0 deletions ansible/roles/studytrip/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
studytrip_port: 3010