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: display.yaml # noqa: name[play]
- import_playbook: ghost-config.yaml # noqa: name[play] - import_playbook: ghost-config.yaml # noqa: name[play]
- import_playbook: ghost-update.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: goatcounter.yaml # noqa: name[play]
- import_playbook: lyon-transports.yaml # noqa: name[play] - import_playbook: lyon-transports.yaml # noqa: name[play]
- import_playbook: manuels.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: test_headers.yaml # noqa: name[play]
- import_playbook: voice-pipeline.yaml # noqa: name[play] - import_playbook: voice-pipeline.yaml # noqa: name[play]
- import_playbook: wallabag.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] - import_playbook: ynab.yaml # noqa: name[play]

View file

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

View file

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

View file

@ -1,6 +1,6 @@
services: services:
app: app:
image: python:3.13-slim image: python:3-slim
command: python /app/app.py command: python /app/app.py
volumes: volumes:
- ./:/app - ./:/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 hosts: servers
gather_facts: false gather_facts: false
tasks: tasks:

View file

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

View file

@ -6,13 +6,12 @@
- name: Write service file - name: Write service file
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: templates/lyon-transports.service.j2 src: templates/lyon-transports/lyon-transports.service.j2
dest: /etc/systemd/system/lyon-transports.service dest: /etc/systemd/system/lyon-transports.service
mode: "0600" mode: "0600"
owner: root owner: root
group: root group: root
notify: notify:
- Reload daemon
- Restart service - Restart service
- name: Flush handlers - name: Flush handlers
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers
@ -24,15 +23,12 @@
enabled: true enabled: true
handlers: handlers:
- name: Reload daemon
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: Restart service - name: Restart service
become: true become: true
ansible.builtin.service: ansible.builtin.systemd:
name: lyon-transports name: lyon-transports
state: restarted state: restarted
daemon_reload: true
vars: vars:
dir: /mnt/data/lyon-transports 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_app_name: some-app
docker_dir: /mnt/data/{{ docker_app_name }} docker_dir: /mnt/data/{{ docker_app_name }}
docker_build: policy docker_build: policy
docker_remove_orphans: true

View file

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

View file

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