From 5d91bc039fcee247ad288c175f254f57a72f1fa3 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 2 Jan 2024 11:28:02 +0100 Subject: [PATCH 01/13] Removed deprecated depends_on attribut --- roles/docker-gitea/templates/docker-compose.yml.j2 | 4 +--- roles/docker-joomla/templates/docker-compose.yml.j2 | 2 +- roles/docker-mediawiki/tasks/main.yml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index cb43f04f..68b0e50f 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -30,8 +30,6 @@ services: {% if not ( enable_central_database | lower | bool ) %} depends_on: - database - links: - - database {% include 'templates/docker-mariadb-service.yml.j2' %} {% endif %} @@ -43,4 +41,4 @@ volumes: networks: default: - driver: bridge + driver: bridge \ No newline at end of file diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index ec3707a4..e1749900 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -12,7 +12,7 @@ services: JOOMLA_DB_NAME: "{{database_databasename}}" restart: always {% if not ( enable_central_database | lower | bool ) %} - links: + depends_on: - database {% endif %} volumes: diff --git a/roles/docker-mediawiki/tasks/main.yml b/roles/docker-mediawiki/tasks/main.yml index b0b2e0b9..33dbe7a4 100644 --- a/roles/docker-mediawiki/tasks/main.yml +++ b/roles/docker-mediawiki/tasks/main.yml @@ -9,7 +9,7 @@ log_driver: journald image: mediawiki restart: always - links: + depends_on: - database volumes: - "mediawiki-data:/var/www/html/" From 4e09fbd3fbe64a958fa23bc41ac5de256635f5c7 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 2 Jan 2024 12:23:25 +0100 Subject: [PATCH 02/13] Implemented variable mapping to reduce complexity --- constructor.yml | 14 +++++++++++--- roles/backup-docker-to-local/tasks/main.yml | 2 +- roles/backup-remote-to-local/tasks/main.yml | 2 +- roles/cleanup-backups-timer/tasks/main.yml | 2 +- roles/cleanup-disc-space/tasks/main.yml | 2 +- roles/cleanup-failed-docker-backups/tasks/main.yml | 2 +- .../templates/docker-compose.yml.j2 | 4 ++-- .../templates/docker-compose.yml.j2 | 8 ++++---- .../templates/docker-compose.yml.j2 | 8 ++++---- roles/docker-gitea/templates/docker-compose.yml.j2 | 4 ++-- .../docker-gitlab/templates/docker-compose.yml.j2 | 6 +++--- .../docker-joomla/templates/docker-compose.yml.j2 | 6 +++--- .../templates/docker-compose.yml.j2 | 2 +- roles/docker-mailu/tasks/main.yml | 2 +- roles/docker-mailu/templates/docker-compose.yml.j2 | 8 ++++---- .../templates/docker-compose.yml.j2 | 10 +++++----- roles/docker-mastodon/templates/mastodon.conf.j2 | 2 +- .../docker-matomo/templates/docker-compose.yml.j2 | 4 ++-- .../templates/docker-compose.yml.j2 | 4 ++-- roles/docker-mybb/templates/docker-compose.yml.j2 | 6 +++--- .../templates/docker-compose.yml.j2 | 6 +++--- roles/docker-nextcloud/templates/nextcloud.conf.j2 | 2 +- .../templates/docker-compose.yml.j2 | 14 +++++++------- .../templates/docker-compose.yml.j2 | 4 ++-- roles/docker-peertube/templates/peertube.conf.j2 | 2 +- .../templates/docker-compose.yml.j2 | 6 +++--- .../templates/docker-compose.yml.j2 | 4 ++-- .../docker-yourls/templates/docker-compose.yml.j2 | 2 +- roles/heal-docker/tasks/main.yml | 2 +- roles/health-btrfs/tasks/main.yml | 2 +- roles/health-disc-space/tasks/main.yml | 2 +- roles/health-docker-container/tasks/main.yml | 2 +- roles/health-docker-volumes/tasks/main.yml | 2 +- roles/health-journalctl/tasks/main.yml | 2 +- roles/health-nginx/tasks/main.yml | 2 +- roles/health-nginx/templates/health-nginx.py.j2 | 2 +- roles/nginx-certbot/tasks/main.yml | 2 +- .../templates/domain.conf.j2 | 2 +- .../templates/homepage.nginx.conf.j2 | 2 +- roles/update-docker/tasks/main.yml | 2 +- tasks/implement-matomo-tracking.yml | 2 +- 41 files changed, 86 insertions(+), 78 deletions(-) diff --git a/constructor.yml b/constructor.yml index 45eb6c0d..16a61e2d 100644 --- a/constructor.yml +++ b/constructor.yml @@ -1,12 +1,20 @@ --- -# general setup -- name: general setup +- name: variable mapping + hosts: all + vars: + activate_all_timers: "{{ activate_all_timers | lower | bool }}" + nginx_matomo_tracking: "{{ nginx_matomo_tracking | lower | bool }}" + execute_updates: "{{ execute_updates | lower | bool }}" + force_backup_before_update: "{{ force_backup_before_update | lower | bool }}" + enable_central_database: "{{ enable_central_database | lower | bool }}" + +- name: update device hosts: all become: true tasks: roles: - role: update - when: execute_updates | bool + when: execute_updates - name: setup standard wireguard hosts: wireguard_server diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index d436835a..3b65ced3 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -37,7 +37,7 @@ - name: configure backup-docker-to-local.timer.tpl template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer register: backup_docker_to_local_timer - changed_when: backup_docker_to_local_timer.changed or activate_all_timers | bool + changed_when: backup_docker_to_local_timer.changed or activate_all_timers notify: restart backup-docker-to-local.timer when: run_once_backup_docker_to_local is not defined diff --git a/roles/backup-remote-to-local/tasks/main.yml b/roles/backup-remote-to-local/tasks/main.yml index 57c70220..f43489b6 100644 --- a/roles/backup-remote-to-local/tasks/main.yml +++ b/roles/backup-remote-to-local/tasks/main.yml @@ -17,7 +17,7 @@ - name: create backup-remote-to-local.timer template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/backup-remote-to-local.timer register: backup_backup_remote_to_local_timer - changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers | bool + changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers notify: restart backup-remote-to-local timer - name: create backups-remote-to-local.sh diff --git a/roles/cleanup-backups-timer/tasks/main.yml b/roles/cleanup-backups-timer/tasks/main.yml index f15a4fc1..5ee7f2bd 100644 --- a/roles/cleanup-backups-timer/tasks/main.yml +++ b/roles/cleanup-backups-timer/tasks/main.yml @@ -3,7 +3,7 @@ src: "cleanup-backups.timer.j2" dest: "/etc/systemd/system/cleanup-backups.timer" register: cleanup_backups_timer - changed_when: cleanup_backups_timer.changed or activate_all_timers | bool + changed_when: cleanup_backups_timer.changed or activate_all_timers notify: restart cleanup-backups.timer when: run_once_cleanup_backups_timer is not defined diff --git a/roles/cleanup-disc-space/tasks/main.yml b/roles/cleanup-disc-space/tasks/main.yml index 26a66e51..a7ceb6d2 100644 --- a/roles/cleanup-disc-space/tasks/main.yml +++ b/roles/cleanup-disc-space/tasks/main.yml @@ -20,5 +20,5 @@ src: cleanup-disc-space.timer.j2 dest: /etc/systemd/system/cleanup-disc-space.timer register: cleanup_disc_space_timer - changed_when: cleanup_disc_space_timer.changed or activate_all_timers | bool + changed_when: cleanup_disc_space_timer.changed or activate_all_timers notify: restart cleanup-disc-space.timer \ No newline at end of file diff --git a/roles/cleanup-failed-docker-backups/tasks/main.yml b/roles/cleanup-failed-docker-backups/tasks/main.yml index b36c0f18..a38df6a4 100644 --- a/roles/cleanup-failed-docker-backups/tasks/main.yml +++ b/roles/cleanup-failed-docker-backups/tasks/main.yml @@ -24,7 +24,7 @@ src: cleanup-failed-docker-backups.timer.j2 dest: /etc/systemd/system/cleanup-failed-docker-backups.timer register: cleanup_failed_docker_backups_timer - changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers | bool + changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers notify: restart cleanup-failed-docker-backups.timer when: run_once_cleanup_failed_docker_backups is not defined diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index dfe128d5..b847cfe4 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -14,7 +14,7 @@ services: - env/run.env environment: - AKAUNTING_SETUP -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database @@ -23,6 +23,6 @@ services: volumes: data: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} \ No newline at end of file diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index 4642d39c..2c664ac6 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -9,7 +9,7 @@ services: - .:/usr/share/nginx/html - .:/var/www depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - maildev @@ -20,7 +20,7 @@ services: worker: image: attendize_worker:latest depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - maildev @@ -36,7 +36,7 @@ services: {% include 'templates/docker-redis-service.yml.j2' %} -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database @@ -45,6 +45,6 @@ services: volumes: redis: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} \ No newline at end of file diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index 940becd9..1cf97f1d 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -10,7 +10,7 @@ services: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - postgres % endif %} - redis @@ -25,7 +25,7 @@ services: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - postgres % endif %} - redis @@ -62,7 +62,7 @@ services: # override those variables in your .env file if needed - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-postgres-service.yml.j2' %} {% endif %} @@ -70,6 +70,6 @@ volumes: data: redis: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} \ No newline at end of file diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index 68b0e50f..2150cab0 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -27,7 +27,7 @@ services: - data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database {% include 'templates/docker-mariadb-service.yml.j2' %} @@ -35,7 +35,7 @@ services: volumes: data: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index e5fc014b..33a85cd9 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -33,7 +33,7 @@ services: - 'data:/var/opt/gitlab' shm_size: '256m' depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: condition: service_healthy {% endif %} @@ -41,7 +41,7 @@ services: {% include 'templates/docker-redis-service.yml.j2' %} -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-postgres-service.yml.j2' %} {% endif %} @@ -50,6 +50,6 @@ volumes: config: logs: data: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index e1749900..9a9c8594 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -11,7 +11,7 @@ services: JOOMLA_DB_PASSWORD: "{{database_password}}" JOOMLA_DB_NAME: "{{database_databasename}}" restart: always -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database {% endif %} @@ -20,12 +20,12 @@ services: ports: - "127.0.0.1:{{http_port}}:80" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-mariadb-service.yml.j2' %} {% endif %} volumes: data: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index 3a659b29..e0a99a89 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -12,7 +12,7 @@ services: volumes: - ./config.toml:/listmonk/config.toml -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index 4b09d8b2..a0bbec80 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -61,5 +61,5 @@ src: "deploy-letsencrypt-mailu.timer.j2" dest: "/etc/systemd/system/deploy-letsencrypt-mailu.timer" register: deploy_letsencrypt_mailu_timer - changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers | bool + changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers notify: restart deploy-letsencrypt-mailu.timer \ No newline at end of file diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index 74eccd20..ce4fded8 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -49,7 +49,7 @@ services: depends_on: resolver: condition: service_started -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: condition: service_healthy {% endif %} @@ -71,7 +71,7 @@ services: - resolver - front - redis -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} logging: @@ -202,12 +202,12 @@ services: - webmail dns: - 192.168.203.254 -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-postgres-service.yml.j2' %} {% endif %} volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} smtp_queue: diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index 0c22ce4c..d3cf97de 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -20,7 +20,7 @@ services: ports: - "127.0.0.1:{{http_port}}:3000" depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - redis @@ -42,7 +42,7 @@ services: ports: - "127.0.0.1:{{stream_port}}:4000" depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - redis @@ -54,7 +54,7 @@ services: env_file: .env.production command: bundle exec sidekiq depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - redis @@ -67,12 +67,12 @@ services: test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] logging: driver: journald -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-postgres-service.yml.j2' %} {% endif %} volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} redis: diff --git a/roles/docker-mastodon/templates/mastodon.conf.j2 b/roles/docker-mastodon/templates/mastodon.conf.j2 index e983d022..f20fc840 100644 --- a/roles/docker-mastodon/templates/mastodon.conf.j2 +++ b/roles/docker-mastodon/templates/mastodon.conf.j2 @@ -8,7 +8,7 @@ server { {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking | bool %} + {% if nginx_matomo_tracking %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index 022c018d..c9749067 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -16,14 +16,14 @@ services: MATOMO_DATABASE_DBNAME: "{{database_databasename}}" volumes: - data:/var/www/html -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database {% include 'templates/docker-mariadb-service.yml.j2' %} {% endif %} volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} data: diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 02605f95..27f12f8a 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -16,7 +16,7 @@ services: - SYNAPSE_REPORT_STATS=no ports: - "127.0.0.1:{{synapse_http_port}}:8008" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database {% include 'templates/docker-postgres-service.yml.j2' %} @@ -60,7 +60,7 @@ services: # - instagram_bridge_data:/data volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} synapse_data: diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index 806a9018..6a300ebf 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -9,7 +9,7 @@ services: restart: always volumes: - data:/var/www/html -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database {% endif %} @@ -26,12 +26,12 @@ services: - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "data:/var/www/html:ro" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-mariadb-service.yml.j2' %} {% endif %} volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} data: diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index 6c326e23..112c762c 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -13,7 +13,7 @@ services: MYSQL_USER: "{{database_username}}" MYSQL_PASSWORD: "{{database_password}}" MYSQL_HOST: {{database_host}}:3306 -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database @@ -45,12 +45,12 @@ services: - data:/var/www/html entrypoint: /cron.sh depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - redis volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} data: diff --git a/roles/docker-nextcloud/templates/nextcloud.conf.j2 b/roles/docker-nextcloud/templates/nextcloud.conf.j2 index 007fcfe7..6945a385 100644 --- a/roles/docker-nextcloud/templates/nextcloud.conf.j2 +++ b/roles/docker-nextcloud/templates/nextcloud.conf.j2 @@ -4,7 +4,7 @@ server {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking | bool %} + {% if nginx_matomo_tracking %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 611a520b..0b38061e 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -5,7 +5,7 @@ networks: backend: volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} data: @@ -30,13 +30,13 @@ x-op-app: &app IMAP_ENABLED: "${IMAP_ENABLED:-false}" volumes: - "data:/var/openproject/assets" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - "database:/var/openproject/pgdata" {% endif %} services: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} {% include 'templates/docker-postgres-service.yml.j2' %} {% endif %} networks: @@ -62,7 +62,7 @@ services: - frontend volumes: - "data:/var/openproject/assets" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - "database:/var/openproject/pgdata" {% endif %} @@ -73,7 +73,7 @@ services: - frontend - backend depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - cache @@ -102,7 +102,7 @@ services: networks: - backend depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - cache @@ -114,7 +114,7 @@ services: networks: - backend depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - cache diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index 9f0fc721..35a22df7 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -15,7 +15,7 @@ services: restart: "always" depends_on: - redis -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% include 'templates/docker-postgres-service.yml.j2' %} @@ -27,7 +27,7 @@ services: - .env volumes: assets: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} data: diff --git a/roles/docker-peertube/templates/peertube.conf.j2 b/roles/docker-peertube/templates/peertube.conf.j2 index ece8161e..ec84d8bc 100644 --- a/roles/docker-peertube/templates/peertube.conf.j2 +++ b/roles/docker-peertube/templates/peertube.conf.j2 @@ -3,7 +3,7 @@ server { {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking | bool %} + {% if nginx_matomo_tracking %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 1f8d0780..a8f471fa 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -15,7 +15,7 @@ services: ports: - "{{http_port}}:80" depends_on: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database {% endif %} - redis @@ -39,7 +39,7 @@ services: depends_on: - redis - application -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} - database @@ -49,7 +49,7 @@ services: {% include 'templates/docker-redis-service.yml.j2' %} volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} redis: diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index 14ded290..73f80ea4 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -17,7 +17,7 @@ services: WORDPRESS_DB_NAME: "{{database_databasename}}" volumes: - data:/var/www/html -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database @@ -25,7 +25,7 @@ services: {% endif %} volumes: -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} database: {% endif %} data: diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index b28dcdab..9c271134 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -16,7 +16,7 @@ services: YOURLS_SITE: "https://{{domain}}" YOURLS_USER: "{{yourls_user}}" YOURLS_PASS: "{{yourls_user_password}}" -{% if not ( enable_central_database | lower | bool ) %} +{% if not enable_central_database %} depends_on: - database diff --git a/roles/heal-docker/tasks/main.yml b/roles/heal-docker/tasks/main.yml index 8c4c2c44..e306af78 100644 --- a/roles/heal-docker/tasks/main.yml +++ b/roles/heal-docker/tasks/main.yml @@ -23,7 +23,7 @@ src: heal-docker.timer.j2 dest: "/etc/systemd/system/heal-docker.timer" register: heal_docker_timer - changed_when: heal_docker_timer.changed or activate_all_timers | bool + changed_when: heal_docker_timer.changed or activate_all_timers notify: restart heal-docker.timer when: run_once_heal_docker is not defined diff --git a/roles/health-btrfs/tasks/main.yml b/roles/health-btrfs/tasks/main.yml index cc7d27fc..aa05a697 100644 --- a/roles/health-btrfs/tasks/main.yml +++ b/roles/health-btrfs/tasks/main.yml @@ -20,5 +20,5 @@ src: health-btrfs.timer.j2 dest: "/etc/systemd/system/health-btrfs.timer" register: health_btrs_timer - changed_when: health_btrs_timer.changed or activate_all_timers | bool + changed_when: health_btrs_timer.changed or activate_all_timers notify: restart health-btrfs.timer diff --git a/roles/health-disc-space/tasks/main.yml b/roles/health-disc-space/tasks/main.yml index e17c0d6f..eca7f270 100644 --- a/roles/health-disc-space/tasks/main.yml +++ b/roles/health-disc-space/tasks/main.yml @@ -20,5 +20,5 @@ src: health-disc-space.timer.j2 dest: /etc/systemd/system/health-disc-space.timer register: health_disc_space_timer - changed_when: health_disc_space_timer.changed or activate_all_timers | bool + changed_when: health_disc_space_timer.changed or activate_all_timers notify: restart health-disc-space.timer diff --git a/roles/health-docker-container/tasks/main.yml b/roles/health-docker-container/tasks/main.yml index 8fc8182a..89e3953d 100644 --- a/roles/health-docker-container/tasks/main.yml +++ b/roles/health-docker-container/tasks/main.yml @@ -21,7 +21,7 @@ src: health-docker-container.timer.j2 dest: "/etc/systemd/system/health-docker-container.timer" register: health_docker_container_timer - changed_when: health_docker_container_timer.changed or activate_all_timers | bool + changed_when: health_docker_container_timer.changed or activate_all_timers notify: restart health-docker-container.timer when: run_once_health_docker_container is not defined diff --git a/roles/health-docker-volumes/tasks/main.yml b/roles/health-docker-volumes/tasks/main.yml index dfd6838c..138fa41d 100644 --- a/roles/health-docker-volumes/tasks/main.yml +++ b/roles/health-docker-volumes/tasks/main.yml @@ -21,7 +21,7 @@ src: health-docker-volumes.timer.j2 dest: "/etc/systemd/system/health-docker-volumes.timer" register: health_docker_volumes_timer - changed_when: health_docker_volumes_timer.changed or activate_all_timers | bool + changed_when: health_docker_volumes_timer.changed or activate_all_timers notify: restart health-docker-volumes.timer when: run_once_health_docker_volumes is not defined diff --git a/roles/health-journalctl/tasks/main.yml b/roles/health-journalctl/tasks/main.yml index 78aaeb7b..9c937b58 100644 --- a/roles/health-journalctl/tasks/main.yml +++ b/roles/health-journalctl/tasks/main.yml @@ -20,5 +20,5 @@ src: health-journalctl.timer.j2 dest: /etc/systemd/system/health-journalctl.timer register: health_journalctl_timer - changed_when: health_journalctl_timer.changed or activate_all_timers | bool + changed_when: health_journalctl_timer.changed or activate_all_timers notify: restart health-journalctl.timer diff --git a/roles/health-nginx/tasks/main.yml b/roles/health-nginx/tasks/main.yml index 7810ef3d..11757eed 100644 --- a/roles/health-nginx/tasks/main.yml +++ b/roles/health-nginx/tasks/main.yml @@ -29,7 +29,7 @@ src: health-nginx.timer.j2 dest: "/etc/systemd/system/health-nginx.timer" register: health_nginx_timer - changed_when: health_nginx_timer.changed or activate_all_timers | bool + changed_when: health_nginx_timer.changed or activate_all_timers notify: restart health-nginx.timer when: run_once_health_nginx is not defined diff --git a/roles/health-nginx/templates/health-nginx.py.j2 b/roles/health-nginx/templates/health-nginx.py.j2 index c7f51eaf..91945a8f 100644 --- a/roles/health-nginx/templates/health-nginx.py.j2 +++ b/roles/health-nginx/templates/health-nginx.py.j2 @@ -31,7 +31,7 @@ for filename in os.listdir(config_path): # Determine expected status codes based on the domain if domain == '{{domain_listmonk}}': expected_statuses = [401] -{% if nginx_matomo_tracking | bool %} +{% if nginx_matomo_tracking %} elif parts[0] == 'www' or domain in redirected_domains: expected_statuses = [301] {% endif %} diff --git a/roles/nginx-certbot/tasks/main.yml b/roles/nginx-certbot/tasks/main.yml index 29b5e0b9..767698b6 100644 --- a/roles/nginx-certbot/tasks/main.yml +++ b/roles/nginx-certbot/tasks/main.yml @@ -16,7 +16,7 @@ src: certbot.timer.j2 dest: /etc/systemd/system/certbot.timer register: certbot_timer - changed_when: certbot_timer.changed or activate_all_timers | bool + changed_when: certbot_timer.changed or activate_all_timers notify: restart certbot timer when: run_once_nginx_certbot is not defined diff --git a/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 b/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 index e5dde64e..051c683e 100644 --- a/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 +++ b/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 @@ -3,7 +3,7 @@ server server_name {{domain}}; # Include Matomo Tracking Code - {% if nginx_matomo_tracking | bool %} + {% if nginx_matomo_tracking %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/nginx-homepage/templates/homepage.nginx.conf.j2 b/roles/nginx-homepage/templates/homepage.nginx.conf.j2 index 19406858..4c03694e 100644 --- a/roles/nginx-homepage/templates/homepage.nginx.conf.j2 +++ b/roles/nginx-homepage/templates/homepage.nginx.conf.j2 @@ -5,7 +5,7 @@ server {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking | bool %} + {% if nginx_matomo_tracking %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/update-docker/tasks/main.yml b/roles/update-docker/tasks/main.yml index c0576bf5..4b5bc5ef 100644 --- a/roles/update-docker/tasks/main.yml +++ b/roles/update-docker/tasks/main.yml @@ -2,7 +2,7 @@ systemd: name: backup-docker-to-local-everything.service state: started - when: force_backup_before_update | bool + when: force_backup_before_update - name: create {{update_docker_script}} copy: diff --git a/tasks/implement-matomo-tracking.yml b/tasks/implement-matomo-tracking.yml index bbebfd24..fe4636ac 100644 --- a/tasks/implement-matomo-tracking.yml +++ b/tasks/implement-matomo-tracking.yml @@ -1,4 +1,4 @@ - name: Activate NGINX matomo tracking include_role: name: nginx-matomo-tracking - when: nginx_matomo_tracking | bool and domain is defined \ No newline at end of file + when: nginx_matomo_tracking and domain is defined \ No newline at end of file From ab7ca07ac9a4e159345846d2e6f0bd33cbe03477 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 2 Jan 2024 21:13:34 +0100 Subject: [PATCH 03/13] Implemented vars, tasks and templates for central database setup until mastodon role --- roles/docker-akaunting/tasks/main.yml | 17 +++-- roles/docker-akaunting/templates/db.env.j2 | 9 --- .../templates/docker-compose.yml.j2 | 17 +++-- roles/docker-akaunting/templates/run.env.j2 | 8 +-- roles/docker-akaunting/vars/main.yml | 5 +- roles/docker-attendize/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 43 +++++------- roles/docker-attendize/vars/main.yml | 5 +- roles/docker-baserow/tasks/main.yml | 8 +++ .../templates/docker-compose.yml.j2 | 13 +++- roles/docker-baserow/templates/env.j2 | 10 +++ roles/docker-baserow/vars/main.yml | 4 +- roles/docker-bigbluebutton/vars/main.yml | 12 ++-- roles/docker-discourse/tasks/main.yml | 8 +++ roles/docker-discourse/templates/app.yml.j2 | 22 ++++-- roles/docker-discourse/vars/main.yml | 5 +- .../templates/docker-compose.yml.j2 | 10 --- roles/docker-funkwhale/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 24 +++---- roles/docker-funkwhale/vars/main.yml | 4 +- roles/docker-gitea/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 15 ++-- roles/docker-gitea/vars/main.yml | 7 +- roles/docker-gitlab/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 8 +-- roles/docker-gitlab/vars/main.yml | 7 +- roles/docker-joomla/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 19 +++-- roles/docker-joomla/vars/main.yml | 7 +- roles/docker-listmonk/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 12 ++-- roles/docker-listmonk/vars/main.yml | 7 +- roles/docker-mailu/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 69 +++++++++---------- roles/docker-mariadb/tasks/main.yml | 8 ++- roles/docker-mastodon/tasks/main.yml | 13 ++-- .../templates/.env.production.j2 | 2 + .../templates/docker-compose.yml.j2 | 54 +++++---------- roles/docker-mastodon/vars/main.yml | 7 +- roles/docker-matomo/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 9 +-- roles/docker-matomo/vars/main.yml | 5 +- roles/docker-matrix-compose/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 11 +-- roles/docker-matrix-compose/vars/main.yml | 8 +-- roles/docker-mybb/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 13 +--- roles/docker-mybb/vars/main.yml | 7 +- roles/docker-nextcloud/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 16 ++--- roles/docker-nextcloud/vars/main.yml | 7 +- roles/docker-openproject/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 35 +++------- roles/docker-openproject/vars/main.yml | 7 +- roles/docker-peertube/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 6 +- roles/docker-peertube/vars/main.yml | 5 +- roles/docker-pixelfed/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 30 +++----- roles/docker-pixelfed/vars/main.yml | 5 +- roles/docker-postgres/tasks/main.yml | 4 +- roles/docker-wordpress/tasks/main.yml | 12 ++-- .../templates/docker-compose.yml.j2 | 9 +-- roles/docker-wordpress/vars/main.yml | 5 +- roles/docker-yourls/tasks/main.yml | 13 ++-- .../templates/docker-compose.yml.j2 | 5 +- roles/docker-yourls/vars/main.yml | 5 +- templates/docker-database-volume.yml.j2 | 3 + .../docker-depends-on-central-database.yml.j2 | 5 ++ templates/docker-mariadb-service.yml.j2 | 6 +- .../docker-network-for-container-add.yml.j2 | 0 .../docker-networks-for-container.yml.j2 | 5 ++ templates/docker-networks-for-role.yml.j2 | 6 ++ templates/docker-postgres-service.yml.j2 | 7 +- templates/docker-redis-service.yml.j2 | 4 +- vars/docker-database-service.yml.j2 | 4 ++ 76 files changed, 431 insertions(+), 467 deletions(-) delete mode 100644 roles/docker-akaunting/templates/db.env.j2 create mode 100644 templates/docker-database-volume.yml.j2 create mode 100644 templates/docker-depends-on-central-database.yml.j2 create mode 100644 templates/docker-network-for-container-add.yml.j2 create mode 100644 templates/docker-networks-for-container.yml.j2 create mode 100644 templates/docker-networks-for-role.yml.j2 create mode 100644 vars/docker-database-service.yml.j2 diff --git a/roles/docker-akaunting/tasks/main.yml b/roles/docker-akaunting/tasks/main.yml index f5f0e389..a2dc4a22 100644 --- a/roles/docker-akaunting/tasks/main.yml +++ b/roles/docker-akaunting/tasks/main.yml @@ -1,19 +1,18 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: Create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "include tasks update-repository-with-docker-compose.yml" include_tasks: update-repository-with-docker-compose.yml -- name: configure db.env - template: src=db.env.j2 dest={{docker_compose_instance_directory}}/env/db.env - notify: docker compose project setup - - name: configure run.env template: src=run.env.j2 dest={{docker_compose_instance_directory}}/env/run.env notify: docker compose project setup diff --git a/roles/docker-akaunting/templates/db.env.j2 b/roles/docker-akaunting/templates/db.env.j2 deleted file mode 100644 index 6065ffbb..00000000 --- a/roles/docker-akaunting/templates/db.env.j2 +++ /dev/null @@ -1,9 +0,0 @@ -# These could be changed -MYSQL_DATABASE={{database_databasename}} -MYSQL_USER={{database_username}} - -# This should definitely be changed to something long and random -MYSQL_PASSWORD={{database_password}} - -# You should probably leave this -MYSQL_ROOT_PASSWORD={{database_password}} diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index b847cfe4..3d2aaafd 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3.7' services: + +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} + application: image: docker.io/akaunting/akaunting:{{version_akaunting}} build: @@ -14,15 +17,11 @@ services: - env/run.env environment: - AKAUNTING_SETUP -{% if not enable_central_database %} - depends_on: - - database - -{% include 'templates/docker-mariadb-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} volumes: data: -{% if not enable_central_database %} - database: -{% endif %} \ No newline at end of file +{% include 'templates/docker-database-volume.yml.j2' %} + +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-akaunting/templates/run.env.j2 b/roles/docker-akaunting/templates/run.env.j2 index ea88b876..df2aea59 100644 --- a/roles/docker-akaunting/templates/run.env.j2 +++ b/roles/docker-akaunting/templates/run.env.j2 @@ -3,12 +3,12 @@ APP_URL=https://{{domain}} LOCALE=en-US # Don't change this unless you rename your database container or use rootless podman, in case of using rootless podman you should set it to 127.0.0.1 (NOT localhost) -DB_HOST=akaunting-db +DB_HOST={{database_host}} # Change these to match env/db.env -DB_DATABASE=akaunting -DB_USERNAME=admin -DB_PASSWORD={{akaunting_database_password}} +DB_DATABASE={{database_databasename}} +DB_USERNAME={{database_username}} +DB_PASSWORD={{database_password}} # You should change this to a random string of three numbers or letters followed by an underscore DB_PREFIX=asd_ diff --git a/roles/docker-akaunting/vars/main.yml b/roles/docker-akaunting/vars/main.yml index 51eed924..9e5c4adf 100644 --- a/roles/docker-akaunting/vars/main.yml +++ b/roles/docker-akaunting/vars/main.yml @@ -1,9 +1,6 @@ docker_compose_project_name: "akaunting" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml" docker_compose_backup_path: "/tmp/{{docker_compose_project_name}}-docker-compose-backup.yml" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "admin" +database_type: "mariadb" database_password: "{{akaunting_database_password}}" repository_address: "https://github.com/akaunting/docker.git" diff --git a/roles/docker-attendize/tasks/main.yml b/roles/docker-attendize/tasks/main.yml index 542f3dfb..b223ae77 100644 --- a/roles/docker-attendize/tasks/main.yml +++ b/roles/docker-attendize/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: receive {{ mail_interface_domain }} certificate command: certbot certonly --agree-tos --email {{ administrator_email }} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ mail_interface_domain }} @@ -11,10 +19,5 @@ dest: "{{nginx_servers_directory}}{{domain}}.conf" notify: restart nginx -- name: Create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "include tasks update-repository-with-docker-compose.yml" include_tasks: update-repository-with-docker-compose.yml \ No newline at end of file diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index 2c664ac6..75d8a8f7 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -4,47 +4,40 @@ services: image: attendize_web:latest ports: - "{{http_port}}:80" - #- "8081:443" volumes: - .:/usr/share/nginx/html - .:/var/www - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - maildev - - redis - - worker +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + maildev: + redis: + worker: env_file: - ./.env +{% include 'templates/docker-networks-for-container.yml.j2' %} + worker: image: attendize_worker:latest - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - maildev - - redis +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + maildev: + redis: +{% include 'templates/docker-networks-for-container.yml.j2' %} volumes: - .:/usr/share/nginx/html - .:/var/www +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} + maildev: image: maildev/maildev ports: - "{{ mail_interface_http_port }}:1080" - +{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + {% include 'templates/docker-redis-service.yml.j2' %} -{% if not enable_central_database %} - depends_on: - - database - -{% include 'templates/docker-mariadb-service.yml.j2' %} -{% endif %} - volumes: redis: -{% if not enable_central_database %} - database: -{% endif %} \ No newline at end of file +{% include 'templates/docker-database-volume.yml.j2' %} + +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-attendize/vars/main.yml b/roles/docker-attendize/vars/main.yml index c1fe3e17..3868f140 100644 --- a/roles/docker-attendize/vars/main.yml +++ b/roles/docker-attendize/vars/main.yml @@ -1,11 +1,8 @@ --- docker_compose_project_name: "attendize" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml" docker_compose_backup_path: "/tmp/{{docker_compose_project_name}}-docker-compose-backup.yml" mail_interface_domain: "mail.{{domain}}" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" +database_type: "mariadb" database_password: "{{attendize_database_password}}" repository_address: "https://github.com/Attendize/Attendize.git" \ No newline at end of file diff --git a/roles/docker-baserow/tasks/main.yml b/roles/docker-baserow/tasks/main.yml index 104a5024..014b690d 100644 --- a/roles/docker-baserow/tasks/main.yml +++ b/roles/docker-baserow/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 index a3a0243d..b36e0e63 100644 --- a/roles/docker-baserow/templates/docker-compose.yml.j2 +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -12,5 +12,16 @@ services: - data:/baserow/data ports: - "{{http_port}}:80" +{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + +{% include 'templates/docker-redis-service.yml.j2' %} + +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} + volumes: - data: \ No newline at end of file + data: + redis: +{% include 'templates/docker-database-volume.yml.j2' %} + +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-baserow/templates/env.j2 b/roles/docker-baserow/templates/env.j2 index db4b80c4..5a756e2b 100644 --- a/roles/docker-baserow/templates/env.j2 +++ b/roles/docker-baserow/templates/env.j2 @@ -8,3 +8,13 @@ EMAIL_SMTP_PORT={{ system_email_smtp_port }} EMAIL_SMTP_USER={{ system_email_username }} EMAIL_SMTP_PASSWORD={{ system_email_password }} EMAIL_SMTP_USE_TLS={{ system_email_tls | upper }} + +DATABASE_USER={{ database_username }} +DATABASE_NAME={{ database_databasename }} +DATABASE_HOST={{ database_host }} +DATABASE_PORT=5432 +DATABASE_PASSWORD={{ database_password }} + +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_PASSWORD= diff --git a/roles/docker-baserow/vars/main.yml b/roles/docker-baserow/vars/main.yml index 67efb239..f15802ea 100644 --- a/roles/docker-baserow/vars/main.yml +++ b/roles/docker-baserow/vars/main.yml @@ -1,2 +1,4 @@ docker_compose_project_name: "baserow" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" \ No newline at end of file +database_password: "{{ baserow_database_password }}" +database_version: "{{ baserow_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-bigbluebutton/vars/main.yml b/roles/docker-bigbluebutton/vars/main.yml index 03befecd..e0e5b6db 100644 --- a/roles/docker-bigbluebutton/vars/main.yml +++ b/roles/docker-bigbluebutton/vars/main.yml @@ -1,6 +1,6 @@ -docker_compose_project_name: "bigbluebutton" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "postgres" -database_databasename: "greenlight-v3" -database_username: "postgres" -database_password: "" \ No newline at end of file +docker_compose_project_name: "bigbluebutton" +docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" +database_host: "postgres" +database_databasename: "greenlight-v3" +database_username: "postgres" +database_password: "" \ No newline at end of file diff --git a/roles/docker-discourse/tasks/main.yml b/roles/docker-discourse/tasks/main.yml index 9e7b8642..ba8ad2c7 100644 --- a/roles/docker-discourse/tasks/main.yml +++ b/roles/docker-discourse/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml loop: "{{ domains }}" diff --git a/roles/docker-discourse/templates/app.yml.j2 b/roles/docker-discourse/templates/app.yml.j2 index 659b865d..fe222609 100644 --- a/roles/docker-discourse/templates/app.yml.j2 +++ b/roles/docker-discourse/templates/app.yml.j2 @@ -63,13 +63,21 @@ env: ## TODO: The SMTP mail server used to validate new accounts and send notifications # SMTP ADDRESS, username, and password are required # WARNING the char '#' in SMTP password can cause problems! - DISCOURSE_SMTP_ADDRESS: {{system_email_host}} - DISCOURSE_SMTP_PORT: {{system_email_smtp_port}} - DISCOURSE_SMTP_USER_NAME: {{system_email}} - DISCOURSE_SMTP_PASSWORD: {{system_email_password}} + DISCOURSE_SMTP_ADDRESS: {{ system_email_host }} + DISCOURSE_SMTP_PORT: {{ system_email_smtp_port }} + DISCOURSE_SMTP_USER_NAME: {{ system_email }} + DISCOURSE_SMTP_PASSWORD: {{ system_email_password }} DISCOURSE_SMTP_ENABLE_START_TLS: {{ system_email_start_tls | upper }} - DISCOURSE_SMTP_DOMAIN: {{system_email_domain}} - DISCOURSE_NOTIFICATION_EMAIL: {{system_email}} + DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }} + DISCOURSE_NOTIFICATION_EMAIL: {{ system_email }} + +{% if enable_central_database %} + # Database Configuration + DISCOURSE_DB_USERNAME: {{ database_username }} + DISCOURSE_DB_PASSWORD: {{ database_password }} + DISCOURSE_DB_HOST: {{ database_host }} + DISCOURSE_DB_NAME: {{ database_databasename }} +{% if enable_central_database %} ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate #LETSENCRYPT_ACCOUNT_EMAIL: administrator@veen.world @@ -85,7 +93,7 @@ env: ## The Docker container is stateless; all data is stored in /shared volumes: - volume: - host: discourse_application_data + host: discourse_data guest: /shared - volume: host: /var/discourse/shared/standalone/log/var-log diff --git a/roles/docker-discourse/vars/main.yml b/roles/docker-discourse/vars/main.yml index 024b3cfb..c6d5e00d 100644 --- a/roles/docker-discourse/vars/main.yml +++ b/roles/docker-discourse/vars/main.yml @@ -1 +1,4 @@ -docker_compose_instance_directory: "{{path_docker_compose_instances}}discourse/" +docker_compose_project_name: "attendize" +database_password: "{{ baserow_database_password }}" +database_version: "{{ baserow_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-elk/templates/docker-compose.yml.j2 b/roles/docker-elk/templates/docker-compose.yml.j2 index 2abb0ef5..81c50ce3 100644 --- a/roles/docker-elk/templates/docker-compose.yml.j2 +++ b/roles/docker-elk/templates/docker-compose.yml.j2 @@ -23,8 +23,6 @@ services: # Use single node discovery in order to disable production mode and avoid bootstrap checks. # see: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html discovery.type: single-node - networks: - - elk logstash: build: @@ -47,8 +45,6 @@ services: - "9600:9600" environment: LS_JAVA_OPTS: "-Xmx256m -Xms256m" - networks: - - elk depends_on: - elasticsearch @@ -64,14 +60,8 @@ services: read_only: true ports: - "127.0.0.1:{{ http_port }}:5601" - networks: - - elk depends_on: - elasticsearch -networks: - elk: - driver: bridge - volumes: elasticsearch: diff --git a/roles/docker-funkwhale/tasks/main.yml b/roles/docker-funkwhale/tasks/main.yml index ec7197ea..59923d32 100644 --- a/roles/docker-funkwhale/tasks/main.yml +++ b/roles/docker-funkwhale/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: Create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index 1cf97f1d..e114e40f 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -10,9 +10,7 @@ services: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% if not enable_central_database %} - - postgres -% endif %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} - redis env_file: .env command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0} @@ -20,23 +18,24 @@ services: - C_FORCE_ROOT=true volumes: - "data:${MEDIA_ROOT}" +{% include 'templates/docker-networks-for-container.yml.j2' %} + celerybeat: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% if not enable_central_database %} - - postgres -% endif %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} - redis env_file: .env command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO +{% include 'templates/docker-networks-for-container.yml.j2' %} api: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: - - postgres +{% include 'templates/docker-depends-on-central-database.yml.j2' %} - redis env_file: .env volumes: @@ -44,6 +43,7 @@ services: #- "${STATIC_ROOT}:${STATIC_ROOT}" ports: - "5000" +{% include 'templates/docker-networks-for-container.yml.j2' %} front: restart: always @@ -61,15 +61,13 @@ services: ports: # override those variables in your .env file if needed - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" +{% include 'templates/docker-networks-for-container.yml.j2' %} -{% if not enable_central_database %} -{% include 'templates/docker-postgres-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} volumes: data: redis: +{% include 'templates/docker-database-volume.yml.j2' %} -{% if not enable_central_database %} - database: -{% endif %} \ No newline at end of file +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-funkwhale/vars/main.yml b/roles/docker-funkwhale/vars/main.yml index 407b9deb..93b11fb6 100644 --- a/roles/docker-funkwhale/vars/main.yml +++ b/roles/docker-funkwhale/vars/main.yml @@ -1,7 +1,5 @@ docker_compose_project_name: "funkwhale" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" database_password: "{{funkwhale_database_password}}" database_version: "{{ funkwhale_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-gitea/tasks/main.yml b/roles/docker-gitea/tasks/main.yml index a2efdf59..24849a0a 100644 --- a/roles/docker-gitea/tasks/main.yml +++ b/roles/docker-gitea/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index 2150cab0..cfda365e 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -27,18 +27,11 @@ services: - data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro -{% if not enable_central_database %} - depends_on: - - database -{% include 'templates/docker-mariadb-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} volumes: data: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} -networks: - default: - driver: bridge \ No newline at end of file +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-gitea/vars/main.yml b/roles/docker-gitea/vars/main.yml index badb90ea..2e7014fc 100644 --- a/roles/docker-gitea/vars/main.yml +++ b/roles/docker-gitea/vars/main.yml @@ -1,6 +1,3 @@ docker_compose_project_name: "gitea" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" -database_password: "{{gitea_database_password}}" \ No newline at end of file +database_password: "{{gitea_database_password}}" +database_type: "mariadb" \ No newline at end of file diff --git a/roles/docker-gitlab/tasks/main.yml b/roles/docker-gitlab/tasks/main.yml index 806daaec..24849a0a 100644 --- a/roles/docker-gitlab/tasks/main.yml +++ b/roles/docker-gitlab/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central Postgres - include_role: - name: docker-postgres - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index 33a85cd9..9997658e 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -41,15 +41,11 @@ services: {% include 'templates/docker-redis-service.yml.j2' %} -{% if not enable_central_database %} -{% include 'templates/docker-postgres-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} volumes: redis: config: logs: data: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} diff --git a/roles/docker-gitlab/vars/main.yml b/roles/docker-gitlab/vars/main.yml index 7bc995da..ef475572 100644 --- a/roles/docker-gitlab/vars/main.yml +++ b/roles/docker-gitlab/vars/main.yml @@ -1,7 +1,4 @@ docker_compose_project_name: "gitlab" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" database_password: "{{gitlab_database_password}}" -database_version: "{{ gitlab_database_version | default(postgres_default_version) }}" \ No newline at end of file +database_version: "{{ gitlab_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-joomla/tasks/main.yml b/roles/docker-joomla/tasks/main.yml index d9bad86f..82221967 100644 --- a/roles/docker-joomla/tasks/main.yml +++ b/roles/docker-joomla/tasks/main.yml @@ -1,15 +1,18 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml loop: "{{ domains }}" loop_control: loop_var: domain -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index 9a9c8594..5c53ad74 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -11,21 +11,20 @@ services: JOOMLA_DB_PASSWORD: "{{database_password}}" JOOMLA_DB_NAME: "{{database_databasename}}" restart: always -{% if not enable_central_database %} - depends_on: - - database -{% endif %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} volumes: - data:/var/www/html ports: - "127.0.0.1:{{http_port}}:80" +{% include 'templates/docker-networks-for-container.yml.j2' %} +{% if enable_central_database %} + depends_on: + database: -{% if not enable_central_database %} -{% include 'templates/docker-mariadb-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} volumes: data: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} + +{% include 'templates/docker-networks-for-role.yml.j2' %} diff --git a/roles/docker-joomla/vars/main.yml b/roles/docker-joomla/vars/main.yml index 13740a01..3b0f416e 100644 --- a/roles/docker-joomla/vars/main.yml +++ b/roles/docker-joomla/vars/main.yml @@ -1,6 +1,3 @@ docker_compose_project_name: "joomla" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" -database_password: "{{joomla_database_password}}" \ No newline at end of file +database_password: "{{joomla_database_password}}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-listmonk/tasks/main.yml b/roles/docker-listmonk/tasks/main.yml index 80e3da76..e1321ee8 100644 --- a/roles/docker-listmonk/tasks/main.yml +++ b/roles/docker-listmonk/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central Postgres - include_role: - name: docker-postgres - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index e0a99a89..d10a9700 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -11,13 +11,9 @@ services: - TZ=Etc/UTC volumes: - ./config.toml:/listmonk/config.toml +{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} -{% if not enable_central_database %} - depends_on: - - database +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -{% include 'templates/docker-postgres-service.yml.j2' %} - -volumes: - database: -{% endif %} \ No newline at end of file +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-listmonk/vars/main.yml b/roles/docker-listmonk/vars/main.yml index 233838c7..d2346765 100644 --- a/roles/docker-listmonk/vars/main.yml +++ b/roles/docker-listmonk/vars/main.yml @@ -1,7 +1,4 @@ docker_compose_project_name: "listmonk" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" database_password: "{{listmonk_database_password}}" -database_version: "{{ listmonk_database_version | default(postgres_default_version) }}" \ No newline at end of file +database_version: "{{ listmonk_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index a0bbec80..5c946e5d 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml vars: @@ -28,11 +36,6 @@ state: directory mode: 0755 -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: add docker-compose.yml template: src: "docker-compose.yml.j2" diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index ce4fded8..2a186997 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -3,19 +3,8 @@ version: '2.2' services: {% include 'templates/docker-redis-service.yml.j2' %} - env_file: mailu.env - depends_on: - - resolver - dns: - - 192.168.203.254 - depends_on: - - resolver - dns: - - 192.168.203.254 - networks: - - default - - webmail - - radicale + +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} # Core services resolver: @@ -25,6 +14,10 @@ services: networks: default: ipv4_address: 192.168.203.254 + {{docker_compose_project_name}}_network: +{% if enable_central_database %} + central_{{ database_type }}_network: +{% endif %} logging: driver: journald @@ -53,10 +46,10 @@ services: database: condition: service_healthy {% endif %} - networks: - - default - - webmail - - radicale +{% include 'templates/docker-networks-for-container.yml.j2' %} + default: + webmail: + radicale: dns: - 192.168.203.254 @@ -68,16 +61,16 @@ services: - "admin_data:/data" - "dkim:/dkim" depends_on: - - resolver - - front - - redis -{% if not enable_central_database %} - - database -{% endif %} + resolver: + front: + redis: +{% include 'templates/docker-depends-on-central-database.yml.j2' %} logging: driver: journald dns: - 192.168.203.254 +{% include 'templates/docker-networks-for-container.yml.j2' %} + imap: image: ghcr.io/mailu/dovecot:{{version_mailu}} restart: always @@ -92,6 +85,7 @@ services: - 192.168.203.254 logging: driver: journald +{% include 'templates/docker-networks-for-container.yml.j2' %} smtp: image: ghcr.io/mailu/postfix:{{version_mailu}} @@ -107,6 +101,7 @@ services: - 192.168.203.254 logging: driver: journald +{% include 'templates/docker-networks-for-container.yml.j2' %} oletools: image: ghcr.io/mailu/oletools:{{version_mailu}} @@ -116,8 +111,8 @@ services: - resolver dns: - 192.168.203.254 - networks: - - noinet +{% include 'templates/docker-networks-for-container.yml.j2' %} + noinet: antispam: image: ghcr.io/mailu/rspamd:{{version_mailu}} @@ -134,11 +129,12 @@ services: - resolver dns: - 192.168.203.254 - networks: - - default - - noinet logging: driver: journald +{% include 'templates/docker-networks-for-container.yml.j2' %} + default: + noinet: + # Optional services antivirus: @@ -153,6 +149,7 @@ services: - 192.168.203.254 logging: driver: journald +{% include 'templates/docker-networks-for-container.yml.j2' %} webdav: image: ghcr.io/mailu/radicale:{{version_mailu}} @@ -168,6 +165,7 @@ services: - resolver dns: - 192.168.203.254 +{% include 'templates/docker-networks-for-container.yml.j2' %} fetchmail: image: ghcr.io/mailu/fetchmail:{{version_mailu}} @@ -184,6 +182,7 @@ services: - resolver dns: - 192.168.203.254 +{% include 'templates/docker-networks-for-container.yml.j2' %} webmail: image: ghcr.io/mailu/webmail:{{version_mailu}} @@ -198,18 +197,13 @@ services: - resolver logging: driver: journald - networks: - - webmail dns: - 192.168.203.254 -{% if not enable_central_database %} -{% include 'templates/docker-postgres-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-networks-for-container.yml.j2' %} + webmail: volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} smtp_queue: admin_data: webdav_data: @@ -218,7 +212,8 @@ volumes: dkim: dovecot_mail: redis: -networks: + +{% include 'templates/docker-networks-for-role.yml.j2' %} default: driver: bridge ipam: diff --git a/roles/docker-mariadb/tasks/main.yml b/roles/docker-mariadb/tasks/main.yml index db699b76..b7deeb7c 100644 --- a/roles/docker-mariadb/tasks/main.yml +++ b/roles/docker-mariadb/tasks/main.yml @@ -1,19 +1,21 @@ - name: Create Docker network for MariaDB docker_network: - name: mariadb_network + name: central_mariadb_network state: present when: run_once_docker_mariadb is not defined - name: install MariaDB docker_container: - name: mariadb + name: central-mariadb image: mariadb:latest #could lead to problems with nextcloud detach: yes env: MARIADB_ROOT_PASSWORD: "{{central_mariadb_root_password}}" MARIADB_AUTO_UPGRADE: "1" networks: - - name: mariadb_network + - name: central_mariadb_network + volumes: + - database:/var/lib/mysql published_ports: - "127.0.0.1:3306:3306" command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud diff --git a/roles/docker-mastodon/tasks/main.yml b/roles/docker-mastodon/tasks/main.yml index 988ff131..91fe0f8d 100644 --- a/roles/docker-mastodon/tasks/main.yml +++ b/roles/docker-mastodon/tasks/main.yml @@ -1,15 +1,18 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include create-domains.yml" include_tasks: create-domains.yml loop: "{{ domains }}" loop_control: loop_var: domain -- name: create database in central Postgres - include_role: - name: docker-postgres - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-mastodon/templates/.env.production.j2 b/roles/docker-mastodon/templates/.env.production.j2 index aedacfed..7a772a03 100644 --- a/roles/docker-mastodon/templates/.env.production.j2 +++ b/roles/docker-mastodon/templates/.env.production.j2 @@ -10,9 +10,11 @@ DB_PORT=5432 DB_NAME={{database_databasename}} DB_USER={{database_username}} DB_PASS={{database_password}} + REDIS_HOST=redis REDIS_PORT=6379 REDIS_PASSWORD= + SMTP_SERVER={{system_email_host}} SMTP_PORT={{system_email_smtp_port}} SMTP_LOGIN={{system_email_username}} diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index d3cf97de..c5fb0b02 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -3,81 +3,63 @@ services: {% include 'templates/docker-redis-service.yml.j2' %} - networks: - - internal_network +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} web: image: tootsuite/mastodon:{{version_mastodon}} restart: always env_file: .env.production command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" - networks: - - external_network - - internal_network healthcheck: - # prettier-ignore test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] ports: - "127.0.0.1:{{http_port}}:3000" depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - redis +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + redis: + condition: service_healthy volumes: - data:/mastodon/public/system logging: driver: journald +{% include 'templates/docker-networks-for-container.yml.j2' %} + streaming: image: tootsuite/mastodon:{{version_mastodon}} restart: always env_file: .env.production command: node ./streaming - networks: - - external_network - - internal_network healthcheck: - # prettier-ignore test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] ports: - "127.0.0.1:{{stream_port}}:4000" - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - redis +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + redis: + condition: service_healthy logging: driver: journald +{% include 'templates/docker-networks-for-container.yml.j2' %} + sidekiq: image: tootsuite/mastodon:{{version_mastodon}} restart: always env_file: .env.production command: bundle exec sidekiq depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - redis - networks: - - external_network - - internal_network +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + redis: + condition: service_healthy volumes: - data:/mastodon/public/system healthcheck: test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] logging: driver: journald -{% if not enable_central_database %} -{% include 'templates/docker-postgres-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-networks-for-container.yml.j2' %} volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} redis: data: -networks: - external_network: - internal_network: - internal: true \ No newline at end of file + +{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mastodon/vars/main.yml b/roles/docker-mastodon/vars/main.yml index 9b10f8be..c1109043 100644 --- a/roles/docker-mastodon/vars/main.yml +++ b/roles/docker-mastodon/vars/main.yml @@ -1,7 +1,4 @@ docker_compose_project_name: "mastodon" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" database_password: "{{mastodon_database_password}}" -database_version: "{{ mastodon_database_version | default(postgres_default_version) }}" \ No newline at end of file +database_version: "{{ mastodon_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-matomo/tasks/main.yml b/roles/docker-matomo/tasks/main.yml index eb7b25ed..c3181163 100644 --- a/roles/docker-matomo/tasks/main.yml +++ b/roles/docker-matomo/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index c9749067..877a8214 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -19,14 +19,9 @@ services: {% if not enable_central_database %} depends_on: - database -{% include 'templates/docker-mariadb-service.yml.j2' %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} data: -networks: - default: - driver: bridge diff --git a/roles/docker-matomo/vars/main.yml b/roles/docker-matomo/vars/main.yml index c3ffd341..28fc6e46 100644 --- a/roles/docker-matomo/vars/main.yml +++ b/roles/docker-matomo/vars/main.yml @@ -1,7 +1,4 @@ --- docker_compose_project_name: "matomo" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" +database_type: "mariadb" database_password: "{{matomo_database_password}}" \ No newline at end of file diff --git a/roles/docker-matrix-compose/tasks/main.yml b/roles/docker-matrix-compose/tasks/main.yml index a3e7ed9b..6fd4b598 100644 --- a/roles/docker-matrix-compose/tasks/main.yml +++ b/roles/docker-matrix-compose/tasks/main.yml @@ -1,14 +1,17 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml vars: domain: "{{synapse_domain}}" http_port: "{{synapse_http_port}}" - -- name: create database in central Postgres - include_role: - name: docker-postgres - when: enable_central_database | bool - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 27f12f8a..0eb84e32 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -19,7 +19,7 @@ services: {% if not enable_central_database %} depends_on: - database -{% include 'templates/docker-postgres-service.yml.j2' %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} element: @@ -60,14 +60,9 @@ services: # - instagram_bridge_data:/data volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} synapse_data: #telegram_bridge_data: #whatsapp_bridge_data: #facebook_bridge_data: - #instagram_bridge_data: -networks: - default: - driver: bridge \ No newline at end of file + #instagram_bridge_data: \ No newline at end of file diff --git a/roles/docker-matrix-compose/vars/main.yml b/roles/docker-matrix-compose/vars/main.yml index b2b0a5c4..a12a70a2 100644 --- a/roles/docker-matrix-compose/vars/main.yml +++ b/roles/docker-matrix-compose/vars/main.yml @@ -1,7 +1,5 @@ --- docker_compose_project_name: "matrix" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" -database_password: "{{matrix_database_password}}" \ No newline at end of file +database_password: "{{matrix_database_password}}" +database_version: "{{ baserow_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-mybb/tasks/main.yml b/roles/docker-mybb/tasks/main.yml index 01a73412..7bf9aa24 100644 --- a/roles/docker-mybb/tasks/main.yml +++ b/roles/docker-mybb/tasks/main.yml @@ -1,15 +1,18 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks create-proxy-with-domain-replace.yml" include_tasks: create-proxy-with-domain-replace.yml loop: "{{ domains + [source_domain] }}" loop_control: loop_var: domain -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_confd_directory}} and parent directories" file: path: "{{docker_compose_instance_confd_directory}}" diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index 6a300ebf..54adad97 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -26,15 +26,8 @@ services: - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "data:/var/www/html:ro" -{% if not enable_central_database %} -{% include 'templates/docker-mariadb-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} volumes: -{% if not enable_central_database %} - database: -{% endif %} - data: -networks: - default: - driver: bridge \ No newline at end of file +{% include 'templates/docker-database-volume.yml.j2' %} + data: \ No newline at end of file diff --git a/roles/docker-mybb/vars/main.yml b/roles/docker-mybb/vars/main.yml index 5f33c8a7..6e7c4875 100644 --- a/roles/docker-mybb/vars/main.yml +++ b/roles/docker-mybb/vars/main.yml @@ -1,11 +1,8 @@ --- docker_compose_project_name: "mybb" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" docker_compose_instance_confd_directory: "{{docker_compose_instance_directory}}conf.d/" docker_compose_instance_confd_defaultconf_file: "{{docker_compose_instance_confd_directory}}default.conf" target_mount_conf_d_directory: "{{nginx_servers_directory}}" source_domain: "mybb.{{top_domain}}" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" -database_password: "{{mybb_database_password}}" \ No newline at end of file +database_password: "{{mybb_database_password}}" +database_type: "mariadb" \ No newline at end of file diff --git a/roles/docker-nextcloud/tasks/main.yml b/roles/docker-nextcloud/tasks/main.yml index 18964e5b..eca8f058 100644 --- a/roles/docker-nextcloud/tasks/main.yml +++ b/roles/docker-nextcloud/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include task certbot-matomo.yml" include_tasks: certbot-matomo.yml @@ -20,11 +28,6 @@ dest: "{{path_docker_volumes}}nextcloud/nginx.conf" notify: docker compose project setup -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index 112c762c..e31f3bfe 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -17,7 +17,7 @@ services: depends_on: - database -{% include 'templates/docker-mariadb-service.yml.j2' %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} web: @@ -44,17 +44,9 @@ services: volumes: - data:/var/www/html entrypoint: /cron.sh - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - redis +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + redis: volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} data: redis: -networks: - default: - driver: bridge diff --git a/roles/docker-nextcloud/vars/main.yml b/roles/docker-nextcloud/vars/main.yml index adf44477..d050d4b6 100644 --- a/roles/docker-nextcloud/vars/main.yml +++ b/roles/docker-nextcloud/vars/main.yml @@ -1,7 +1,4 @@ --- docker_compose_project_name: "nextcloud" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" -database_password: "{{nextcloud_database_password}}" \ No newline at end of file +database_password: "{{nextcloud_database_password}}" +database_type: "mariadb" \ No newline at end of file diff --git a/roles/docker-openproject/tasks/main.yml b/roles/docker-openproject/tasks/main.yml index 59716155..486446de 100644 --- a/roles/docker-openproject/tasks/main.yml +++ b/roles/docker-openproject/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central Postgres - include_role: - name: docker-postgres - when: enable_central_database | bool - - name: "include tasks update-repository-with-docker-compose.yml" include_tasks: update-repository-with-docker-compose.yml diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 0b38061e..8c2fab30 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -5,9 +5,7 @@ networks: backend: volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} data: x-op-restart-policy: &restart_policy @@ -36,9 +34,7 @@ x-op-app: &app services: -{% if not enable_central_database %} -{% include 'templates/docker-postgres-service.yml.j2' %} -{% endif %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} networks: - backend @@ -72,12 +68,9 @@ services: networks: - frontend - backend - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - cache - - seeder +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + cache: + seeder: labels: - autoheal=true healthcheck: @@ -101,24 +94,18 @@ services: command: "./docker/prod/worker" networks: - backend - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - cache - - seeder +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + cache: + seeder: cron: <<: *app command: "./docker/prod/cron" networks: - backend - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - cache - - seeder +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + cache: + seeder: seeder: <<: *app diff --git a/roles/docker-openproject/vars/main.yml b/roles/docker-openproject/vars/main.yml index dd549717..a7bf3353 100644 --- a/roles/docker-openproject/vars/main.yml +++ b/roles/docker-openproject/vars/main.yml @@ -3,8 +3,7 @@ repository_directory: "{{ path_docker_compose_instances }}{{docker docker_compose_instance_directory: "{{repository_directory}}compose/" docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml" docker_compose_backup_path: "/tmp/{{docker_compose_project_name}}-docker-compose-backup.yml" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "postgres" database_password: "{{openproject_database_password}}" -repository_address: "https://github.com/opf/openproject-deploy" \ No newline at end of file +repository_address: "https://github.com/opf/openproject-deploy" +database_version: "{{ openproject_database_version | default(postgres_default_version) }}" +database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-peertube/tasks/main.yml b/roles/docker-peertube/tasks/main.yml index a97df60c..9ec5b724 100644 --- a/roles/docker-peertube/tasks/main.yml +++ b/roles/docker-peertube/tasks/main.yml @@ -1,15 +1,18 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include create-domains.yml" include_tasks: create-domains.yml loop: "{{ domains }}" loop_control: loop_var: domain -- name: create database in central Postgres - include_role: - name: docker-postgres - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index 35a22df7..1c1fcb4c 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -18,7 +18,7 @@ services: {% if not enable_central_database %} - database -{% include 'templates/docker-postgres-service.yml.j2' %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} {% include 'templates/docker-redis-service.yml.j2' %} @@ -27,9 +27,7 @@ services: - .env volumes: assets: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} data: redis: config: \ No newline at end of file diff --git a/roles/docker-peertube/vars/main.yml b/roles/docker-peertube/vars/main.yml index bc8c98d6..8add9bfe 100644 --- a/roles/docker-peertube/vars/main.yml +++ b/roles/docker-peertube/vars/main.yml @@ -1,6 +1,3 @@ docker_compose_project_name: "peertube" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" +database_type: "mariadb" database_password: "{{peertube_database_password}}" \ No newline at end of file diff --git a/roles/docker-pixelfed/tasks/main.yml b/roles/docker-pixelfed/tasks/main.yml index 8eb1ae02..014b690d 100644 --- a/roles/docker-pixelfed/tasks/main.yml +++ b/roles/docker-pixelfed/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index a8f471fa..6bf2e273 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: '2' services: + +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} + +{% include 'templates/docker-redis-service.yml.j2' %} + application: image: zknt/pixelfed restart: always @@ -14,11 +19,8 @@ services: - "./env:/var/www/.env" ports: - "{{http_port}}:80" - depends_on: -{% if not enable_central_database %} - - database -{% endif %} - - redis +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + redis: worker: image: zknt/pixelfed restart: always @@ -36,22 +38,12 @@ services: interval: 60s timeout: 5s retries: 1 - depends_on: - - redis - - application -{% if not enable_central_database %} - - - database - -{% include 'templates/docker-mariadb-service.yml.j2' %} -{% endif %} - -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-depends-on-central-database.yml.j2' %} + redis: + application: volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} redis: application_data: bootstrap: \ No newline at end of file diff --git a/roles/docker-pixelfed/vars/main.yml b/roles/docker-pixelfed/vars/main.yml index 09caeed8..0409d38c 100644 --- a/roles/docker-pixelfed/vars/main.yml +++ b/roles/docker-pixelfed/vars/main.yml @@ -1,7 +1,4 @@ docker_compose_project_name: "pixelfed" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" +database_type: "mariadb" database_password: "{{pixelfed_database_password}}" diff --git a/roles/docker-postgres/tasks/main.yml b/roles/docker-postgres/tasks/main.yml index f8771b43..624dda86 100644 --- a/roles/docker-postgres/tasks/main.yml +++ b/roles/docker-postgres/tasks/main.yml @@ -1,6 +1,6 @@ - name: Create Docker network for PostgreSQL docker_network: - name: postgres_network + name: central_postgres_network state: present when: run_once_docker_postgres is not defined @@ -13,7 +13,7 @@ POSTGRES_PASSWORD: "{{ central_postgres_password }}" POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" # Necessary for docker-matrix networks: - - name: postgres_network + - name: central_postgres_network published_ports: - "127.0.0.1:5432:5432" when: run_once_docker_postgres is not defined diff --git a/roles/docker-wordpress/tasks/main.yml b/roles/docker-wordpress/tasks/main.yml index 3feb730c..81ded561 100644 --- a/roles/docker-wordpress/tasks/main.yml +++ b/roles/docker-wordpress/tasks/main.yml @@ -1,4 +1,11 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml @@ -8,11 +15,6 @@ vars: nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size {{wordpress_max_upload_size}};" -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index 73f80ea4..ca00691d 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -21,14 +21,9 @@ services: depends_on: - database -{% include 'templates/docker-mariadb-service.yml.j2' %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} volumes: -{% if not enable_central_database %} - database: -{% endif %} +{% include 'templates/docker-database-volume.yml.j2' %} data: -networks: - default: - driver: bridge diff --git a/roles/docker-wordpress/vars/main.yml b/roles/docker-wordpress/vars/main.yml index 96b4ff0e..d6efe84f 100644 --- a/roles/docker-wordpress/vars/main.yml +++ b/roles/docker-wordpress/vars/main.yml @@ -1,7 +1,4 @@ docker_compose_project_name: "wordpress" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" wordpress_max_upload_size: "64M" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" +database_type: "mariadb" database_password: "{{wordpress_database_password}}" \ No newline at end of file diff --git a/roles/docker-yourls/tasks/main.yml b/roles/docker-yourls/tasks/main.yml index eb7b25ed..c3181163 100644 --- a/roles/docker-yourls/tasks/main.yml +++ b/roles/docker-yourls/tasks/main.yml @@ -1,12 +1,15 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: create database in central MariaDB - include_role: - name: docker-mariadb - when: enable_central_database | bool - - name: "create {{docker_compose_instance_directory}}" file: path: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index 9c271134..53acf9fd 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -20,11 +20,8 @@ services: depends_on: - database -{% include 'templates/docker-mariadb-service.yml.j2' %} +{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} volumes: database: {% endif %} -networks: - default: - driver: bridge diff --git a/roles/docker-yourls/vars/main.yml b/roles/docker-yourls/vars/main.yml index 29f0fee5..d9d168b3 100644 --- a/roles/docker-yourls/vars/main.yml +++ b/roles/docker-yourls/vars/main.yml @@ -1,6 +1,3 @@ docker_compose_project_name: "yourls" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" +database_type: "mariadb" database_password: "{{yourls_database_password}}" \ No newline at end of file diff --git a/templates/docker-database-volume.yml.j2 b/templates/docker-database-volume.yml.j2 new file mode 100644 index 00000000..22b28050 --- /dev/null +++ b/templates/docker-database-volume.yml.j2 @@ -0,0 +1,3 @@ +{% if not enable_central_database %} + database: +{% endif %} \ No newline at end of file diff --git a/templates/docker-depends-on-central-database.yml.j2 b/templates/docker-depends-on-central-database.yml.j2 new file mode 100644 index 00000000..d1b446a8 --- /dev/null +++ b/templates/docker-depends-on-central-database.yml.j2 @@ -0,0 +1,5 @@ +{% if enable_central_database %} + depends_on: + database: + condition: service_healthy +{% endif %} \ No newline at end of file diff --git a/templates/docker-mariadb-service.yml.j2 b/templates/docker-mariadb-service.yml.j2 index 16b1f8c2..5c4fb462 100644 --- a/templates/docker-mariadb-service.yml.j2 +++ b/templates/docker-mariadb-service.yml.j2 @@ -1,3 +1,4 @@ +{% if not enable_central_database %} database: logging: driver: journald @@ -16,4 +17,7 @@ test: "/usr/bin/mariadb --user={{database_username}} --password={{database_password}} --execute \"SHOW DATABASES;\"" interval: 3s timeout: 1s - retries: 5 \ No newline at end of file + retries: 5 + networks: + - {{docker_compose_project_name}}_network +{% endif %} \ No newline at end of file diff --git a/templates/docker-network-for-container-add.yml.j2 b/templates/docker-network-for-container-add.yml.j2 new file mode 100644 index 00000000..e69de29b diff --git a/templates/docker-networks-for-container.yml.j2 b/templates/docker-networks-for-container.yml.j2 new file mode 100644 index 00000000..3596e57b --- /dev/null +++ b/templates/docker-networks-for-container.yml.j2 @@ -0,0 +1,5 @@ + networks: + - {{docker_compose_project_name}}_network +{% if enable_central_database %} + - central_{{ database_type }}_network +{% endif %} \ No newline at end of file diff --git a/templates/docker-networks-for-role.yml.j2 b/templates/docker-networks-for-role.yml.j2 new file mode 100644 index 00000000..b2a00705 --- /dev/null +++ b/templates/docker-networks-for-role.yml.j2 @@ -0,0 +1,6 @@ +networks: +{% if enable_central_database %} + central_{{ database_type }}_network: + external: true +{% endif %} + {{docker_compose_project_name}}_network: \ No newline at end of file diff --git a/templates/docker-postgres-service.yml.j2 b/templates/docker-postgres-service.yml.j2 index 049e4d9e..ebc4018b 100644 --- a/templates/docker-postgres-service.yml.j2 +++ b/templates/docker-postgres-service.yml.j2 @@ -1,4 +1,4 @@ - +{% if not enable_central_database %} database: image: postgres:{{database_version}}-alpine environment: @@ -13,6 +13,9 @@ timeout: 5s retries: 6 volumes: - - type: volume + - type: volume source: database target: /var/lib/postgresql/data + networks: + - {{docker_compose_project_name}}_network +{% endif %} \ No newline at end of file diff --git a/templates/docker-redis-service.yml.j2 b/templates/docker-redis-service.yml.j2 index bc5c411c..6d951751 100644 --- a/templates/docker-redis-service.yml.j2 +++ b/templates/docker-redis-service.yml.j2 @@ -9,4 +9,6 @@ test: ["CMD", "redis-cli", "ping"] interval: 1s timeout: 3s - retries: 30 \ No newline at end of file + retries: 30 + networks: + - {{docker_compose_project_name}}_network \ No newline at end of file diff --git a/vars/docker-database-service.yml.j2 b/vars/docker-database-service.yml.j2 new file mode 100644 index 00000000..cd3cb58e --- /dev/null +++ b/vars/docker-database-service.yml.j2 @@ -0,0 +1,4 @@ +docker_compose_instance_directory: "{{ docker_compose_instance_directory | default(path_docker_compose_instances + docker_compose_project_name + '/') }}" +database_host: "{{ database_host | default('database') }}" +database_databasename: "{{ database_databasename | default(docker_compose_project_name) }}" +database_username: "{{ database_username | default(docker_compose_project_name) }}" \ No newline at end of file From c863700dbf565ba6019f8b803afb65710ec62bd6 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 2 Jan 2024 21:39:17 +0100 Subject: [PATCH 04/13] Renamed templates --- .../templates/docker-compose.yml.j2 | 9 +++--- .../templates/docker-compose.yml.j2 | 19 ++++++------- .../templates/docker-compose.yml.j2 | 11 ++++---- .../templates/docker-compose.yml.j2 | 21 +++++++------- .../templates/docker-compose.yml.j2 | 9 +++--- .../templates/docker-compose.yml.j2 | 5 ++-- .../templates/docker-compose.yml.j2 | 9 +++--- .../templates/docker-compose.yml.j2 | 6 ++-- .../templates/docker-compose.yml.j2 | 28 +++++++++---------- .../templates/docker-compose.yml.j2 | 19 ++++++------- .../templates/docker-compose.yml.j2 | 4 +-- .../templates/docker-compose.yml.j2 | 3 +- .../templates/docker-compose.yml.j2 | 3 +- .../templates/docker-compose.yml.j2 | 8 +++--- .../templates/docker-compose.yml.j2 | 9 +++--- .../templates/docker-compose.yml.j2 | 6 ++-- .../templates/docker-compose.yml.j2 | 9 +++--- .../templates/docker-compose.yml.j2 | 3 +- ....yml.j2 => docker-compose-networks.yml.j2} | 0 ...e.yml.j2 => docker-compose-volumes.yml.j2} | 1 + ....j2 => docker-container-depends-on.yml.j2} | 0 ...ml.j2 => docker-container-networks.yml.j2} | 0 .../docker-network-for-container-add.yml.j2 | 0 ...e.yml.j2 => docker-service-mariadb.yml.j2} | 0 ....yml.j2 => docker-service-postgres.yml.j2} | 0 ...ice.yml.j2 => docker-service-redis.yml.j2} | 0 26 files changed, 85 insertions(+), 97 deletions(-) rename templates/{docker-networks-for-role.yml.j2 => docker-compose-networks.yml.j2} (100%) rename templates/{docker-database-volume.yml.j2 => docker-compose-volumes.yml.j2} (86%) rename templates/{docker-depends-on-central-database.yml.j2 => docker-container-depends-on.yml.j2} (100%) rename templates/{docker-networks-for-container.yml.j2 => docker-container-networks.yml.j2} (100%) delete mode 100644 templates/docker-network-for-container-add.yml.j2 rename templates/{docker-mariadb-service.yml.j2 => docker-service-mariadb.yml.j2} (100%) rename templates/{docker-postgres-service.yml.j2 => docker-service-postgres.yml.j2} (100%) rename templates/{docker-redis-service.yml.j2 => docker-service-redis.yml.j2} (100%) diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index 3d2aaafd..eacfde2c 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -17,11 +17,10 @@ services: - env/run.env environment: - AKAUNTING_SETUP -{% include 'templates/docker-networks-for-container.yml.j2' %} -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} data: -{% include 'templates/docker-database-volume.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index 75d8a8f7..f2abd562 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -7,20 +7,20 @@ services: volumes: - .:/usr/share/nginx/html - .:/var/www -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} maildev: redis: worker: env_file: - ./.env -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} worker: image: attendize_worker:latest -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} maildev: redis: -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} volumes: - .:/usr/share/nginx/html - .:/var/www @@ -31,13 +31,12 @@ services: image: maildev/maildev ports: - "{{ mail_interface_http_port }}:1080" -{% include 'templates/docker-networks-for-container.yml.j2' %} -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} redis: -{% include 'templates/docker-database-volume.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 index b36e0e63..f168ac23 100644 --- a/roles/docker-baserow/templates/docker-compose.yml.j2 +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -12,16 +12,15 @@ services: - data:/baserow/data ports: - "{{http_port}}:80" -{% include 'templates/docker-networks-for-container.yml.j2' %} -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: -{% include 'templates/docker-database-volume.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index e114e40f..1190dfdf 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: "3" services: -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} env_file: .env @@ -10,7 +10,7 @@ services: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} - redis env_file: .env command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0} @@ -18,24 +18,24 @@ services: - C_FORCE_ROOT=true volumes: - "data:${MEDIA_ROOT}" -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} celerybeat: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} - redis env_file: .env command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} api: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} - redis env_file: .env volumes: @@ -43,7 +43,7 @@ services: #- "${STATIC_ROOT}:${STATIC_ROOT}" ports: - "5000" -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} front: restart: always @@ -61,13 +61,12 @@ services: ports: # override those variables in your .env file if needed - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: -{% include 'templates/docker-database-volume.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index cfda365e..5d9604fb 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -27,11 +27,10 @@ services: - data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro -{% include 'templates/docker-networks-for-container.yml.j2' %} -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} data: -{% include 'templates/docker-database-volume.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index 9997658e..1b41225a 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -39,13 +39,12 @@ services: {% endif %} redis: -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} redis: config: logs: data: -{% include 'templates/docker-database-volume.yml.j2' %} diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index 5c53ad74..c04eaa9a 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -11,20 +11,19 @@ services: JOOMLA_DB_PASSWORD: "{{database_password}}" JOOMLA_DB_NAME: "{{database_databasename}}" restart: always -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} volumes: - data:/var/www/html ports: - "127.0.0.1:{{http_port}}:80" -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% if enable_central_database %} depends_on: database: {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -volumes: +{% include 'templates/docker-compose-volumes.yml.j2' %} data: -{% include 'templates/docker-database-volume.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index d10a9700..124c1951 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -11,9 +11,9 @@ services: - TZ=Etc/UTC volumes: - ./config.toml:/listmonk/config.toml -{% include 'templates/docker-networks-for-container.yml.j2' %} -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index 2a186997..e40d1bbb 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '2.2' services: -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} @@ -46,7 +46,7 @@ services: database: condition: service_healthy {% endif %} -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} default: webmail: radicale: @@ -64,12 +64,12 @@ services: resolver: front: redis: -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} logging: driver: journald dns: - 192.168.203.254 -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} imap: image: ghcr.io/mailu/dovecot:{{version_mailu}} @@ -85,7 +85,7 @@ services: - 192.168.203.254 logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} smtp: image: ghcr.io/mailu/postfix:{{version_mailu}} @@ -101,7 +101,7 @@ services: - 192.168.203.254 logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} oletools: image: ghcr.io/mailu/oletools:{{version_mailu}} @@ -111,7 +111,7 @@ services: - resolver dns: - 192.168.203.254 -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} noinet: antispam: @@ -131,7 +131,7 @@ services: - 192.168.203.254 logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} default: noinet: @@ -149,7 +149,7 @@ services: - 192.168.203.254 logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} webdav: image: ghcr.io/mailu/radicale:{{version_mailu}} @@ -165,7 +165,7 @@ services: - resolver dns: - 192.168.203.254 -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} fetchmail: image: ghcr.io/mailu/fetchmail:{{version_mailu}} @@ -182,7 +182,7 @@ services: - resolver dns: - 192.168.203.254 -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} webmail: image: ghcr.io/mailu/webmail:{{version_mailu}} @@ -199,11 +199,11 @@ services: driver: journald dns: - 192.168.203.254 -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} webmail: volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} smtp_queue: admin_data: webdav_data: @@ -213,7 +213,7 @@ volumes: dovecot_mail: redis: -{% include 'templates/docker-networks-for-role.yml.j2' %} +{% include 'templates/docker-compose-networks.yml.j2' %} default: driver: bridge ipam: diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index c5fb0b02..ea67bfbd 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -1,7 +1,7 @@ version: '3' services: -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} @@ -15,14 +15,14 @@ services: ports: - "127.0.0.1:{{http_port}}:3000" depends_on: -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} redis: condition: service_healthy volumes: - data:/mastodon/public/system logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} streaming: image: tootsuite/mastodon:{{version_mastodon}} @@ -33,12 +33,12 @@ services: test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] ports: - "127.0.0.1:{{stream_port}}:4000" -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} redis: condition: service_healthy logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} sidekiq: image: tootsuite/mastodon:{{version_mastodon}} @@ -46,7 +46,7 @@ services: env_file: .env.production command: bundle exec sidekiq depends_on: -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} redis: condition: service_healthy volumes: @@ -55,11 +55,10 @@ services: test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] logging: driver: journald -{% include 'templates/docker-networks-for-container.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} redis: data: -{% include 'templates/docker-networks-for-role.yml.j2' %} \ No newline at end of file +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index 877a8214..73fed493 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -22,6 +22,6 @@ services: {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} + +{% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 0eb84e32..41984c1c 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -59,8 +59,7 @@ services: # volumes: # - instagram_bridge_data:/data -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} synapse_data: #telegram_bridge_data: #whatsapp_bridge_data: diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index 54adad97..9eb16858 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -28,6 +28,5 @@ services: {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} data: \ No newline at end of file diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index e31f3bfe..ebd23ae9 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -34,7 +34,7 @@ services: volumes_from: - application -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} cron: image: "nextcloud:{{version_nextcloud}}-fpm-alpine" @@ -44,9 +44,9 @@ services: volumes: - data:/var/www/html entrypoint: /cron.sh -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} redis: -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} + +{% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 8c2fab30..7547f7ad 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -4,8 +4,7 @@ networks: frontend: backend: -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} data: x-op-restart-policy: &restart_policy @@ -68,7 +67,7 @@ services: networks: - frontend - backend -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} cache: seeder: labels: @@ -94,7 +93,7 @@ services: command: "./docker/prod/worker" networks: - backend -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} cache: seeder: @@ -103,7 +102,7 @@ services: command: "./docker/prod/cron" networks: - backend -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} cache: seeder: diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index 1c1fcb4c..4090308d 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -21,13 +21,13 @@ services: {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} env_file: - .env -volumes: + +{% include 'templates/docker-compose-volumes.yml.j2' %} assets: -{% include 'templates/docker-database-volume.yml.j2' %} data: redis: config: \ No newline at end of file diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 6bf2e273..768a2ee4 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -4,7 +4,7 @@ services: {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} -{% include 'templates/docker-redis-service.yml.j2' %} +{% include 'templates/docker-service-redis.yml.j2' %} application: image: zknt/pixelfed @@ -19,7 +19,7 @@ services: - "./env:/var/www/.env" ports: - "{{http_port}}:80" -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} redis: worker: image: zknt/pixelfed @@ -38,12 +38,11 @@ services: interval: 60s timeout: 5s retries: 1 -{% include 'templates/docker-depends-on-central-database.yml.j2' %} +{% include 'templates/docker-container-depends-on.yml.j2' %} redis: application: -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} redis: application_data: bootstrap: \ No newline at end of file diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index ca00691d..46e26ca4 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -24,6 +24,5 @@ services: {% include 'templates/docker-{{ database_type }}-service.yml.j2' %} {% endif %} -volumes: -{% include 'templates/docker-database-volume.yml.j2' %} +{% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/templates/docker-networks-for-role.yml.j2 b/templates/docker-compose-networks.yml.j2 similarity index 100% rename from templates/docker-networks-for-role.yml.j2 rename to templates/docker-compose-networks.yml.j2 diff --git a/templates/docker-database-volume.yml.j2 b/templates/docker-compose-volumes.yml.j2 similarity index 86% rename from templates/docker-database-volume.yml.j2 rename to templates/docker-compose-volumes.yml.j2 index 22b28050..a6055f38 100644 --- a/templates/docker-database-volume.yml.j2 +++ b/templates/docker-compose-volumes.yml.j2 @@ -1,3 +1,4 @@ +volumes: {% if not enable_central_database %} database: {% endif %} \ No newline at end of file diff --git a/templates/docker-depends-on-central-database.yml.j2 b/templates/docker-container-depends-on.yml.j2 similarity index 100% rename from templates/docker-depends-on-central-database.yml.j2 rename to templates/docker-container-depends-on.yml.j2 diff --git a/templates/docker-networks-for-container.yml.j2 b/templates/docker-container-networks.yml.j2 similarity index 100% rename from templates/docker-networks-for-container.yml.j2 rename to templates/docker-container-networks.yml.j2 diff --git a/templates/docker-network-for-container-add.yml.j2 b/templates/docker-network-for-container-add.yml.j2 deleted file mode 100644 index e69de29b..00000000 diff --git a/templates/docker-mariadb-service.yml.j2 b/templates/docker-service-mariadb.yml.j2 similarity index 100% rename from templates/docker-mariadb-service.yml.j2 rename to templates/docker-service-mariadb.yml.j2 diff --git a/templates/docker-postgres-service.yml.j2 b/templates/docker-service-postgres.yml.j2 similarity index 100% rename from templates/docker-postgres-service.yml.j2 rename to templates/docker-service-postgres.yml.j2 diff --git a/templates/docker-redis-service.yml.j2 b/templates/docker-service-redis.yml.j2 similarity index 100% rename from templates/docker-redis-service.yml.j2 rename to templates/docker-service-redis.yml.j2 From 884b9370bb3e20e0ebdea7ac37aeaa2a1339e4ad Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 2 Jan 2024 21:40:48 +0100 Subject: [PATCH 05/13] Adapted variables for template --- roles/docker-akaunting/templates/docker-compose.yml.j2 | 2 +- roles/docker-attendize/templates/docker-compose.yml.j2 | 2 +- roles/docker-baserow/templates/docker-compose.yml.j2 | 2 +- roles/docker-funkwhale/templates/docker-compose.yml.j2 | 2 +- roles/docker-gitlab/templates/docker-compose.yml.j2 | 2 +- roles/docker-joomla/templates/docker-compose.yml.j2 | 2 +- roles/docker-listmonk/templates/docker-compose.yml.j2 | 2 +- roles/docker-mailu/templates/docker-compose.yml.j2 | 2 +- roles/docker-mastodon/templates/docker-compose.yml.j2 | 2 +- roles/docker-matomo/templates/docker-compose.yml.j2 | 2 +- roles/docker-matrix-compose/templates/docker-compose.yml.j2 | 2 +- roles/docker-mybb/templates/docker-compose.yml.j2 | 2 +- roles/docker-nextcloud/templates/docker-compose.yml.j2 | 2 +- roles/docker-openproject/templates/docker-compose.yml.j2 | 2 +- roles/docker-peertube/templates/docker-compose.yml.j2 | 2 +- roles/docker-pixelfed/templates/docker-compose.yml.j2 | 2 +- roles/docker-wordpress/templates/docker-compose.yml.j2 | 2 +- roles/docker-yourls/templates/docker-compose.yml.j2 | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index eacfde2c..fad87f5e 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3.7' services: -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} application: image: docker.io/akaunting/akaunting:{{version_akaunting}} diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index f2abd562..310aa3d9 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -25,7 +25,7 @@ services: - .:/usr/share/nginx/html - .:/var/www -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} maildev: image: maildev/maildev diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 index f168ac23..580b1864 100644 --- a/roles/docker-baserow/templates/docker-compose.yml.j2 +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -17,7 +17,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index 1190dfdf..e29cb1ba 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -63,7 +63,7 @@ services: - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index 1b41225a..f208127f 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -41,7 +41,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index c04eaa9a..4ef8ffcb 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -21,7 +21,7 @@ services: depends_on: database: -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index 124c1951..9b62d378 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -14,6 +14,6 @@ services: {% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-container-depends-on.yml.j2' %} -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index e40d1bbb..1a2caa38 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -4,7 +4,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} # Core services resolver: diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index ea67bfbd..8b714a50 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -3,7 +3,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} web: image: tootsuite/mastodon:{{version_mastodon}} diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index 73fed493..5b48e0f9 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -19,7 +19,7 @@ services: {% if not enable_central_database %} depends_on: - database -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% endif %} diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 41984c1c..55fe6e8a 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -19,7 +19,7 @@ services: {% if not enable_central_database %} depends_on: - database -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% endif %} element: diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index 9eb16858..b8942f35 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -26,7 +26,7 @@ services: - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "data:/var/www/html:ro" -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: \ No newline at end of file diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index ebd23ae9..b8327bab 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -17,7 +17,7 @@ services: depends_on: - database -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% endif %} web: diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 7547f7ad..00db4d24 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -33,7 +33,7 @@ x-op-app: &app services: -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} networks: - backend diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index 4090308d..b505b593 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -18,7 +18,7 @@ services: {% if not enable_central_database %} - database -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% endif %} {% include 'templates/docker-service-redis.yml.j2' %} diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 768a2ee4..50b69427 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '2' services: -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% include 'templates/docker-service-redis.yml.j2' %} diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index 46e26ca4..b05a95e0 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -21,7 +21,7 @@ services: depends_on: - database -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} {% endif %} {% include 'templates/docker-compose-volumes.yml.j2' %} diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index 53acf9fd..90c64662 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -20,7 +20,7 @@ services: depends_on: - database -{% include 'templates/docker-{{ database_type }}-service.yml.j2' %} +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} volumes: database: From 509914fb866209ef6d094282a04a8caff75599d9 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 11:38:09 +0100 Subject: [PATCH 06/13] Finished final raw draft of central database implementation. UNTESTED. --- .../templates/docker-compose.yml.j2 | 2 +- .../templates/docker-compose.yml.j2 | 17 +++--- .../templates/docker-compose.yml.j2 | 11 ++-- .../templates/docker-compose.yml.j2 | 15 +---- .../templates/docker-compose.yml.j2 | 5 +- .../templates/docker-compose.yml.j2 | 17 +++--- .../templates/docker-compose.yml.j2 | 10 ++- .../templates/docker-compose.yml.j2 | 6 +- .../templates/docker-compose.yml.j2 | 17 +----- .../templates/docker-compose.yml.j2 | 14 +---- .../templates/docker-compose.yml.j2 | 13 ++-- .../templates/docker-compose.yml.j2 | 16 ++--- .../templates/docker-compose.yml.j2 | 17 +++--- .../templates/docker-compose.yml.j2 | 24 ++++---- .../templates/docker-compose.yml.j2 | 61 +++++++------------ .../templates/docker-compose.yml.j2 | 23 +++---- .../templates/docker-compose.yml.j2 | 18 +++--- .../templates/docker-compose.yml.j2 | 8 +-- .../templates/docker-compose.yml.j2 | 15 +++-- templates/docker-compose-networks.yml.j2 | 1 + ...ocker-compose-volumes-just-database.yml.j2 | 5 ++ templates/docker-compose-volumes.yml.j2 | 1 + ...-container-depends-on-also-database.yml.j2 | 6 ++ ...container-depends-on-database-redis.yml.j2 | 8 +++ ...container-depends-on-just-database.yml.j2} | 1 + templates/docker-container-networks.yml.j2 | 1 + templates/docker-service-mariadb.yml.j2 | 1 + templates/docker-service-postgres.yml.j2 | 1 + templates/docker-service-redis.yml.j2 | 1 + 29 files changed, 159 insertions(+), 176 deletions(-) create mode 100644 templates/docker-compose-volumes-just-database.yml.j2 create mode 100644 templates/docker-container-depends-on-also-database.yml.j2 create mode 100644 templates/docker-container-depends-on-database-redis.yml.j2 rename templates/{docker-container-depends-on.yml.j2 => docker-container-depends-on-just-database.yml.j2} (51%) diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index fad87f5e..3a4c36db 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -18,7 +18,7 @@ services: environment: - AKAUNTING_SETUP {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index 310aa3d9..c3ad7b47 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -1,5 +1,10 @@ version: '3.2' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + web: image: attendize_web:latest ports: @@ -7,9 +12,8 @@ services: volumes: - .:/usr/share/nginx/html - .:/var/www -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} maildev: - redis: worker: env_file: - ./.env @@ -17,24 +21,19 @@ services: worker: image: attendize_worker:latest -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} maildev: - redis: {% include 'templates/docker-container-networks.yml.j2' %} volumes: - .:/usr/share/nginx/html - .:/var/www -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - maildev: image: maildev/maildev ports: - "{{ mail_interface_http_port }}:1080" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} - -{% include 'templates/docker-service-redis.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 index 580b1864..d96a88a3 100644 --- a/roles/docker-baserow/templates/docker-compose.yml.j2 +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: '2' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + baserow: image: baserow/baserow:1.19.1 restart: always @@ -13,11 +18,7 @@ services: ports: - "{{http_port}}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} - -{% include 'templates/docker-service-redis.yml.j2' %} - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index e29cb1ba..e0996d77 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -4,45 +4,38 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} - env_file: .env - celeryworker: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - - redis env_file: .env command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0} environment: - C_FORCE_ROOT=true volumes: - "data:${MEDIA_ROOT}" +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} celerybeat: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - - redis env_file: .env command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} api: restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - - redis env_file: .env volumes: - "data:${MEDIA_ROOT}" #- "${STATIC_ROOT}:${STATIC_ROOT}" ports: - "5000" +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} front: @@ -63,8 +56,6 @@ services: - "${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - {% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index 5d9604fb..c3259eda 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -28,7 +31,7 @@ services: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index f208127f..83cfac93 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -1,5 +1,10 @@ version: '3.6' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + web: image: 'gitlab/gitlab-ee:latest' restart: always @@ -32,16 +37,10 @@ services: - 'logs:/var/log/gitlab' - 'data:/var/opt/gitlab' shm_size: '256m' - depends_on: -{% if not enable_central_database %} - database: - condition: service_healthy -{% endif %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-redis.yml.j2' %} - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-compose-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index 4ef8ffcb..5c575d55 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: image: joomla logging: @@ -11,17 +14,12 @@ services: JOOMLA_DB_PASSWORD: "{{database_password}}" JOOMLA_DB_NAME: "{{database_databasename}}" restart: always -{% include 'templates/docker-container-depends-on.yml.j2' %} volumes: - data:/var/www/html ports: - "127.0.0.1:{{http_port}}:80" {% include 'templates/docker-container-networks.yml.j2' %} -{% if enable_central_database %} - depends_on: - database: - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index 9b62d378..f8914575 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -2,6 +2,8 @@ version: "3.7" services: +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: restart: unless-stopped image: listmonk/listmonk:latest @@ -12,8 +14,6 @@ services: volumes: - ./config.toml:/listmonk/config.toml {% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-container-depends-on.yml.j2' %} - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index 1a2caa38..102d9acd 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -11,13 +11,9 @@ services: image: ghcr.io/mailu/unbound:{{version_mailu}} env_file: mailu.env restart: always - networks: +{% include 'templates/docker-container-networks.yml.j2' %} default: ipv4_address: 192.168.203.254 - {{docker_compose_project_name}}_network: -{% if enable_central_database %} - central_{{ database_type }}_network: -{% endif %} logging: driver: journald @@ -39,13 +35,9 @@ services: volumes: - "/etc/mailu/overrides/nginx:/overrides:ro" - "/etc/mailu/certs:/certs" - depends_on: +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} resolver: condition: service_started -{% if not enable_central_database %} - database: - condition: service_healthy -{% endif %} {% include 'templates/docker-container-networks.yml.j2' %} default: webmail: @@ -60,11 +52,9 @@ services: volumes: - "admin_data:/data" - "dkim:/dkim" - depends_on: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} resolver: front: - redis: -{% include 'templates/docker-container-depends-on.yml.j2' %} logging: driver: journald dns: @@ -202,7 +192,6 @@ services: {% include 'templates/docker-container-networks.yml.j2' %} webmail: -volumes: {% include 'templates/docker-compose-volumes.yml.j2' %} smtp_queue: admin_data: diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index 8b714a50..a24f0bc8 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -14,10 +14,7 @@ services: test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] ports: - "127.0.0.1:{{http_port}}:3000" - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: - condition: service_healthy +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} volumes: - data:/mastodon/public/system logging: @@ -33,9 +30,7 @@ services: test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] ports: - "127.0.0.1:{{stream_port}}:4000" -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: - condition: service_healthy +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} logging: driver: journald {% include 'templates/docker-container-networks.yml.j2' %} @@ -45,10 +40,7 @@ services: restart: always env_file: .env.production command: bundle exec sidekiq - depends_on: -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: - condition: service_healthy +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} volumes: - data:/mastodon/public/system healthcheck: diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index 5b48e0f9..e2c398e1 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -16,12 +19,10 @@ services: MATOMO_DATABASE_DBNAME: "{{database_databasename}}" volumes: - data:/var/www/html -{% if not enable_central_database %} - depends_on: - - database -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: + +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 55fe6e8a..3708f2b3 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -1,7 +1,9 @@ version: '3.1' services: - + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + synapse: image: matrixdotorg/synapse:latest restart: always @@ -16,11 +18,8 @@ services: - SYNAPSE_REPORT_STATS=no ports: - "127.0.0.1:{{synapse_http_port}}:8008" -{% if not enable_central_database %} - depends_on: - - database -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} element: image: vectorim/element-web:latest @@ -29,6 +28,7 @@ services: - ./element-config.json:/app/config.json ports: - "127.0.0.1:{{element_http_port}}:80" +{% include 'templates/docker-container-networks.yml.j2' %} # bridges #mautrix-telegram: @@ -64,4 +64,6 @@ services: #telegram_bridge_data: #whatsapp_bridge_data: #facebook_bridge_data: - #instagram_bridge_data: \ No newline at end of file + #instagram_bridge_data: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index b8942f35..b228dd1b 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -1,5 +1,8 @@ version: '3.8' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -9,10 +12,9 @@ services: restart: always volumes: - data:/var/www/html -{% if not enable_central_database %} - depends_on: - - database -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} + server: logging: driver: journald @@ -25,8 +27,9 @@ services: volumes: - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "data:/var/www/html:ro" - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} - data: \ No newline at end of file + data: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index b8327bab..cbac24e7 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: '3' services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: image: "nextcloud:{{version_nextcloud}}-fpm-alpine" restart: always @@ -13,12 +18,8 @@ services: MYSQL_USER: "{{database_username}}" MYSQL_PASSWORD: "{{database_password}}" MYSQL_HOST: {{database_host}}:3306 -{% if not enable_central_database %} - depends_on: - - database - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} web: image: nginx:alpine @@ -27,14 +28,11 @@ services: restart: always ports: - "127.0.0.1:{{http_port}}:80" - depends_on: - - application volumes: - "{{path_docker_volumes}}nextcloud/nginx.conf:/etc/nginx/nginx.conf:ro" volumes_from: - application - -{% include 'templates/docker-service-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} cron: image: "nextcloud:{{version_nextcloud}}-fpm-alpine" @@ -44,9 +42,11 @@ services: volumes: - data:/var/www/html entrypoint: /cron.sh -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: redis: + +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 00db4d24..5cd95a59 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -1,18 +1,8 @@ version: "3.7" - -networks: - frontend: - backend: - -{% include 'templates/docker-compose-volumes.yml.j2' %} - data: - -x-op-restart-policy: &restart_policy - restart: unless-stopped -x-op-image: &image - image: openproject/community:${TAG:-13} + x-op-app: &app - <<: [*image, *restart_policy] + restart: unless-stopped + image: openproject/community:${TAG:-13} environment: OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS}" OPENPROJECT_HOST__NAME: "${OPENPROJECT_HOST__NAME}" @@ -27,24 +17,20 @@ x-op-app: &app IMAP_ENABLED: "${IMAP_ENABLED:-false}" volumes: - "data:/var/openproject/assets" -{% if not enable_central_database %} - - "database:/var/openproject/pgdata" -{% endif %} + # - "database:/var/openproject/pgdata" services: {% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - networks: - - backend cache: image: memcached - <<: *restart_policy - networks: - - backend + restart: unless-stopped +{% include 'templates/docker-container-networks.yml.j2' %} proxy: - <<: [*image, *restart_policy] + restart: unless-stopped + image: openproject/community:${TAG:-13} command: "./docker/prod/proxy" ports: - "${PORT}:80" @@ -53,21 +39,16 @@ services: OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}" depends_on: - web - networks: - - frontend +{% include 'templates/docker-container-networks.yml.j2' %} volumes: - "data:/var/openproject/assets" -{% if not enable_central_database %} - - "database:/var/openproject/pgdata" -{% endif %} + # - "database:/var/openproject/pgdata" Should definetly not be necessary here web: <<: *app command: "./docker/prod/web" - networks: - - frontend - - backend -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: seeder: labels: @@ -91,18 +72,16 @@ services: worker: <<: *app command: "./docker/prod/worker" - networks: - - backend -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: seeder: cron: <<: *app command: "./docker/prod/cron" - networks: - - backend -{% include 'templates/docker-container-depends-on.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} +{% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: seeder: @@ -110,5 +89,9 @@ services: <<: *app command: "./docker/prod/seeder" restart: on-failure - networks: - - backend \ No newline at end of file +{% include 'templates/docker-container-networks.yml.j2' %} + +{% include 'templates/docker-compose-networks.yml.j2' %} + +{% include 'templates/docker-compose-volumes.yml.j2' %} + data: \ No newline at end of file diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index b505b593..fcce3a41 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -1,6 +1,11 @@ version: "3.3" services: + +{% include 'templates/docker-service-redis.yml.j2' %} + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: image: chocobozzz/peertube:production-bullseye env_file: @@ -13,21 +18,13 @@ services: - data:/data - config:/config restart: "always" - depends_on: - - redis -{% if not enable_central_database %} - - database - -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} - -{% include 'templates/docker-service-redis.yml.j2' %} - - env_file: - - .env +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} assets: data: redis: - config: \ No newline at end of file + config: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 50b69427..18ed9f77 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -14,13 +14,13 @@ services: env_file: - ./env volumes: - - "application_data:/var/www/storage" + - "data:/var/www/storage" - "bootstrap:/var/www/bootstrap" - "./env:/var/www/.env" ports: - "{{http_port}}:80" -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} worker: image: zknt/pixelfed restart: always @@ -29,7 +29,7 @@ services: env_file: - ./env volumes: - - "application_data:/var/www/storage" + - "data:/var/www/storage" - "bootstrap:/var/www/bootstrap" - "./env:/var/www/.env" entrypoint: /worker-entrypoint.sh @@ -38,11 +38,13 @@ services: interval: 60s timeout: 5s retries: 1 -{% include 'templates/docker-container-depends-on.yml.j2' %} - redis: +{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %} application: +{% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} redis: - application_data: - bootstrap: \ No newline at end of file + data: + bootstrap: + +{% include 'templates/docker-compose-networks.yml.j2' %} \ No newline at end of file diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index b05a95e0..cff1f1b2 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -17,12 +17,10 @@ services: WORDPRESS_DB_NAME: "{{database_databasename}}" volumes: - data:/var/www/html -{% if not enable_central_database %} - depends_on: - - database +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} -{% endif %} +{% include 'templates/docker-compose-networks.yml.j2' %} {% include 'templates/docker-compose-volumes.yml.j2' %} data: diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index 90c64662..0e154c81 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -1,6 +1,9 @@ version: '3' services: + +{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} + application: logging: driver: journald @@ -16,12 +19,8 @@ services: YOURLS_SITE: "https://{{domain}}" YOURLS_USER: "{{yourls_user}}" YOURLS_PASS: "{{yourls_user_password}}" -{% if not enable_central_database %} - depends_on: - - database +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} - -volumes: - database: -{% endif %} +{% include 'templates/docker-compose-volumes-just-database.yml.j2' %} +{% include 'templates/docker-compose-networks.yml.j2' %} diff --git a/templates/docker-compose-networks.yml.j2 b/templates/docker-compose-networks.yml.j2 index b2a00705..adeb34f1 100644 --- a/templates/docker-compose-networks.yml.j2 +++ b/templates/docker-compose-networks.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml networks: {% if enable_central_database %} central_{{ database_type }}_network: diff --git a/templates/docker-compose-volumes-just-database.yml.j2 b/templates/docker-compose-volumes-just-database.yml.j2 new file mode 100644 index 00000000..23aa6977 --- /dev/null +++ b/templates/docker-compose-volumes-just-database.yml.j2 @@ -0,0 +1,5 @@ +# This needs to be included in docker-compose.yml which just contain a database volume +{% if not enable_central_database %} +volumes: + database: +{% endif %} \ No newline at end of file diff --git a/templates/docker-compose-volumes.yml.j2 b/templates/docker-compose-volumes.yml.j2 index a6055f38..4b4c3f3a 100644 --- a/templates/docker-compose-volumes.yml.j2 +++ b/templates/docker-compose-volumes.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml which contain a database and additional volumes volumes: {% if not enable_central_database %} database: diff --git a/templates/docker-container-depends-on-also-database.yml.j2 b/templates/docker-container-depends-on-also-database.yml.j2 new file mode 100644 index 00000000..809268e7 --- /dev/null +++ b/templates/docker-container-depends-on-also-database.yml.j2 @@ -0,0 +1,6 @@ +# This template needs to be included in docker-compose.yml containers which depend on a database and additional containers + depends_on: +{% if enable_central_database %} + database: + condition: service_healthy +{% endif %} \ No newline at end of file diff --git a/templates/docker-container-depends-on-database-redis.yml.j2 b/templates/docker-container-depends-on-database-redis.yml.j2 new file mode 100644 index 00000000..c73f8f77 --- /dev/null +++ b/templates/docker-container-depends-on-database-redis.yml.j2 @@ -0,0 +1,8 @@ +# This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes + depends_on: +{% if enable_central_database %} + database: + condition: service_healthy +{% endif %} + redis: + condition: service_healthy \ No newline at end of file diff --git a/templates/docker-container-depends-on.yml.j2 b/templates/docker-container-depends-on-just-database.yml.j2 similarity index 51% rename from templates/docker-container-depends-on.yml.j2 rename to templates/docker-container-depends-on-just-database.yml.j2 index d1b446a8..0b000dbf 100644 --- a/templates/docker-container-depends-on.yml.j2 +++ b/templates/docker-container-depends-on-just-database.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml contaienrs, which just depend on a database {% if enable_central_database %} depends_on: database: diff --git a/templates/docker-container-networks.yml.j2 b/templates/docker-container-networks.yml.j2 index 3596e57b..d99c2747 100644 --- a/templates/docker-container-networks.yml.j2 +++ b/templates/docker-container-networks.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml containers networks: - {{docker_compose_project_name}}_network {% if enable_central_database %} diff --git a/templates/docker-service-mariadb.yml.j2 b/templates/docker-service-mariadb.yml.j2 index 5c4fb462..9e87dcf3 100644 --- a/templates/docker-service-mariadb.yml.j2 +++ b/templates/docker-service-mariadb.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml, which depend on a mariadb database {% if not enable_central_database %} database: logging: diff --git a/templates/docker-service-postgres.yml.j2 b/templates/docker-service-postgres.yml.j2 index ebc4018b..54acbbb4 100644 --- a/templates/docker-service-postgres.yml.j2 +++ b/templates/docker-service-postgres.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml, which depend on a postgres database {% if not enable_central_database %} database: image: postgres:{{database_version}}-alpine diff --git a/templates/docker-service-redis.yml.j2 b/templates/docker-service-redis.yml.j2 index 6d951751..25aee6b8 100644 --- a/templates/docker-service-redis.yml.j2 +++ b/templates/docker-service-redis.yml.j2 @@ -1,3 +1,4 @@ +# This template needs to be included in docker-compose.yml, which depend on redis redis: image: redis:alpine restart: always From 9c81a48f1700d427740449ca08dfb01ce69044fb Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 12:07:19 +0100 Subject: [PATCH 07/13] Removed buggy variable mapping --- constructor.yml | 11 +---------- roles/backup-docker-to-local/tasks/main.yml | 2 +- roles/backup-remote-to-local/tasks/main.yml | 2 +- roles/cleanup-backups-timer/tasks/main.yml | 2 +- roles/cleanup-disc-space/tasks/main.yml | 2 +- roles/cleanup-failed-docker-backups/tasks/main.yml | 2 +- roles/docker-discourse/templates/app.yml.j2 | 4 ++-- roles/docker-mailu/tasks/main.yml | 2 +- roles/docker-mastodon/templates/mastodon.conf.j2 | 2 +- roles/docker-nextcloud/templates/nextcloud.conf.j2 | 2 +- roles/docker-peertube/templates/peertube.conf.j2 | 2 +- roles/heal-docker/tasks/main.yml | 2 +- roles/health-btrfs/tasks/main.yml | 2 +- roles/health-disc-space/tasks/main.yml | 2 +- roles/health-docker-container/tasks/main.yml | 2 +- roles/health-docker-volumes/tasks/main.yml | 2 +- roles/health-journalctl/tasks/main.yml | 2 +- roles/health-nginx/tasks/main.yml | 2 +- roles/health-nginx/templates/health-nginx.py.j2 | 2 +- roles/nginx-certbot/tasks/main.yml | 2 +- .../templates/domain.conf.j2 | 2 +- roles/nginx-homepage/templates/homepage.nginx.conf.j2 | 2 +- roles/update-docker/tasks/main.yml | 2 +- tasks/implement-matomo-tracking.yml | 2 +- templates/docker-compose-networks.yml.j2 | 2 +- templates/docker-compose-volumes-just-database.yml.j2 | 2 +- templates/docker-compose-volumes.yml.j2 | 2 +- .../docker-container-depends-on-also-database.yml.j2 | 2 +- .../docker-container-depends-on-database-redis.yml.j2 | 2 +- .../docker-container-depends-on-just-database.yml.j2 | 2 +- templates/docker-container-networks.yml.j2 | 2 +- templates/docker-service-mariadb.yml.j2 | 2 +- templates/docker-service-postgres.yml.j2 | 2 +- 33 files changed, 34 insertions(+), 43 deletions(-) diff --git a/constructor.yml b/constructor.yml index 16a61e2d..d0715d3e 100644 --- a/constructor.yml +++ b/constructor.yml @@ -1,20 +1,11 @@ --- -- name: variable mapping - hosts: all - vars: - activate_all_timers: "{{ activate_all_timers | lower | bool }}" - nginx_matomo_tracking: "{{ nginx_matomo_tracking | lower | bool }}" - execute_updates: "{{ execute_updates | lower | bool }}" - force_backup_before_update: "{{ force_backup_before_update | lower | bool }}" - enable_central_database: "{{ enable_central_database | lower | bool }}" - name: update device hosts: all become: true - tasks: roles: - role: update - when: execute_updates + when: execute_updates | bool - name: setup standard wireguard hosts: wireguard_server diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index 3b65ced3..d436835a 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -37,7 +37,7 @@ - name: configure backup-docker-to-local.timer.tpl template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer register: backup_docker_to_local_timer - changed_when: backup_docker_to_local_timer.changed or activate_all_timers + changed_when: backup_docker_to_local_timer.changed or activate_all_timers | bool notify: restart backup-docker-to-local.timer when: run_once_backup_docker_to_local is not defined diff --git a/roles/backup-remote-to-local/tasks/main.yml b/roles/backup-remote-to-local/tasks/main.yml index f43489b6..57c70220 100644 --- a/roles/backup-remote-to-local/tasks/main.yml +++ b/roles/backup-remote-to-local/tasks/main.yml @@ -17,7 +17,7 @@ - name: create backup-remote-to-local.timer template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/backup-remote-to-local.timer register: backup_backup_remote_to_local_timer - changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers + changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers | bool notify: restart backup-remote-to-local timer - name: create backups-remote-to-local.sh diff --git a/roles/cleanup-backups-timer/tasks/main.yml b/roles/cleanup-backups-timer/tasks/main.yml index 5ee7f2bd..f15a4fc1 100644 --- a/roles/cleanup-backups-timer/tasks/main.yml +++ b/roles/cleanup-backups-timer/tasks/main.yml @@ -3,7 +3,7 @@ src: "cleanup-backups.timer.j2" dest: "/etc/systemd/system/cleanup-backups.timer" register: cleanup_backups_timer - changed_when: cleanup_backups_timer.changed or activate_all_timers + changed_when: cleanup_backups_timer.changed or activate_all_timers | bool notify: restart cleanup-backups.timer when: run_once_cleanup_backups_timer is not defined diff --git a/roles/cleanup-disc-space/tasks/main.yml b/roles/cleanup-disc-space/tasks/main.yml index a7ceb6d2..26a66e51 100644 --- a/roles/cleanup-disc-space/tasks/main.yml +++ b/roles/cleanup-disc-space/tasks/main.yml @@ -20,5 +20,5 @@ src: cleanup-disc-space.timer.j2 dest: /etc/systemd/system/cleanup-disc-space.timer register: cleanup_disc_space_timer - changed_when: cleanup_disc_space_timer.changed or activate_all_timers + changed_when: cleanup_disc_space_timer.changed or activate_all_timers | bool notify: restart cleanup-disc-space.timer \ No newline at end of file diff --git a/roles/cleanup-failed-docker-backups/tasks/main.yml b/roles/cleanup-failed-docker-backups/tasks/main.yml index a38df6a4..b36c0f18 100644 --- a/roles/cleanup-failed-docker-backups/tasks/main.yml +++ b/roles/cleanup-failed-docker-backups/tasks/main.yml @@ -24,7 +24,7 @@ src: cleanup-failed-docker-backups.timer.j2 dest: /etc/systemd/system/cleanup-failed-docker-backups.timer register: cleanup_failed_docker_backups_timer - changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers + changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers | bool notify: restart cleanup-failed-docker-backups.timer when: run_once_cleanup_failed_docker_backups is not defined diff --git a/roles/docker-discourse/templates/app.yml.j2 b/roles/docker-discourse/templates/app.yml.j2 index fe222609..b73396ad 100644 --- a/roles/docker-discourse/templates/app.yml.j2 +++ b/roles/docker-discourse/templates/app.yml.j2 @@ -71,13 +71,13 @@ env: DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }} DISCOURSE_NOTIFICATION_EMAIL: {{ system_email }} -{% if enable_central_database %} +{% if enable_central_database | bool %} # Database Configuration DISCOURSE_DB_USERNAME: {{ database_username }} DISCOURSE_DB_PASSWORD: {{ database_password }} DISCOURSE_DB_HOST: {{ database_host }} DISCOURSE_DB_NAME: {{ database_databasename }} -{% if enable_central_database %} +{% if enable_central_database | bool %} ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate #LETSENCRYPT_ACCOUNT_EMAIL: administrator@veen.world diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index 5c946e5d..6da02317 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -64,5 +64,5 @@ src: "deploy-letsencrypt-mailu.timer.j2" dest: "/etc/systemd/system/deploy-letsencrypt-mailu.timer" register: deploy_letsencrypt_mailu_timer - changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers + changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers | bool notify: restart deploy-letsencrypt-mailu.timer \ No newline at end of file diff --git a/roles/docker-mastodon/templates/mastodon.conf.j2 b/roles/docker-mastodon/templates/mastodon.conf.j2 index f20fc840..e983d022 100644 --- a/roles/docker-mastodon/templates/mastodon.conf.j2 +++ b/roles/docker-mastodon/templates/mastodon.conf.j2 @@ -8,7 +8,7 @@ server { {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking %} + {% if nginx_matomo_tracking | bool %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/docker-nextcloud/templates/nextcloud.conf.j2 b/roles/docker-nextcloud/templates/nextcloud.conf.j2 index 6945a385..007fcfe7 100644 --- a/roles/docker-nextcloud/templates/nextcloud.conf.j2 +++ b/roles/docker-nextcloud/templates/nextcloud.conf.j2 @@ -4,7 +4,7 @@ server {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking %} + {% if nginx_matomo_tracking | bool %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/docker-peertube/templates/peertube.conf.j2 b/roles/docker-peertube/templates/peertube.conf.j2 index ec84d8bc..ece8161e 100644 --- a/roles/docker-peertube/templates/peertube.conf.j2 +++ b/roles/docker-peertube/templates/peertube.conf.j2 @@ -3,7 +3,7 @@ server { {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking %} + {% if nginx_matomo_tracking | bool %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/heal-docker/tasks/main.yml b/roles/heal-docker/tasks/main.yml index e306af78..8c4c2c44 100644 --- a/roles/heal-docker/tasks/main.yml +++ b/roles/heal-docker/tasks/main.yml @@ -23,7 +23,7 @@ src: heal-docker.timer.j2 dest: "/etc/systemd/system/heal-docker.timer" register: heal_docker_timer - changed_when: heal_docker_timer.changed or activate_all_timers + changed_when: heal_docker_timer.changed or activate_all_timers | bool notify: restart heal-docker.timer when: run_once_heal_docker is not defined diff --git a/roles/health-btrfs/tasks/main.yml b/roles/health-btrfs/tasks/main.yml index aa05a697..cc7d27fc 100644 --- a/roles/health-btrfs/tasks/main.yml +++ b/roles/health-btrfs/tasks/main.yml @@ -20,5 +20,5 @@ src: health-btrfs.timer.j2 dest: "/etc/systemd/system/health-btrfs.timer" register: health_btrs_timer - changed_when: health_btrs_timer.changed or activate_all_timers + changed_when: health_btrs_timer.changed or activate_all_timers | bool notify: restart health-btrfs.timer diff --git a/roles/health-disc-space/tasks/main.yml b/roles/health-disc-space/tasks/main.yml index eca7f270..e17c0d6f 100644 --- a/roles/health-disc-space/tasks/main.yml +++ b/roles/health-disc-space/tasks/main.yml @@ -20,5 +20,5 @@ src: health-disc-space.timer.j2 dest: /etc/systemd/system/health-disc-space.timer register: health_disc_space_timer - changed_when: health_disc_space_timer.changed or activate_all_timers + changed_when: health_disc_space_timer.changed or activate_all_timers | bool notify: restart health-disc-space.timer diff --git a/roles/health-docker-container/tasks/main.yml b/roles/health-docker-container/tasks/main.yml index 89e3953d..8fc8182a 100644 --- a/roles/health-docker-container/tasks/main.yml +++ b/roles/health-docker-container/tasks/main.yml @@ -21,7 +21,7 @@ src: health-docker-container.timer.j2 dest: "/etc/systemd/system/health-docker-container.timer" register: health_docker_container_timer - changed_when: health_docker_container_timer.changed or activate_all_timers + changed_when: health_docker_container_timer.changed or activate_all_timers | bool notify: restart health-docker-container.timer when: run_once_health_docker_container is not defined diff --git a/roles/health-docker-volumes/tasks/main.yml b/roles/health-docker-volumes/tasks/main.yml index 138fa41d..dfd6838c 100644 --- a/roles/health-docker-volumes/tasks/main.yml +++ b/roles/health-docker-volumes/tasks/main.yml @@ -21,7 +21,7 @@ src: health-docker-volumes.timer.j2 dest: "/etc/systemd/system/health-docker-volumes.timer" register: health_docker_volumes_timer - changed_when: health_docker_volumes_timer.changed or activate_all_timers + changed_when: health_docker_volumes_timer.changed or activate_all_timers | bool notify: restart health-docker-volumes.timer when: run_once_health_docker_volumes is not defined diff --git a/roles/health-journalctl/tasks/main.yml b/roles/health-journalctl/tasks/main.yml index 9c937b58..78aaeb7b 100644 --- a/roles/health-journalctl/tasks/main.yml +++ b/roles/health-journalctl/tasks/main.yml @@ -20,5 +20,5 @@ src: health-journalctl.timer.j2 dest: /etc/systemd/system/health-journalctl.timer register: health_journalctl_timer - changed_when: health_journalctl_timer.changed or activate_all_timers + changed_when: health_journalctl_timer.changed or activate_all_timers | bool notify: restart health-journalctl.timer diff --git a/roles/health-nginx/tasks/main.yml b/roles/health-nginx/tasks/main.yml index 11757eed..7810ef3d 100644 --- a/roles/health-nginx/tasks/main.yml +++ b/roles/health-nginx/tasks/main.yml @@ -29,7 +29,7 @@ src: health-nginx.timer.j2 dest: "/etc/systemd/system/health-nginx.timer" register: health_nginx_timer - changed_when: health_nginx_timer.changed or activate_all_timers + changed_when: health_nginx_timer.changed or activate_all_timers | bool notify: restart health-nginx.timer when: run_once_health_nginx is not defined diff --git a/roles/health-nginx/templates/health-nginx.py.j2 b/roles/health-nginx/templates/health-nginx.py.j2 index 91945a8f..c7f51eaf 100644 --- a/roles/health-nginx/templates/health-nginx.py.j2 +++ b/roles/health-nginx/templates/health-nginx.py.j2 @@ -31,7 +31,7 @@ for filename in os.listdir(config_path): # Determine expected status codes based on the domain if domain == '{{domain_listmonk}}': expected_statuses = [401] -{% if nginx_matomo_tracking %} +{% if nginx_matomo_tracking | bool %} elif parts[0] == 'www' or domain in redirected_domains: expected_statuses = [301] {% endif %} diff --git a/roles/nginx-certbot/tasks/main.yml b/roles/nginx-certbot/tasks/main.yml index 767698b6..29b5e0b9 100644 --- a/roles/nginx-certbot/tasks/main.yml +++ b/roles/nginx-certbot/tasks/main.yml @@ -16,7 +16,7 @@ src: certbot.timer.j2 dest: /etc/systemd/system/certbot.timer register: certbot_timer - changed_when: certbot_timer.changed or activate_all_timers + changed_when: certbot_timer.changed or activate_all_timers | bool notify: restart certbot timer when: run_once_nginx_certbot is not defined diff --git a/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 b/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 index 051c683e..e5dde64e 100644 --- a/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 +++ b/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 @@ -3,7 +3,7 @@ server server_name {{domain}}; # Include Matomo Tracking Code - {% if nginx_matomo_tracking %} + {% if nginx_matomo_tracking | bool %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/nginx-homepage/templates/homepage.nginx.conf.j2 b/roles/nginx-homepage/templates/homepage.nginx.conf.j2 index 4c03694e..19406858 100644 --- a/roles/nginx-homepage/templates/homepage.nginx.conf.j2 +++ b/roles/nginx-homepage/templates/homepage.nginx.conf.j2 @@ -5,7 +5,7 @@ server {% include 'roles/letsencrypt/templates/ssl_header.j2' %} - {% if nginx_matomo_tracking %} + {% if nginx_matomo_tracking | bool %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} diff --git a/roles/update-docker/tasks/main.yml b/roles/update-docker/tasks/main.yml index 4b5bc5ef..c0576bf5 100644 --- a/roles/update-docker/tasks/main.yml +++ b/roles/update-docker/tasks/main.yml @@ -2,7 +2,7 @@ systemd: name: backup-docker-to-local-everything.service state: started - when: force_backup_before_update + when: force_backup_before_update | bool - name: create {{update_docker_script}} copy: diff --git a/tasks/implement-matomo-tracking.yml b/tasks/implement-matomo-tracking.yml index fe4636ac..bbebfd24 100644 --- a/tasks/implement-matomo-tracking.yml +++ b/tasks/implement-matomo-tracking.yml @@ -1,4 +1,4 @@ - name: Activate NGINX matomo tracking include_role: name: nginx-matomo-tracking - when: nginx_matomo_tracking and domain is defined \ No newline at end of file + when: nginx_matomo_tracking | bool and domain is defined \ No newline at end of file diff --git a/templates/docker-compose-networks.yml.j2 b/templates/docker-compose-networks.yml.j2 index adeb34f1..8d760849 100644 --- a/templates/docker-compose-networks.yml.j2 +++ b/templates/docker-compose-networks.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml networks: -{% if enable_central_database %} +{% if enable_central_database | bool %} central_{{ database_type }}_network: external: true {% endif %} diff --git a/templates/docker-compose-volumes-just-database.yml.j2 b/templates/docker-compose-volumes-just-database.yml.j2 index 23aa6977..0e80e052 100644 --- a/templates/docker-compose-volumes-just-database.yml.j2 +++ b/templates/docker-compose-volumes-just-database.yml.j2 @@ -1,5 +1,5 @@ # This needs to be included in docker-compose.yml which just contain a database volume -{% if not enable_central_database %} +{% if not enable_central_database | bool %} volumes: database: {% endif %} \ No newline at end of file diff --git a/templates/docker-compose-volumes.yml.j2 b/templates/docker-compose-volumes.yml.j2 index 4b4c3f3a..ece146f3 100644 --- a/templates/docker-compose-volumes.yml.j2 +++ b/templates/docker-compose-volumes.yml.j2 @@ -1,5 +1,5 @@ # This template needs to be included in docker-compose.yml which contain a database and additional volumes volumes: -{% if not enable_central_database %} +{% if not enable_central_database | bool %} database: {% endif %} \ No newline at end of file diff --git a/templates/docker-container-depends-on-also-database.yml.j2 b/templates/docker-container-depends-on-also-database.yml.j2 index 809268e7..8eda1cf7 100644 --- a/templates/docker-container-depends-on-also-database.yml.j2 +++ b/templates/docker-container-depends-on-also-database.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml containers which depend on a database and additional containers depends_on: -{% if enable_central_database %} +{% if enable_central_database | bool %} database: condition: service_healthy {% endif %} \ No newline at end of file diff --git a/templates/docker-container-depends-on-database-redis.yml.j2 b/templates/docker-container-depends-on-database-redis.yml.j2 index c73f8f77..18b5150c 100644 --- a/templates/docker-container-depends-on-database-redis.yml.j2 +++ b/templates/docker-container-depends-on-database-redis.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes depends_on: -{% if enable_central_database %} +{% if enable_central_database | bool %} database: condition: service_healthy {% endif %} diff --git a/templates/docker-container-depends-on-just-database.yml.j2 b/templates/docker-container-depends-on-just-database.yml.j2 index 0b000dbf..d5712e2d 100644 --- a/templates/docker-container-depends-on-just-database.yml.j2 +++ b/templates/docker-container-depends-on-just-database.yml.j2 @@ -1,5 +1,5 @@ # This template needs to be included in docker-compose.yml contaienrs, which just depend on a database -{% if enable_central_database %} +{% if enable_central_database | bool %} depends_on: database: condition: service_healthy diff --git a/templates/docker-container-networks.yml.j2 b/templates/docker-container-networks.yml.j2 index d99c2747..6d69a2e7 100644 --- a/templates/docker-container-networks.yml.j2 +++ b/templates/docker-container-networks.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml containers networks: - {{docker_compose_project_name}}_network -{% if enable_central_database %} +{% if enable_central_database | bool %} - central_{{ database_type }}_network {% endif %} \ No newline at end of file diff --git a/templates/docker-service-mariadb.yml.j2 b/templates/docker-service-mariadb.yml.j2 index 9e87dcf3..5f249e37 100644 --- a/templates/docker-service-mariadb.yml.j2 +++ b/templates/docker-service-mariadb.yml.j2 @@ -1,5 +1,5 @@ # This template needs to be included in docker-compose.yml, which depend on a mariadb database -{% if not enable_central_database %} +{% if not enable_central_database | bool %} database: logging: driver: journald diff --git a/templates/docker-service-postgres.yml.j2 b/templates/docker-service-postgres.yml.j2 index 54acbbb4..b5159a17 100644 --- a/templates/docker-service-postgres.yml.j2 +++ b/templates/docker-service-postgres.yml.j2 @@ -1,5 +1,5 @@ # This template needs to be included in docker-compose.yml, which depend on a postgres database -{% if not enable_central_database %} +{% if not enable_central_database | bool %} database: image: postgres:{{database_version}}-alpine environment: From ce053a0b587e64dc46fa1bff7e77797cd5694947 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 15:46:28 +0100 Subject: [PATCH 08/13] Solved bugs occuring during setup of yourls --- group_vars/all | 3 +++ roles/backup-docker-to-local/tasks/main.yml | 4 +--- roles/docker-akaunting/templates/docker-compose.yml.j2 | 2 +- roles/docker-attendize/templates/docker-compose.yml.j2 | 2 +- roles/docker-baserow/templates/docker-compose.yml.j2 | 2 +- roles/docker-bigbluebutton/vars/main.yml | 3 +-- roles/docker-gitea/templates/docker-compose.yml.j2 | 2 +- roles/docker-gitlab/templates/docker-compose.yml.j2 | 2 +- roles/docker-joomla/templates/docker-compose.yml.j2 | 2 +- roles/docker-listmonk/templates/docker-compose.yml.j2 | 2 +- roles/docker-mailu/templates/docker-compose.yml.j2 | 2 +- roles/docker-mailu/vars/main.yml | 4 ---- roles/docker-mariadb/tasks/main.yml | 8 ++++++-- roles/docker-mastodon/templates/docker-compose.yml.j2 | 2 +- roles/docker-matomo/templates/docker-compose.yml.j2 | 2 +- .../templates/docker-compose.yml.j2 | 2 +- roles/docker-mybb/templates/docker-compose.yml.j2 | 2 +- roles/docker-nextcloud/templates/docker-compose.yml.j2 | 2 +- .../docker-openproject/templates/docker-compose.yml.j2 | 2 +- roles/docker-peertube/templates/docker-compose.yml.j2 | 2 +- roles/docker-pixelfed/templates/docker-compose.yml.j2 | 2 +- roles/docker-postgres/tasks/main.yml | 2 -- roles/docker-roulette-wheel/vars/main.yml | 1 - roles/docker-yourls/meta/main.yml | 2 -- roles/docker-yourls/tasks/main.yml | 4 ++++ roles/docker-yourls/templates/docker-compose.yml.j2 | 2 +- roles/nginx/tasks/main.yml | 7 +++++++ roles/nginx/templates/nginx.conf.j2 | 3 +++ .../docker-container-depends-on-also-database.yml.j2 | 2 +- .../docker-container-depends-on-database-redis.yml.j2 | 2 +- .../docker-container-depends-on-just-database.yml.j2 | 4 ++-- vars/docker-database-service.yml.j2 | 10 ++++++---- 32 files changed, 52 insertions(+), 41 deletions(-) delete mode 100644 roles/docker-yourls/meta/main.yml diff --git a/group_vars/all b/group_vars/all index 9e5851e9..bc9663e2 100644 --- a/group_vars/all +++ b/group_vars/all @@ -86,6 +86,9 @@ system_maintenance_manipulation_services: ## Total System Maintenance Services system_maintenance_services: "{{ system_maintenance_backup_services + system_maintenance_cleanup_services + system_maintenance_manipulation_services }}" +### Define Variables for Docker Volume Health services +whitelisted_anonymous_docker_volumes: [] + # Webserver Configuration ## Nginx-Specific Path Configurations diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index d436835a..eb0632b7 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -46,7 +46,6 @@ cmd: "python database_entry_seeder.py databases.csv {{docker_compose_project_name}} {{database_host}} {{database_databasename}} {{database_username}} {{database_password}}" chdir: "{{backup_docker_to_local_folder}}" when: > - docker_compose_project_name is defined or database_host is defined or database_databasename is defined or database_username is defined or @@ -59,8 +58,7 @@ owner: root group: root when: > - (docker_compose_project_name is defined or - database_host is defined or + (database_host is defined or database_databasename is defined or database_username is defined or database_password is defined) and diff --git a/roles/docker-akaunting/templates/docker-compose.yml.j2 b/roles/docker-akaunting/templates/docker-compose.yml.j2 index 3a4c36db..3afc07e0 100644 --- a/roles/docker-akaunting/templates/docker-compose.yml.j2 +++ b/roles/docker-akaunting/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3.7' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: image: docker.io/akaunting/akaunting:{{version_akaunting}} diff --git a/roles/docker-attendize/templates/docker-compose.yml.j2 b/roles/docker-attendize/templates/docker-compose.yml.j2 index c3ad7b47..3d5537d1 100644 --- a/roles/docker-attendize/templates/docker-compose.yml.j2 +++ b/roles/docker-attendize/templates/docker-compose.yml.j2 @@ -3,7 +3,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} web: image: attendize_web:latest diff --git a/roles/docker-baserow/templates/docker-compose.yml.j2 b/roles/docker-baserow/templates/docker-compose.yml.j2 index d96a88a3..c9dd7ecb 100644 --- a/roles/docker-baserow/templates/docker-compose.yml.j2 +++ b/roles/docker-baserow/templates/docker-compose.yml.j2 @@ -4,7 +4,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} baserow: image: baserow/baserow:1.19.1 diff --git a/roles/docker-bigbluebutton/vars/main.yml b/roles/docker-bigbluebutton/vars/main.yml index e0e5b6db..f59e140a 100644 --- a/roles/docker-bigbluebutton/vars/main.yml +++ b/roles/docker-bigbluebutton/vars/main.yml @@ -1,6 +1,5 @@ docker_compose_project_name: "bigbluebutton" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "postgres" +database_host: "postgres" # needs to be fixed database_databasename: "greenlight-v3" database_username: "postgres" database_password: "" \ No newline at end of file diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index c3259eda..03f3e46f 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: logging: diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index 83cfac93..5a8bbfd5 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -3,7 +3,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} web: image: 'gitlab/gitlab-ee:latest' diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index 5c575d55..4f9534ca 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: image: joomla diff --git a/roles/docker-listmonk/templates/docker-compose.yml.j2 b/roles/docker-listmonk/templates/docker-compose.yml.j2 index f8914575..4387ca9c 100644 --- a/roles/docker-listmonk/templates/docker-compose.yml.j2 +++ b/roles/docker-listmonk/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: "3.7" services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: restart: unless-stopped diff --git a/roles/docker-mailu/templates/docker-compose.yml.j2 b/roles/docker-mailu/templates/docker-compose.yml.j2 index 102d9acd..25b5cbb8 100644 --- a/roles/docker-mailu/templates/docker-compose.yml.j2 +++ b/roles/docker-mailu/templates/docker-compose.yml.j2 @@ -4,7 +4,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} # Core services resolver: diff --git a/roles/docker-mailu/vars/main.yml b/roles/docker-mailu/vars/main.yml index 28e92259..b036698b 100644 --- a/roles/docker-mailu/vars/main.yml +++ b/roles/docker-mailu/vars/main.yml @@ -1,6 +1,2 @@ docker_compose_project_name: "mailu" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" -database_host: "database" -database_databasename: "{{docker_compose_project_name}}" -database_username: "{{docker_compose_project_name}}" database_password: "{{mailu_database_password}}" \ No newline at end of file diff --git a/roles/docker-mariadb/tasks/main.yml b/roles/docker-mariadb/tasks/main.yml index b7deeb7c..63150fc8 100644 --- a/roles/docker-mariadb/tasks/main.yml +++ b/roles/docker-mariadb/tasks/main.yml @@ -29,6 +29,12 @@ timeout: 120 when: run_once_docker_mariadb is not defined +- name: install python-mysqlclient + pacman: + name: python-mysqlclient + state: present + when: run_once_docker_mariadb is not defined + - name: create database mysql_db: name: "{{database_databasename}}" @@ -37,7 +43,6 @@ login_password: "{{central_mariadb_root_password}}" login_host: 127.0.0.1 login_port: 3306 - listen: create database - name: create database user mysql_user: @@ -49,7 +54,6 @@ login_password: "{{central_mariadb_root_password}}" login_host: 127.0.0.1 login_port: 3306 - listen: create database - name: run the docker_mariadb tasks once set_fact: diff --git a/roles/docker-mastodon/templates/docker-compose.yml.j2 b/roles/docker-mastodon/templates/docker-compose.yml.j2 index a24f0bc8..4d715ca3 100644 --- a/roles/docker-mastodon/templates/docker-compose.yml.j2 +++ b/roles/docker-mastodon/templates/docker-compose.yml.j2 @@ -3,7 +3,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} web: image: tootsuite/mastodon:{{version_mastodon}} diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index e2c398e1..862f7bed 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: logging: diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 3708f2b3..58b4f210 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3.1' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} synapse: image: matrixdotorg/synapse:latest diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index b228dd1b..7148bbae 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -1,7 +1,7 @@ version: '3.8' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: logging: diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index cbac24e7..b7cbee05 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -4,7 +4,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: image: "nextcloud:{{version_nextcloud}}-fpm-alpine" diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index 5cd95a59..96e50a71 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -21,7 +21,7 @@ x-op-app: &app services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} cache: image: memcached diff --git a/roles/docker-peertube/templates/docker-compose.yml.j2 b/roles/docker-peertube/templates/docker-compose.yml.j2 index fcce3a41..61beaa4f 100644 --- a/roles/docker-peertube/templates/docker-compose.yml.j2 +++ b/roles/docker-peertube/templates/docker-compose.yml.j2 @@ -4,7 +4,7 @@ services: {% include 'templates/docker-service-redis.yml.j2' %} -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: image: chocobozzz/peertube:production-bullseye diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 18ed9f77..cedd4707 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '2' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} {% include 'templates/docker-service-redis.yml.j2' %} diff --git a/roles/docker-postgres/tasks/main.yml b/roles/docker-postgres/tasks/main.yml index 624dda86..181df3f0 100644 --- a/roles/docker-postgres/tasks/main.yml +++ b/roles/docker-postgres/tasks/main.yml @@ -34,7 +34,6 @@ login_password: "{{ central_postgres_password }}" login_host: 127.0.0.1 login_port: 5432 - listen: create database - name: Create database user postgresql_user: @@ -47,7 +46,6 @@ login_password: "{{ central_postgres_password }}" login_host: 127.0.0.1 login_port: 5432 - listen: create database - name: Run the docker_postgres tasks once set_fact: diff --git a/roles/docker-roulette-wheel/vars/main.yml b/roles/docker-roulette-wheel/vars/main.yml index 4fc7c771..57f29caa 100644 --- a/roles/docker-roulette-wheel/vars/main.yml +++ b/roles/docker-roulette-wheel/vars/main.yml @@ -1,3 +1,2 @@ docker_compose_project_name: "roulette-wheel" -docker_compose_instance_directory: "{{path_docker_compose_instances}}{{docker_compose_project_name}}/" app_path: "{{docker_compose_instance_directory}}/app/" \ No newline at end of file diff --git a/roles/docker-yourls/meta/main.yml b/roles/docker-yourls/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-yourls/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-yourls/tasks/main.yml b/roles/docker-yourls/tasks/main.yml index c3181163..56b0bf8e 100644 --- a/roles/docker-yourls/tasks/main.yml +++ b/roles/docker-yourls/tasks/main.yml @@ -2,6 +2,10 @@ - name: include docker vars include_vars: vars/docker-database-service.yml.j2 +- name: load docker compose dependencies + include_role: + name: docker-compose + - name: create central database include_role: name: docker-{{database_type}} diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index 0e154c81..dad3c7c2 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: '3' services: -{% include 'templates/docker-service-{{ database_type }}.yml.j2' %} +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} application: logging: diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index d5d09427..b496f2a9 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -4,6 +4,13 @@ notify: restart nginx when: run_once_nginx is not defined +- name: install nginx-mod-headers-more for matomo + pacman: + name: nginx-mod-headers-more + state: present + notify: restart nginx + when: run_once_nginx is not defined and nginx_matomo_tracking | bool + - name: Ensure nginx configuration directories are present file: path: "{{ item }}" diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2 index 02f989cc..d0531d54 100644 --- a/roles/nginx/templates/nginx.conf.j2 +++ b/roles/nginx/templates/nginx.conf.j2 @@ -1,4 +1,7 @@ +{% if nginx_matomo_tracking | bool %} load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so; +{% endif %} + worker_processes auto; events diff --git a/templates/docker-container-depends-on-also-database.yml.j2 b/templates/docker-container-depends-on-also-database.yml.j2 index 8eda1cf7..b38b52bd 100644 --- a/templates/docker-container-depends-on-also-database.yml.j2 +++ b/templates/docker-container-depends-on-also-database.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml containers which depend on a database and additional containers depends_on: -{% if enable_central_database | bool %} +{% if not enable_central_database | bool %} database: condition: service_healthy {% endif %} \ No newline at end of file diff --git a/templates/docker-container-depends-on-database-redis.yml.j2 b/templates/docker-container-depends-on-database-redis.yml.j2 index 18b5150c..a5e6a826 100644 --- a/templates/docker-container-depends-on-database-redis.yml.j2 +++ b/templates/docker-container-depends-on-database-redis.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes depends_on: -{% if enable_central_database | bool %} +{% if not enable_central_database | bool %} database: condition: service_healthy {% endif %} diff --git a/templates/docker-container-depends-on-just-database.yml.j2 b/templates/docker-container-depends-on-just-database.yml.j2 index d5712e2d..9c41915c 100644 --- a/templates/docker-container-depends-on-just-database.yml.j2 +++ b/templates/docker-container-depends-on-just-database.yml.j2 @@ -1,6 +1,6 @@ # This template needs to be included in docker-compose.yml contaienrs, which just depend on a database -{% if enable_central_database | bool %} +{% if not enable_central_database | bool %} depends_on: database: - condition: service_healthy + condition: service_healthy {% endif %} \ No newline at end of file diff --git a/vars/docker-database-service.yml.j2 b/vars/docker-database-service.yml.j2 index cd3cb58e..6cb15fd2 100644 --- a/vars/docker-database-service.yml.j2 +++ b/vars/docker-database-service.yml.j2 @@ -1,4 +1,6 @@ -docker_compose_instance_directory: "{{ docker_compose_instance_directory | default(path_docker_compose_instances + docker_compose_project_name + '/') }}" -database_host: "{{ database_host | default('database') }}" -database_databasename: "{{ database_databasename | default(docker_compose_project_name) }}" -database_username: "{{ database_username | default(docker_compose_project_name) }}" \ No newline at end of file +docker_compose_instance_directory: "{{ path_docker_compose_instances + docker_compose_project_name + '/' }}" +database_host: "{{ 'central-' + database_type if enable_central_database else 'database' }}" +database_databasename: "{{ docker_compose_project_name }}" +database_username: "{{ docker_compose_project_name }}" + +# This will lead to problems with bbb and openproject \ No newline at end of file From 27b5b3a74b83ac11bb8241d88f8d87f234d2fcde Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 17:02:41 +0100 Subject: [PATCH 09/13] Added database variables --- roles/docker-yourls/templates/docker-compose.yml.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index dad3c7c2..e1096181 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -12,10 +12,10 @@ services: ports: - "127.0.0.1:{{http_port}}:80" environment: - YOURLS_DB_HOST: "database:3306" - YOURLS_DB_USER: "yourls" - YOURLS_DB_PASS: "{{yourls_database_password}}" - YOURLS_DB_NAME: "yourls" + YOURLS_DB_HOST: "{{database_host}}:3306" + YOURLS_DB_USER: "{{database_username}}" + YOURLS_DB_PASS: "{{database_password}}" + YOURLS_DB_NAME: "{{database_databasename}}" YOURLS_SITE: "https://{{domain}}" YOURLS_USER: "{{yourls_user}}" YOURLS_PASS: "{{yourls_user_password}}" From 8eed734ad007eb78784eb364857f45d5092b7300 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 18:01:58 +0100 Subject: [PATCH 10/13] Solved authentification bug and added draft for socket --- roles/docker-mariadb/README.md | 2 +- roles/docker-mariadb/tasks/main.yml | 32 ++++++++++++------- .../templates/docker-compose.yml.j2 | 3 +- ...ocker-compose-volumes-just-database.yml.j2 | 3 ++ 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/roles/docker-mariadb/README.md b/roles/docker-mariadb/README.md index 8926a33b..f30f189d 100644 --- a/roles/docker-mariadb/README.md +++ b/roles/docker-mariadb/README.md @@ -24,4 +24,4 @@ Configure the role by setting the required variables. These can be set in the pl - `database_password`: The password for the database user. ## Contributing -Contributions to this project are welcome. Please submit issues and pull requests with your suggestions. \ No newline at end of file +Contributions to this project are welcome. Please submit issues and pull requests with your suggestions. diff --git a/roles/docker-mariadb/tasks/main.yml b/roles/docker-mariadb/tasks/main.yml index 63150fc8..be91377b 100644 --- a/roles/docker-mariadb/tasks/main.yml +++ b/roles/docker-mariadb/tasks/main.yml @@ -4,6 +4,11 @@ state: present when: run_once_docker_mariadb is not defined +- name: Create a volume for MariaDB socket + docker_volume: + name: mariadb_socket + when: run_once_docker_mariadb is not defined + - name: install MariaDB docker_container: name: central-mariadb @@ -15,39 +20,42 @@ networks: - name: central_mariadb_network volumes: - - database:/var/lib/mysql + - central_mariadb_database:/var/lib/mysql + - central_mariadb_socket:/var/run/mysqld published_ports: - - "127.0.0.1:3306:3306" + - "127.0.0.1:3306:3306" # can be that this will be removed if all applications use sockets command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud when: run_once_docker_mariadb is not defined -- name: wait for availability of mariadb - wait_for: - host: "127.0.0.1" - port: "3306" - delay: 0 - timeout: 120 - when: run_once_docker_mariadb is not defined - - name: install python-mysqlclient pacman: name: python-mysqlclient state: present when: run_once_docker_mariadb is not defined +- name: wait for database + wait_for: + host: 127.0.0.1 + port: 3306 + delay: 10 + timeout: 300 + when: run_once_docker_mariadb is not defined + - name: create database mysql_db: - name: "{{database_databasename}}" + name: "{{ database_databasename }}" state: present login_user: root - login_password: "{{central_mariadb_root_password}}" + login_password: "{{ central_mariadb_root_password }}" login_host: 127.0.0.1 login_port: 3306 + - name: create database user mysql_user: name: "{{database_username}}" password: "{{database_password}}" + host: "%" priv: '{{database_databasename}}.*:ALL' state: present login_user: root diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index e1096181..38ae2e87 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -12,13 +12,14 @@ services: ports: - "127.0.0.1:{{http_port}}:80" environment: - YOURLS_DB_HOST: "{{database_host}}:3306" + YOURLS_DB_HOST: "{{database_host}}" YOURLS_DB_USER: "{{database_username}}" YOURLS_DB_PASS: "{{database_password}}" YOURLS_DB_NAME: "{{database_databasename}}" YOURLS_SITE: "https://{{domain}}" YOURLS_USER: "{{yourls_user}}" YOURLS_PASS: "{{yourls_user_password}}" + {% include 'templates/docker-container-depends-on-just-database.yml.j2' %} {% include 'templates/docker-container-networks.yml.j2' %} diff --git a/templates/docker-compose-volumes-just-database.yml.j2 b/templates/docker-compose-volumes-just-database.yml.j2 index 0e80e052..b243fa25 100644 --- a/templates/docker-compose-volumes-just-database.yml.j2 +++ b/templates/docker-compose-volumes-just-database.yml.j2 @@ -1,5 +1,8 @@ # This needs to be included in docker-compose.yml which just contain a database volume +#volumes: {% if not enable_central_database | bool %} volumes: database: +#{% else %} +# mariadb_socket: {% endif %} \ No newline at end of file From f0e7df29a89c166f01dd81b237e005c56a9647b7 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 18:06:34 +0100 Subject: [PATCH 11/13] Removed socket bones --- roles/docker-mariadb/tasks/main.yml | 1 - templates/docker-compose-volumes-just-database.yml.j2 | 3 --- 2 files changed, 4 deletions(-) diff --git a/roles/docker-mariadb/tasks/main.yml b/roles/docker-mariadb/tasks/main.yml index be91377b..702f1aa3 100644 --- a/roles/docker-mariadb/tasks/main.yml +++ b/roles/docker-mariadb/tasks/main.yml @@ -21,7 +21,6 @@ - name: central_mariadb_network volumes: - central_mariadb_database:/var/lib/mysql - - central_mariadb_socket:/var/run/mysqld published_ports: - "127.0.0.1:3306:3306" # can be that this will be removed if all applications use sockets command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud diff --git a/templates/docker-compose-volumes-just-database.yml.j2 b/templates/docker-compose-volumes-just-database.yml.j2 index b243fa25..0e80e052 100644 --- a/templates/docker-compose-volumes-just-database.yml.j2 +++ b/templates/docker-compose-volumes-just-database.yml.j2 @@ -1,8 +1,5 @@ # This needs to be included in docker-compose.yml which just contain a database volume -#volumes: {% if not enable_central_database | bool %} volumes: database: -#{% else %} -# mariadb_socket: {% endif %} \ No newline at end of file From ae99c9e71807a4b8f095b5aa11713569291e0437 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 20:17:55 +0100 Subject: [PATCH 12/13] Implemented common docker routine --- group_vars/all | 5 +++-- roles/docker-akaunting/meta/main.yml | 2 -- roles/docker-akaunting/tasks/main.yml | 9 ++------- roles/docker-attendize/meta/main.yml | 2 -- roles/docker-attendize/tasks/main.yml | 9 ++------- roles/docker-baserow/meta/main.yml | 2 -- roles/docker-baserow/tasks/main.yml | 9 ++------- roles/docker-bigbluebutton/meta/main.yml | 2 -- roles/docker-bigbluebutton/tasks/main.yml | 7 +++++++ roles/docker-discourse/meta/main.yml | 2 -- roles/docker-discourse/tasks/main.yml | 9 ++------- roles/docker-funkwhale/meta/main.yml | 2 -- roles/docker-funkwhale/tasks/main.yml | 9 ++------- roles/docker-gitea/meta/main.yml | 2 -- roles/docker-gitea/tasks/main.yml | 9 ++------- roles/docker-gitlab/meta/main.yml | 2 -- roles/docker-gitlab/tasks/main.yml | 9 ++------- roles/docker-joomla/meta/main.yml | 2 -- roles/docker-joomla/tasks/main.yml | 9 ++------- roles/docker-listmonk/meta/main.yml | 2 -- roles/docker-listmonk/tasks/main.yml | 9 ++------- roles/docker-mailu/meta/main.yml | 1 - roles/docker-mailu/tasks/main.yml | 9 ++------- roles/docker-mastodon/meta/main.yml | 2 -- roles/docker-mastodon/tasks/main.yml | 9 ++------- roles/docker-matomo/meta/main.yml | 2 -- roles/docker-matomo/tasks/main.yml | 9 ++------- roles/docker-matrix-compose/meta/main.yml | 2 -- roles/docker-matrix-compose/tasks/main.yml | 9 ++------- roles/docker-mediawiki/tasks/main.yml | 6 +++--- roles/docker-mybb/meta/main.yml | 2 -- roles/docker-mybb/tasks/main.yml | 9 ++------- roles/docker-nextcloud/meta/main.yml | 2 -- roles/docker-nextcloud/tasks/main.yml | 9 ++------- roles/docker-openproject/meta/main.yml | 2 -- roles/docker-openproject/tasks/main.yml | 9 ++------- roles/docker-peertube/meta/main.yml | 2 -- roles/docker-peertube/tasks/main.yml | 11 +++-------- roles/docker-pixelfed/meta/main.yml | 2 -- roles/docker-pixelfed/tasks/main.yml | 9 ++------- roles/docker-wordpress/meta/main.yml | 2 -- roles/docker-wordpress/tasks/main.yml | 11 +++-------- roles/docker-yourls/tasks/main.yml | 13 ++----------- tasks/docker-compose-common.yml | 11 +++++++++++ 44 files changed, 66 insertions(+), 190 deletions(-) delete mode 100644 roles/docker-akaunting/meta/main.yml delete mode 100644 roles/docker-attendize/meta/main.yml delete mode 100644 roles/docker-baserow/meta/main.yml delete mode 100644 roles/docker-bigbluebutton/meta/main.yml delete mode 100644 roles/docker-discourse/meta/main.yml delete mode 100644 roles/docker-funkwhale/meta/main.yml delete mode 100644 roles/docker-gitea/meta/main.yml delete mode 100644 roles/docker-gitlab/meta/main.yml delete mode 100644 roles/docker-joomla/meta/main.yml delete mode 100644 roles/docker-listmonk/meta/main.yml delete mode 100644 roles/docker-mastodon/meta/main.yml delete mode 100644 roles/docker-matomo/meta/main.yml delete mode 100644 roles/docker-matrix-compose/meta/main.yml delete mode 100644 roles/docker-mybb/meta/main.yml delete mode 100644 roles/docker-nextcloud/meta/main.yml delete mode 100644 roles/docker-openproject/meta/main.yml delete mode 100644 roles/docker-peertube/meta/main.yml delete mode 100644 roles/docker-pixelfed/meta/main.yml delete mode 100644 roles/docker-wordpress/meta/main.yml create mode 100644 tasks/docker-compose-common.yml diff --git a/group_vars/all b/group_vars/all index bc9663e2..945afa6b 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,6 +1,7 @@ # General -verbose: false # Prints well formated debug information -top_domain: "localhost" +verbose: false # Prints well formated debug information +top_domain: "localhost" +backups_folder_path: "/Backups/" # Server Tact Variables diff --git a/roles/docker-akaunting/meta/main.yml b/roles/docker-akaunting/meta/main.yml deleted file mode 100644 index ec2a6059..00000000 --- a/roles/docker-akaunting/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose \ No newline at end of file diff --git a/roles/docker-akaunting/tasks/main.yml b/roles/docker-akaunting/tasks/main.yml index a2dc4a22..06e46d21 100644 --- a/roles/docker-akaunting/tasks/main.yml +++ b/roles/docker-akaunting/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-attendize/meta/main.yml b/roles/docker-attendize/meta/main.yml deleted file mode 100644 index ec2a6059..00000000 --- a/roles/docker-attendize/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose \ No newline at end of file diff --git a/roles/docker-attendize/tasks/main.yml b/roles/docker-attendize/tasks/main.yml index b223ae77..7fea90b4 100644 --- a/roles/docker-attendize/tasks/main.yml +++ b/roles/docker-attendize/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: receive {{ mail_interface_domain }} certificate command: certbot certonly --agree-tos --email {{ administrator_email }} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{ mail_interface_domain }} diff --git a/roles/docker-baserow/meta/main.yml b/roles/docker-baserow/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-baserow/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-baserow/tasks/main.yml b/roles/docker-baserow/tasks/main.yml index 014b690d..ef07660e 100644 --- a/roles/docker-baserow/tasks/main.yml +++ b/roles/docker-baserow/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-bigbluebutton/meta/main.yml b/roles/docker-bigbluebutton/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-bigbluebutton/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-bigbluebutton/tasks/main.yml b/roles/docker-bigbluebutton/tasks/main.yml index be8bfff7..c25d6052 100644 --- a/roles/docker-bigbluebutton/tasks/main.yml +++ b/roles/docker-bigbluebutton/tasks/main.yml @@ -1,4 +1,11 @@ --- +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: load docker compose dependencies + include_role: + name: docker-compose + - name: "include task certbot-matomo.yml" include_tasks: certbot-matomo.yml diff --git a/roles/docker-discourse/meta/main.yml b/roles/docker-discourse/meta/main.yml deleted file mode 100644 index d3606e63..00000000 --- a/roles/docker-discourse/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- nginx-docker-reverse-proxy diff --git a/roles/docker-discourse/tasks/main.yml b/roles/docker-discourse/tasks/main.yml index ba8ad2c7..43988d9f 100644 --- a/roles/docker-discourse/tasks/main.yml +++ b/roles/docker-discourse/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-funkwhale/meta/main.yml b/roles/docker-funkwhale/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-funkwhale/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-funkwhale/tasks/main.yml b/roles/docker-funkwhale/tasks/main.yml index 59923d32..27b3c728 100644 --- a/roles/docker-funkwhale/tasks/main.yml +++ b/roles/docker-funkwhale/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-gitea/meta/main.yml b/roles/docker-gitea/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-gitea/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-gitea/tasks/main.yml b/roles/docker-gitea/tasks/main.yml index 24849a0a..a0266bb3 100644 --- a/roles/docker-gitea/tasks/main.yml +++ b/roles/docker-gitea/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-gitlab/meta/main.yml b/roles/docker-gitlab/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-gitlab/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-gitlab/tasks/main.yml b/roles/docker-gitlab/tasks/main.yml index 24849a0a..a0266bb3 100644 --- a/roles/docker-gitlab/tasks/main.yml +++ b/roles/docker-gitlab/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-joomla/meta/main.yml b/roles/docker-joomla/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-joomla/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-joomla/tasks/main.yml b/roles/docker-joomla/tasks/main.yml index 82221967..d2ca459f 100644 --- a/roles/docker-joomla/tasks/main.yml +++ b/roles/docker-joomla/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-listmonk/meta/main.yml b/roles/docker-listmonk/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-listmonk/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-listmonk/tasks/main.yml b/roles/docker-listmonk/tasks/main.yml index e1321ee8..66a0413b 100644 --- a/roles/docker-listmonk/tasks/main.yml +++ b/roles/docker-listmonk/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-mailu/meta/main.yml b/roles/docker-mailu/meta/main.yml index 1240088e..12fe7062 100644 --- a/roles/docker-mailu/meta/main.yml +++ b/roles/docker-mailu/meta/main.yml @@ -1,3 +1,2 @@ dependencies: -- docker-compose - systemd-notifier diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index 6da02317..27a2632a 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-mastodon/meta/main.yml b/roles/docker-mastodon/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-mastodon/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-mastodon/tasks/main.yml b/roles/docker-mastodon/tasks/main.yml index 91fe0f8d..8ed0107e 100644 --- a/roles/docker-mastodon/tasks/main.yml +++ b/roles/docker-mastodon/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include create-domains.yml" include_tasks: create-domains.yml diff --git a/roles/docker-matomo/meta/main.yml b/roles/docker-matomo/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-matomo/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-matomo/tasks/main.yml b/roles/docker-matomo/tasks/main.yml index c3181163..456bb47c 100644 --- a/roles/docker-matomo/tasks/main.yml +++ b/roles/docker-matomo/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-matrix-compose/meta/main.yml b/roles/docker-matrix-compose/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-matrix-compose/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-matrix-compose/tasks/main.yml b/roles/docker-matrix-compose/tasks/main.yml index 6fd4b598..a47090d1 100644 --- a/roles/docker-matrix-compose/tasks/main.yml +++ b/roles/docker-matrix-compose/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-mediawiki/tasks/main.yml b/roles/docker-mediawiki/tasks/main.yml index 33dbe7a4..2f82b65c 100644 --- a/roles/docker-mediawiki/tasks/main.yml +++ b/roles/docker-mediawiki/tasks/main.yml @@ -20,10 +20,10 @@ image: mariadb environment: MYSQL_DATABASE: mediawiki - MYSQL_ROOT_PASSWORD: "{{mediawiki_mysql_user_password}}" + MYSQL_ROOT_PASSWORD: "{{mediawiki_database_password}}" MYSQL_USER: mediawiki - MYSQL_PASSWORD: "{{mediawiki_mysql_user_password}}" + MYSQL_PASSWORD: "{{mediawiki_database_password}}" MARIADB_AUTO_UPGRADE: "1" volumes: - - mediawiki-database:/var/lib/mysql + - database:/var/lib/mysql restart: always diff --git a/roles/docker-mybb/meta/main.yml b/roles/docker-mybb/meta/main.yml deleted file mode 100644 index ec2a6059..00000000 --- a/roles/docker-mybb/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose \ No newline at end of file diff --git a/roles/docker-mybb/tasks/main.yml b/roles/docker-mybb/tasks/main.yml index 7bf9aa24..26b69b16 100644 --- a/roles/docker-mybb/tasks/main.yml +++ b/roles/docker-mybb/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks create-proxy-with-domain-replace.yml" include_tasks: create-proxy-with-domain-replace.yml diff --git a/roles/docker-nextcloud/meta/main.yml b/roles/docker-nextcloud/meta/main.yml deleted file mode 100644 index ec2a6059..00000000 --- a/roles/docker-nextcloud/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose \ No newline at end of file diff --git a/roles/docker-nextcloud/tasks/main.yml b/roles/docker-nextcloud/tasks/main.yml index eca8f058..e9a0eba5 100644 --- a/roles/docker-nextcloud/tasks/main.yml +++ b/roles/docker-nextcloud/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include task certbot-matomo.yml" include_tasks: certbot-matomo.yml diff --git a/roles/docker-openproject/meta/main.yml b/roles/docker-openproject/meta/main.yml deleted file mode 100644 index ec2a6059..00000000 --- a/roles/docker-openproject/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose \ No newline at end of file diff --git a/roles/docker-openproject/tasks/main.yml b/roles/docker-openproject/tasks/main.yml index 486446de..b2c4d340 100644 --- a/roles/docker-openproject/tasks/main.yml +++ b/roles/docker-openproject/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-peertube/meta/main.yml b/roles/docker-peertube/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-peertube/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-peertube/tasks/main.yml b/roles/docker-peertube/tasks/main.yml index 9ec5b724..34a8fc76 100644 --- a/roles/docker-peertube/tasks/main.yml +++ b/roles/docker-peertube/tasks/main.yml @@ -1,12 +1,7 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool - +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml + - name: "include create-domains.yml" include_tasks: create-domains.yml loop: "{{ domains }}" diff --git a/roles/docker-pixelfed/meta/main.yml b/roles/docker-pixelfed/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-pixelfed/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-pixelfed/tasks/main.yml b/roles/docker-pixelfed/tasks/main.yml index 014b690d..ef07660e 100644 --- a/roles/docker-pixelfed/tasks/main.yml +++ b/roles/docker-pixelfed/tasks/main.yml @@ -1,11 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/roles/docker-wordpress/meta/main.yml b/roles/docker-wordpress/meta/main.yml deleted file mode 100644 index 03045ca5..00000000 --- a/roles/docker-wordpress/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- docker-compose diff --git a/roles/docker-wordpress/tasks/main.yml b/roles/docker-wordpress/tasks/main.yml index 81ded561..2ab503cc 100644 --- a/roles/docker-wordpress/tasks/main.yml +++ b/roles/docker-wordpress/tasks/main.yml @@ -1,12 +1,7 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool - +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml + - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml loop: "{{ domains }}" diff --git a/roles/docker-yourls/tasks/main.yml b/roles/docker-yourls/tasks/main.yml index 56b0bf8e..456bb47c 100644 --- a/roles/docker-yourls/tasks/main.yml +++ b/roles/docker-yourls/tasks/main.yml @@ -1,15 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-database-service.yml.j2 - -- name: load docker compose dependencies - include_role: - name: docker-compose - -- name: create central database - include_role: - name: docker-{{database_type}} - when: enable_central_database | bool +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml diff --git a/tasks/docker-compose-common.yml b/tasks/docker-compose-common.yml new file mode 100644 index 00000000..2028d40f --- /dev/null +++ b/tasks/docker-compose-common.yml @@ -0,0 +1,11 @@ +- name: include docker vars + include_vars: vars/docker-database-service.yml.j2 + +- name: load docker compose dependencies + include_role: + name: docker-compose + +- name: create central database + include_role: + name: docker-{{database_type}} + when: enable_central_database | bool \ No newline at end of file From fa02ce83358c65f1ef001ab057e9d2e0f1da53c0 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 20:28:47 +0100 Subject: [PATCH 13/13] Added missing line break --- templates/docker-container-depends-on-database-redis.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-container-depends-on-database-redis.yml.j2 b/templates/docker-container-depends-on-database-redis.yml.j2 index a5e6a826..57ca0edf 100644 --- a/templates/docker-container-depends-on-database-redis.yml.j2 +++ b/templates/docker-container-depends-on-database-redis.yml.j2 @@ -5,4 +5,4 @@ condition: service_healthy {% endif %} redis: - condition: service_healthy \ No newline at end of file + condition: service_healthy