Compare commits

...

4 commits

Author SHA1 Message Date
c6b897f218 add watchtower
Some checks failed
/ run ansible (push) Has been cancelled
2024-10-17 18:14:50 +02:00
6aa82a24d4 goatcounter + lyon-transports listen on localhost only 2024-10-17 17:34:23 +02:00
1d74e9609b refactor systemd playbooks 2024-10-17 17:32:09 +02:00
7e5807e009 docker: remove orphans 2024-10-17 16:52:38 +02:00
16 changed files with 63 additions and 46 deletions

View file

@ -8,7 +8,7 @@
- import_playbook: display.yaml # noqa: name[play]
- import_playbook: ghost-config.yaml # noqa: name[play]
- import_playbook: ghost-update.yaml # noqa: name[play]
- import_playbook: gitea.yaml # noqa: name[play]
- import_playbook: git.yaml # noqa: name[play]
- import_playbook: goatcounter.yaml # noqa: name[play]
- import_playbook: lyon-transports.yaml # noqa: name[play]
- import_playbook: manuels.yaml # noqa: name[play]
@ -21,4 +21,5 @@
- import_playbook: test_headers.yaml # noqa: name[play]
- import_playbook: voice-pipeline.yaml # noqa: name[play]
- import_playbook: wallabag.yaml # noqa: name[play]
- import_playbook: watchtower.yaml # noqa: name[play]
- import_playbook: ynab.yaml # noqa: name[play]

View file

@ -3,5 +3,7 @@ services:
build:
context: sources
restart: always
labels:
- "com.centurylinklabs.watchtower.enable=false"
ports:
- "127.0.0.1:9010:80"

View file

@ -1,6 +1,6 @@
services:
server:
image: codeberg.org/forgejo/forgejo:8
image: codeberg.org/forgejo/forgejo:9
env_file: gitea.env
restart: always
volumes:

View file

@ -1,6 +1,6 @@
services:
app:
image: python:3.13-slim
image: python:3-slim
command: python /app/app.py
volumes:
- ./:/app

View file

@ -0,0 +1,8 @@
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /home/gaugendre/.docker/config.json:/config.json
- /etc/localtime:/etc/localtime:ro
command: --interval 86400 --cleanup --include-restarting

View file

@ -1,5 +1,5 @@
---
- name: Gitea
- name: Forgejo
hosts: servers
gather_facts: false
tasks:

View file

@ -33,13 +33,12 @@
- name: Write service unit file
become: true
ansible.builtin.template:
src: templates/goatcounter.service.j2
src: templates/goatcounter/goatcounter.service.j2
dest: /etc/systemd/system/goatcounter.service
mode: "0600"
owner: root
group: root
notify:
- Daemon-reload
- Restart service
- name: Flush handlers
ansible.builtin.meta: flush_handlers
@ -51,15 +50,12 @@
enabled: true
handlers:
- name: Daemon-reload
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: Restart service
become: true
ansible.builtin.service:
ansible.builtin.systemd:
name: goatcounter
state: restarted
daemon_reload: true
vars:
ansible_python_interpreter: /tmp/ansible/bin/python

View file

@ -6,13 +6,12 @@
- name: Write service file
become: true
ansible.builtin.template:
src: templates/lyon-transports.service.j2
src: templates/lyon-transports/lyon-transports.service.j2
dest: /etc/systemd/system/lyon-transports.service
mode: "0600"
owner: root
group: root
notify:
- Reload daemon
- Restart service
- name: Flush handlers
ansible.builtin.meta: flush_handlers
@ -24,15 +23,12 @@
enabled: true
handlers:
- name: Reload daemon
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: Restart service
become: true
ansible.builtin.service:
ansible.builtin.systemd:
name: lyon-transports
state: restarted
daemon_reload: true
vars:
dir: /mnt/data/lyon-transports

View file

@ -1,13 +0,0 @@
[Unit]
Description=Goatcounter
After=network.target
[Service]
ExecStart={{ dir }}/goatcounter serve -listen *:8005 -tls http -smtp smtps://goatcounter%%40mg.augendre.info:{{gc_mailgun_api_key}}@smtp.mailgun.org:587 -email-from goatcounter@mg.augendre.info -automigrate -db sqlite+{{ dir }}/db/goatcounter.sqlite3
Type=simple
Restart=always
User=gaugendre
Group=gaugendre
[Install]
WantedBy=default.target

View file

@ -0,0 +1,13 @@
[Unit]
Description=Goatcounter
After=network.target
[Service]
ExecStart={{ dir }}/goatcounter serve -listen 127.0.0.1:8005 -tls http -smtp smtps://goatcounter%%40mg.augendre.info:{{gc_mailgun_api_key}}@smtp.mailgun.org:587 -email-from goatcounter@mg.augendre.info -automigrate -db sqlite+{{ dir }}/db/goatcounter.sqlite3
Type=simple
Restart=always
User=gaugendre
Group=gaugendre
[Install]
WantedBy=default.target

View file

@ -1,13 +0,0 @@
[Unit]
Description=Lyon transports API
After=network.target
[Service]
ExecStart={{ dir }}/lyon-transports-linux-amd64 --host 0.0.0.0 --port 8013 -u {{ lyon_transports_username }} -p {{ lyon_transports_password }} --cors-allowed-origin https://display.augendre.info
Type=simple
Restart=always
User=gaugendre
Group=gaugendre
[Install]
WantedBy=default.target

View file

@ -0,0 +1,13 @@
[Unit]
Description=Lyon transports API
After=network.target
[Service]
ExecStart={{ dir }}/lyon-transports-linux-amd64 --host 127.0.0.1 --port 8013 -u {{ lyon_transports_username }} -p {{ lyon_transports_password }} --cors-allowed-origin https://display.augendre.info
Type=simple
Restart=always
User=gaugendre
Group=gaugendre
[Install]
WantedBy=default.target

View file

@ -0,0 +1,11 @@
---
- name: Watchtower
hosts: servers
gather_facts: false
tasks:
- name: Docker
ansible.builtin.include_role:
name: docker
vars:
docker_app_name: watchtower

View file

@ -2,3 +2,4 @@
docker_app_name: some-app
docker_dir: /mnt/data/{{ docker_app_name }}
docker_build: policy
docker_remove_orphans: true

View file

@ -1,12 +1,13 @@
---
- name: Stop service
listen: Restart service
community.docker.docker_compose_v2:
project_src: "{{ docker_dir }}"
state: stopped
listen: Restart service
- name: Start service
listen: Restart service
community.docker.docker_compose_v2:
project_src: "{{ docker_dir }}"
state: present
build: "{{ docker_build }}"
listen: Restart service
remove_orphans: "{{ docker_remove_orphans }}"

View file

@ -30,3 +30,4 @@
community.docker.docker_compose_v2:
project_src: "{{ docker_dir }}"
state: present
remove_orphans: "{{ docker_remove_orphans }}"