From a6670ddb0143cb57cde69e7bf942a6575f465582 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Jan 2024 15:46:28 +0100 Subject: [PATCH] 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