Add uptime kuma
This commit is contained in:
parent
9fd25952a8
commit
47f90af3d6
8 changed files with 37 additions and 1 deletions
|
@ -10,5 +10,6 @@ mailer:
|
||||||
|
|
||||||
|
|
||||||
services_path: /opt/services/
|
services_path: /opt/services/
|
||||||
caddy_config_path: "{{ (services_path, 'caddy', 'config', 'conf.d') | path_join }}"
|
caddy_path: "{{ (services_path, 'caddy') | path_join }}"
|
||||||
|
caddy_config_path: "{{ (caddy_path, 'config', 'conf.d') | path_join }}"
|
||||||
managed_sites: []
|
managed_sites: []
|
||||||
|
|
|
@ -9,5 +9,6 @@
|
||||||
- homebox
|
- homebox
|
||||||
- influxdb
|
- influxdb
|
||||||
- umami
|
- umami
|
||||||
|
- uptime-kuma
|
||||||
- watchtower
|
- watchtower
|
||||||
- wiki-js
|
- wiki-js
|
||||||
|
|
7
_ansible/roles/uptime-kuma/tasks/main.yml
Normal file
7
_ansible/roles/uptime-kuma/tasks/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
- name: Deploy {{ svc.name }}
|
||||||
|
tags:
|
||||||
|
- uptime-kuma
|
||||||
|
- status
|
||||||
|
block:
|
||||||
|
- import_tasks: deploy-common-service.yml
|
14
_ansible/roles/uptime-kuma/vars/main.yml
Normal file
14
_ansible/roles/uptime-kuma/vars/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
svc:
|
||||||
|
domain: "status.serguzim.me"
|
||||||
|
name: uptime-kuma
|
||||||
|
port: 3001
|
||||||
|
|
||||||
|
compose:
|
||||||
|
watchtower: true
|
||||||
|
image: louislam/uptime-kuma:1
|
||||||
|
volumes:
|
||||||
|
- data:/app/data
|
||||||
|
file:
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
- import_tasks: steps/create-service-directory.yml
|
- import_tasks: steps/create-service-directory.yml
|
||||||
- import_tasks: steps/template-docker-compose.yml
|
- import_tasks: steps/template-docker-compose.yml
|
||||||
- import_tasks: steps/template-service-env.yml
|
- import_tasks: steps/template-service-env.yml
|
||||||
|
when: compose.env|default(False) == True
|
||||||
- include_tasks: steps/template-site-config.yml
|
- include_tasks: steps/template-site-config.yml
|
||||||
when: svc.domain is defined
|
when: svc.domain is defined
|
||||||
- import_tasks: steps/start-service.yml
|
- import_tasks: steps/start-service.yml
|
||||||
|
|
|
@ -7,3 +7,9 @@
|
||||||
- name: Register caddy site
|
- name: Register caddy site
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
managed_sites: "{{ managed_sites + [svc.domain + '.conf'] }}"
|
managed_sites: "{{ managed_sites + [svc.domain + '.conf'] }}"
|
||||||
|
|
||||||
|
- name: Reload caddy
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: docker compose exec app sh -c "caddy validate --config /etc/caddy/Caddyfile && caddy reload --config /etc/caddy/Caddyfile"
|
||||||
|
chdir: "{{ caddy_path }}"
|
||||||
|
changed_when: True
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
HC_UID=
|
HC_UID=
|
||||||
|
UPTIME_KUMA_TOKEN=
|
||||||
|
|
||||||
RESTIC_REPOSITORY=
|
RESTIC_REPOSITORY=
|
||||||
RESTIC_PASSWORD=
|
RESTIC_PASSWORD=
|
||||||
|
|
|
@ -10,6 +10,7 @@ set +a
|
||||||
hc_url="https://hc-ping.com/$HC_UID"
|
hc_url="https://hc-ping.com/$HC_UID"
|
||||||
|
|
||||||
curl -fsSL --retry 3 "$hc_url/start" >/dev/null
|
curl -fsSL --retry 3 "$hc_url/start" >/dev/null
|
||||||
|
duration_start=$(date +%s)
|
||||||
|
|
||||||
BACKUP_LOCATION="/tmp/backup-misc"
|
BACKUP_LOCATION="/tmp/backup-misc"
|
||||||
|
|
||||||
|
@ -57,4 +58,8 @@ time _backup_prepare_mailcow >/tmp/backup-mailcow.log || _hc_fail
|
||||||
cd /opt/services/backup/
|
cd /opt/services/backup/
|
||||||
docker compose run --rm backup || _hc_fail
|
docker compose run --rm backup || _hc_fail
|
||||||
|
|
||||||
|
duration_end=$(date +%s)
|
||||||
curl -fsSL --retry 3 "$hc_url"
|
curl -fsSL --retry 3 "$hc_url"
|
||||||
|
|
||||||
|
duration=$((duration_end - duration_start))
|
||||||
|
curl -fsSL --retry 3 "https://status.serguzim.me/api/push/$UPTIME_KUMA_TOKEN?status=up&msg=OK&ping=${duration}000"
|
||||||
|
|
Reference in a new issue