Update frontend script.

Always restart reverse proxy
This commit is contained in:
2023-11-11 11:57:18 +00:00
parent d23badb2a2
commit 11f55cd96c
4 changed files with 66 additions and 61 deletions

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
```bash
ansible-playbook -i inventory frontend.yaml
```

View File

@@ -37,12 +37,7 @@
become: true become: true
tasks: tasks:
- name: Copy reverse proxy configuration to host
# - name: Install Docker
# ansible.builtin.include_tasks:
# file: tasks/install_docker.yaml
- name: Copy referse proxy configuration to host
become: true become: true
ansible.builtin.copy: ansible.builtin.copy:
src: apptabulous/reverseproxy src: apptabulous/reverseproxy
@@ -52,6 +47,7 @@
community.docker.docker_container: community.docker.docker_container:
name: reverse_proxy name: reverse_proxy
image: nginx:mainline-alpine-slim image: nginx:mainline-alpine-slim
restart_policy: always
volumes: volumes:
- /etc/reverseproxy/conf.d:/etc/nginx/conf.d - /etc/reverseproxy/conf.d:/etc/nginx/conf.d
- /etc/letsencrypt:/etc/letsencrypt - /etc/letsencrypt:/etc/letsencrypt
@@ -69,8 +65,8 @@
- "5000:5000" - "5000:5000"
state: started state: started
# NOTE: This will fail on the first run because the container has not been # NOTE: This will fail on the first run because the container has not been
# uploaded to the registry yet # uploaded to the registry yet
- name: Start website - name: Start website
community.docker.docker_container: community.docker.docker_container:
name: website name: website
@@ -79,4 +75,3 @@
ports: ports:
- "3000:3000" - "3000:3000"
state: started state: started

View File

@@ -1,5 +1,5 @@
[kiosk] [kiosk]
kiosk@kiosk.localdomain kiosk@kiosk.local
[frontend] [frontend]
rpi4-2.local rpi4-2.local

View File

@@ -5,6 +5,16 @@
vars: vars:
username: kiosk username: kiosk
docker_add_repo: true
docker_users:
- "{{ username }}"
roles:
- role: geerlingguy.docker
become: true
tasks: tasks:
# - name: Ensure raspi-config is up to date # - name: Ensure raspi-config is up to date
# become: true # become: true
@@ -79,6 +89,12 @@
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --disable-infobars --kiosk ${WEBSITE:=https://bit.ly/shelford_kiosk} chromium-browser --disable-infobars --kiosk ${WEBSITE:=https://bit.ly/shelford_kiosk}
- name: Configure openbox-session
ansible.builtin.blockinfile:
path: /home/{{ username }}/.xinitrc
create: true
line: "exec openbox-session"
- name: Start window manager - name: Start window manager
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /home/{{ username }}/.bash_profile path: /home/{{ username }}/.bash_profile
@@ -92,10 +108,6 @@
hour: "0,2,4,6,8,10,12,14,16,18,20,22" hour: "0,2,4,6,8,10,12,14,16,18,20,22"
job: "DISPLAY=:0.0 xdotool key ctrl+r" job: "DISPLAY=:0.0 xdotool key ctrl+r"
- name: Install Docker
ansible.builtin.include_tasks:
file: tasks/install_docker.yaml
- name: Create kiosk config directory - name: Create kiosk config directory
ansible.builtin.file: ansible.builtin.file:
path: /home/{{ username }}/kiosk path: /home/{{ username }}/kiosk
@@ -130,19 +142,14 @@
done done
# NOTE: This fails first time, but works after a manual pull from the target - name: Start admin console container
# NOTE: get the error -> 'Connection aborted.', PermissionError(13, 'Permission denied') community.docker.docker_container:
- name: Install kiosk admin console name: website
community.docker.docker_compose:
project_name: kiosk
pull: true
restarted: true
definition:
kiosk:
image: hub.apptabulous.co.uk/apptabulous/kiosk:latest image: hub.apptabulous.co.uk/apptabulous/kiosk:latest
restart: "always" restart_policy: always
ports: ports:
- "80:3000" - "80:3000"
volumes: volumes:
- "/home/{{ username }}/kiosk:/app/kiosk" - "/home/{{ username }}/kiosk:/app/kiosk"
- "/home/{{ username }}/commands:/app/commands" - "/home/{{ username }}/commands:/app/commands"
state: started