Merge pull request 'Add uptime kuma as a service we can deploy to a different host for monitoring.' (#196) from add_uptime_data_coop into main
Reviewed-on: #196 Reviewed-by: Sam A. <samsapti@noreply@git.data.coop>
This commit is contained in:
commit
d90b769640
|
@ -1,3 +1,5 @@
|
||||||
######################################
|
[production]
|
||||||
### All hosts
|
|
||||||
hevonen.servers.data.coop ansible_port=19022 ansible_python_interpreter=/usr/bin/python3
|
hevonen.servers.data.coop ansible_port=19022 ansible_python_interpreter=/usr/bin/python3
|
||||||
|
|
||||||
|
[monitoring]
|
||||||
|
uptime.data.coop ansible_python_interpreter=/usr/bin/python3
|
|
@ -1,6 +1,6 @@
|
||||||
# vim: ft=yaml.ansible
|
# vim: ft=yaml.ansible
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: production
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
|
@ -15,6 +15,9 @@
|
||||||
smtp_host: "postfix"
|
smtp_host: "postfix"
|
||||||
smtp_port: "587"
|
smtp_port: "587"
|
||||||
|
|
||||||
|
services_exclude:
|
||||||
|
- uptime_kuma
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- import_role:
|
- import_role:
|
||||||
name: ubuntu_base
|
name: ubuntu_base
|
||||||
|
|
|
@ -4,7 +4,6 @@ volume_root_folder: "/docker-volumes"
|
||||||
volume_website_folder: "{{ volume_root_folder }}/websites"
|
volume_website_folder: "{{ volume_root_folder }}/websites"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
### Internal services ###
|
### Internal services ###
|
||||||
postfix:
|
postfix:
|
||||||
domain: "smtp.{{ base_domain }}"
|
domain: "smtp.{{ base_domain }}"
|
||||||
|
@ -62,7 +61,6 @@ services:
|
||||||
version: "2"
|
version: "2"
|
||||||
|
|
||||||
### External services ###
|
### External services ###
|
||||||
|
|
||||||
nextcloud:
|
nextcloud:
|
||||||
domain: "cloud.{{ base_domain }}"
|
domain: "cloud.{{ base_domain }}"
|
||||||
volume_folder: "{{ volume_root_folder }}/nextcloud"
|
volume_folder: "{{ volume_root_folder }}/nextcloud"
|
||||||
|
@ -208,3 +206,14 @@ services:
|
||||||
watchtower:
|
watchtower:
|
||||||
volume_folder: "{{ volume_root_folder }}/watchtower"
|
volume_folder: "{{ volume_root_folder }}/watchtower"
|
||||||
version: "1.5.3"
|
version: "1.5.3"
|
||||||
|
|
||||||
|
### Uptime monitoring ###
|
||||||
|
uptime_kuma:
|
||||||
|
domain: "uptime.{{ base_domain }}"
|
||||||
|
status_domain: "status.{{ base_domain }}"
|
||||||
|
volume_folder: "{{ volume_root_folder }}/uptime_kuma"
|
||||||
|
pre_deploy_tasks: true
|
||||||
|
version: "latest"
|
||||||
|
|
||||||
|
services_exclude: []
|
||||||
|
services_include: "{{ services | dict2items | map(attribute='key') | list | difference(services_exclude) }}"
|
||||||
|
|
4
roles/docker/files/vhost/uptime_kuma
Normal file
4
roles/docker/files/vhost/uptime_kuma
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
9
roles/docker/tasks/pre_deploy/uptime_kuma.yml
Normal file
9
roles/docker/tasks/pre_deploy/uptime_kuma.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
- name: Upload vhost config for uptime domain
|
||||||
|
copy:
|
||||||
|
src: vhost/uptime_kuma
|
||||||
|
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.uptime_kuma.domain }}_location"
|
||||||
|
|
||||||
|
- name: Upload vhost config for status domain
|
||||||
|
copy:
|
||||||
|
src: vhost/uptime_kuma
|
||||||
|
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.uptime_kuma.status_domain }}_location"
|
|
@ -8,8 +8,10 @@
|
||||||
include_tasks:
|
include_tasks:
|
||||||
file: block.yml
|
file: block.yml
|
||||||
vars:
|
vars:
|
||||||
service: "{{ item }}"
|
service:
|
||||||
loop: "{{ services | dict2items(key_name='name', value_name='vars') }}"
|
name: "{{ item }}"
|
||||||
|
vars: "{{ services[item] }}"
|
||||||
|
loop: "{{ services_include }}"
|
||||||
when: single_service is not defined and
|
when: single_service is not defined and
|
||||||
(item.vars.disabled_in_vagrant is not defined or
|
(item.vars.disabled_in_vagrant is not defined or
|
||||||
not (item.vars.disabled_in_vagrant and vagrant))
|
not (item.vars.disabled_in_vagrant and vagrant))
|
||||||
|
@ -18,7 +20,9 @@
|
||||||
include_tasks:
|
include_tasks:
|
||||||
file: block.yml
|
file: block.yml
|
||||||
vars:
|
vars:
|
||||||
service: "{{ {single_service: services[single_service]} | dict2items(key_name='name', value_name='vars') | join }}"
|
service:
|
||||||
|
name: "{{ single_service }}"
|
||||||
|
vars: "{{ services[single_service] }}"
|
||||||
when: single_service is defined and single_service in services and
|
when: single_service is defined and single_service in services and
|
||||||
(services[single_service].disabled_in_vagrant is not defined or
|
(services[single_service].disabled_in_vagrant is not defined or
|
||||||
not (services[single_service].disabled_in_vagrant and vagrant))
|
not (services[single_service].disabled_in_vagrant and vagrant))
|
||||||
|
|
21
roles/docker/templates/compose-files/uptime_kuma.yml.j2
Normal file
21
roles/docker/templates/compose-files/uptime_kuma.yml.j2
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# vim: ft=yaml.docker-compose
|
||||||
|
version: '3.3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
uptime-kuma:
|
||||||
|
image: "louislam/uptime-kuma:{{ services.uptime_kuma.version }}"
|
||||||
|
restart: always
|
||||||
|
container_name: uptime-kuma
|
||||||
|
networks:
|
||||||
|
- external_services
|
||||||
|
volumes:
|
||||||
|
- "./uptime-kuma-data:/app/data"
|
||||||
|
environment:
|
||||||
|
VIRTUAL_HOST: "{{ services.uptime_kuma.domain }},{{ services.uptime_kuma.status_domain }}"
|
||||||
|
LETSENCRYPT_HOST: "{{ services.uptime_kuma.domain }},{{ services.uptime_kuma.status_domain }}"
|
||||||
|
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
external_services:
|
||||||
|
external: true
|
|
@ -14,4 +14,4 @@
|
||||||
- name: Install Dell OpenManage
|
- name: Install Dell OpenManage
|
||||||
apt:
|
apt:
|
||||||
name: srvadmin-all
|
name: srvadmin-all
|
||||||
when: not vagrant
|
when: not vagrant and not skip_dell_apt_repo
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
---
|
---
|
||||||
- import_tasks: ssh-port.yml
|
- import_tasks: ssh-port.yml
|
||||||
tags: [change-ssh-port]
|
tags: [change-ssh-port]
|
||||||
|
when: not do_not_change_ssh_port
|
||||||
|
|
||||||
- import_tasks: dell-apt-repo.yml
|
- import_tasks: dell-apt-repo.yml
|
||||||
tags: [setup-dell-apt-repo]
|
tags: [setup-dell-apt-repo]
|
||||||
when: not vagrant
|
when: not skip_dell_apt_repo and not vagrant
|
||||||
|
|
||||||
- import_tasks: upgrade.yml
|
- import_tasks: upgrade.yml
|
||||||
tags: [do-full-system-upgrade]
|
tags: [do-full-system-upgrade]
|
||||||
|
|
24
uptime.data.coop.yml
Normal file
24
uptime.data.coop.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# vim: ft=yaml.ansible
|
||||||
|
---
|
||||||
|
- hosts: monitoring
|
||||||
|
gather_facts: true
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
vagrant: false
|
||||||
|
base_domain: "{{ 'datacoop.devel' if vagrant else 'data.coop' }}"
|
||||||
|
letsencrypt_enabled: true
|
||||||
|
letsencrypt_email: "admin@{{ base_domain }}"
|
||||||
|
services_include:
|
||||||
|
- nginx_proxy
|
||||||
|
- uptime_kuma
|
||||||
|
- watchtower
|
||||||
|
do_not_change_ssh_port: true
|
||||||
|
skip_dell_apt_repo: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- import_role:
|
||||||
|
name: ubuntu_base
|
||||||
|
tags:
|
||||||
|
- base_only
|
||||||
|
- import_role:
|
||||||
|
name: docker
|
|
@ -1 +1,2 @@
|
||||||
|
[production]
|
||||||
localhost ansible_port=19022
|
localhost ansible_port=19022
|
||||||
|
|
Loading…
Reference in a new issue