Skip to content

Commit

Permalink
Optionally create docker network for healthchecks/gatus
Browse files Browse the repository at this point in the history
  • Loading branch information
claha committed Aug 8, 2023
1 parent 0bb5f2f commit 817fe54
Show file tree
Hide file tree
Showing 9 changed files with 437 additions and 424 deletions.
2 changes: 2 additions & 0 deletions host_vars/oci0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
gatus_healthchecks_url: "http://{{ oci1_ip_tailscale }}"
4 changes: 4 additions & 0 deletions host_vars/oci1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
healthchecks_network: monitor
gatus_healthchecks_network: monitor
gatus_healthchecks_url: "http://healthchecks"
4 changes: 2 additions & 2 deletions main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@
tags: never, init
- role: tailscale
tags: tailscale
- role: healthchecks
tags: healthchecks
- role: gatus
tags: gatus
- role: glances
tags: glances
- role: dashdot
tags: dashdot
- role: healthchecks
tags: healthchecks

- name: Setup ampere
hosts: ampere
Expand Down
10 changes: 0 additions & 10 deletions roles/gatus/files/compose.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions roles/gatus/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
- "{{ service_path }}"

- name: Create compose file
ansible.builtin.copy:
src: "files/compose.yaml"
ansible.builtin.template:
src: "templates/compose.yaml.j2"
dest: "{{ service_path }}/compose.yaml"
mode: "0640"
notify: "Recreate {{ service_name }}"
Expand Down
20 changes: 20 additions & 0 deletions roles/gatus/templates/compose.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
services:
gatus:
image: ghcr.io/twin/gatus:v5.5.1
container_name: gatus
{% if gatus_healthchecks_network is defined %}
networks:
- {{ gatus_healthchecks_network }}
{% endif %}
ports:
- 8080:8080
volumes:
- ./config.yaml:/config/config.yaml
restart: unless-stopped

{% if gatus_healthchecks_network is defined %}
networks:
{{ gatus_healthchecks_network }}:
external: true
{% endif %}
2 changes: 1 addition & 1 deletion roles/gatus/templates/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ endpoints:
{% endfor %}
{% for endpoint in gatus_healthcheck_endpoints %}
- name: {{ endpoint.name }}
url: "{{ endpoint.url }}"
url: "{{ gatus_healthchecks_url }}:8000/api/v3/checks/{{ endpoint.uuid }}"
headers:
X-Api-Key: {{ healthchecks_api_key }}
interval: 15m
Expand Down
11 changes: 11 additions & 0 deletions roles/healthchecks/templates/compose.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ services:
healthchecks:
image: docker.io/healthchecks/healthchecks:v2.10
container_name: healthchecks
{% if healthchecks_network is defined %}
networks:
- {{ healthchecks_network }}
{% endif %}
ports:
- 8000:8000
environment:
Expand All @@ -14,3 +18,10 @@ services:
- ./data:/data
- ./uwsgi.ini:/opt/healthchecks/docker/uwsgi.ini:ro
restart: unless-stopped

{% if healthchecks_network is defined %}
networks:
{{ healthchecks_network }}:
name: {{ healthchecks_network }}
driver: bridge
{% endif %}
804 changes: 395 additions & 409 deletions vars/vault.yaml

Large diffs are not rendered by default.

0 comments on commit 817fe54

Please sign in to comment.