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,46 +37,41 @@
become: true become: true
tasks: tasks:
- name: Copy reverse proxy configuration to host
become: true
ansible.builtin.copy:
src: apptabulous/reverseproxy
dest: /etc
# - name: Install Docker - name: Start reverse proxy container
# ansible.builtin.include_tasks: community.docker.docker_container:
# file: tasks/install_docker.yaml name: reverse_proxy
image: nginx:mainline-alpine-slim
restart_policy: always
volumes:
- /etc/reverseproxy/conf.d:/etc/nginx/conf.d
- /etc/letsencrypt:/etc/letsencrypt
ports:
- "80:80"
- "443:443"
state: started
- name: Copy referse proxy configuration to host - name: Start docker registry
become: true community.docker.docker_container:
ansible.builtin.copy: name: registry
src: apptabulous/reverseproxy image: registry:2
dest: /etc restart_policy: always
ports:
- name: Start reverse proxy container - "5000:5000"
community.docker.docker_container: state: started
name: reverse_proxy
image: nginx:mainline-alpine-slim
volumes:
- /etc/reverseproxy/conf.d:/etc/nginx/conf.d
- /etc/letsencrypt:/etc/letsencrypt
ports:
- "80:80"
- "443:443"
state: started
- name: Start docker registry
community.docker.docker_container:
name: registry
image: registry:2
restart_policy: always
ports:
- "5000:5000"
state: started
# NOTE: This will fail on the first run because the container has not been
# uploaded to the registry yet
- name: Start website
community.docker.docker_container:
name: website
image: hub.apptabulous.co.uk/apptabulous/website
restart_policy: always
ports:
- "3000:3000"
state: started
# NOTE: This will fail on the first run because the container has not been
# uploaded to the registry yet
- name: Start website
community.docker.docker_container:
name: website
image: hub.apptabulous.co.uk/apptabulous/website
restart_policy: always
ports:
- "3000:3000"
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: image: hub.apptabulous.co.uk/apptabulous/kiosk:latest
project_name: kiosk restart_policy: always
pull: true ports:
restarted: true - "80:3000"
definition: volumes:
kiosk: - "/home/{{ username }}/kiosk:/app/kiosk"
image: hub.apptabulous.co.uk/apptabulous/kiosk:latest - "/home/{{ username }}/commands:/app/commands"
restart: "always" state: started
ports:
- "80:3000"
volumes:
- "/home/{{ username }}/kiosk:/app/kiosk"
- "/home/{{ username }}/commands:/app/commands"