speedtest: enable automatic updates of docker images

This commit is contained in:
Markus 2024-11-14 18:23:31 +01:00
parent 90b6048276
commit 132b9651f2
5 changed files with 41 additions and 3 deletions

View File

@ -3,11 +3,14 @@
- name: Reload systemd - name: Reload systemd
systemd: daemon_reload=yes systemd: daemon_reload=yes
- name: Restart nginx
service: name=nginx state=restarted
- name: Restart speedtest - name: Restart speedtest
service: name=speedtest state=restarted service: name=speedtest state=restarted
- name: Restart speedtest-reload
service: name=speedtest-reload state=restarted
- name: Restart nginx
service: name=nginx state=restarted
- name: Run acertmgr - name: Run acertmgr
command: /usr/bin/acertmgr command: /usr/bin/acertmgr

View File

@ -43,5 +43,17 @@
- Reload systemd - Reload systemd
- Restart speedtest - Restart speedtest
- name: Systemd unit for speedtest-reload
template: src=speedtest-reload.{{ item }}.j2 dest=/etc/systemd/system/speedtest-reload.{{ item }}
with_items:
- "service"
- "timer"
notify:
- Reload systemd
- Restart speedtest-reload
- name: Start the speedtest service - name: Start the speedtest service
service: name=speedtest state=started enabled=yes service: name=speedtest state=started enabled=yes
- name: Enable auto update timer
service: name=speedtest-reload.timer state=started enabled=yes

View File

@ -0,0 +1,7 @@
[Unit]
Description=Refresh speedtest images
[Service]
Type=oneshot
ExecStart=/bin/systemctl reload-or-restart speedtest.service

View File

@ -0,0 +1,10 @@
[Unit]
Description=Refresh speedtest images
Requires=speedtest.service
After=speedtest.service
[Timer]
OnCalendar=*:0/15
[Install]
WantedBy=timers.target

View File

@ -17,6 +17,8 @@ WorkingDirectory=/opt/speedtest
# Make sure no old containers are running # Make sure no old containers are running
ExecStartPre=/usr/bin/docker-compose down -v ExecStartPre=/usr/bin/docker-compose down -v
# Update images
ExecStartPre=-/usr/bin/docker-compose pull --quiet
# Compose up # Compose up
ExecStart=/usr/bin/docker-compose up ExecStart=/usr/bin/docker-compose up
@ -24,5 +26,9 @@ ExecStart=/usr/bin/docker-compose up
# Compose down, remove containers and volumes # Compose down, remove containers and volumes
ExecStop=/usr/bin/docker-compose down -v ExecStop=/usr/bin/docker-compose down -v
# Refresh on reload
ExecReload=-/usr/bin/docker-compose pull --quiet
ExecReload=/usr/bin/docker-compose up -d
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target