From ed40ee1f427e1588c71125cd09bc99d3348c7d2b Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 6 Dec 2023 17:59:57 +0100 Subject: [PATCH 1/6] refactored docker and nginx roles, to make them more modular --- playbook-servers.yml | 3 ++- roles/docker-akaunting/tasks/main.yml | 8 ++------ roles/docker-baserow/tasks/main.yml | 8 ++------ roles/docker-bigbluebutton/tasks/main.yml | 4 ++-- roles/docker-elk/tasks/main.yml | 8 ++------ roles/docker-funkwhale/tasks/main.yml | 8 ++------ roles/docker-gitea/tasks/main.yml | 8 ++------ roles/docker-jenkins/tasks/main.yml | 8 ++------ roles/docker-joomla/tasks/main.yml | 11 +++++------ roles/docker-listmonk/tasks/main.yml | 10 ++-------- roles/docker-mailu/tasks/main.yml | 9 ++------- roles/docker-mastodon/tasks/main.yml | 4 ++-- roles/docker-matomo/tasks/main.yml | 10 ++-------- roles/docker-mediawiki/tasks/main.yml | 8 ++------ roles/docker-nextcloud/tasks/main.yml | 4 ++-- roles/docker-peertube/tasks/main.yml | 8 ++------ roles/docker-pixelfed/tasks/main.yml | 8 ++------ roles/docker-roulette-wheel/tasks/main.yml | 8 ++------ .../tasks/create-wordpress-nginx.yml | 10 ---------- roles/docker-wordpress/tasks/main.yml | 19 ++++++------------- roles/docker-yourls/tasks/main.yml | 10 ++-------- roles/nginx-homepage/tasks/main.yml | 7 ++++--- tasks/certbot-matomo.yml | 5 +++++ tasks/nginx-docker-proxy-domain.yml | 7 ++----- 24 files changed, 58 insertions(+), 135 deletions(-) delete mode 100644 roles/docker-wordpress/tasks/create-wordpress-nginx.yml create mode 100644 tasks/certbot-matomo.yml diff --git a/playbook-servers.yml b/playbook-servers.yml index 638349d4..59b1eb67 100644 --- a/playbook-servers.yml +++ b/playbook-servers.yml @@ -55,6 +55,7 @@ roles: - role: docker-wordpress vars: + domains: "{{wordpress_domains}}" http_port: 8003 - name: setup mediawiki hosts @@ -161,7 +162,7 @@ roles: - role: docker-joomla vars: - domain: "joomla.{{top_domain}}" + domain: "{{joomla_domains}}" http_port: 8014 - name: setup attendize diff --git a/roles/docker-akaunting/tasks/main.yml b/roles/docker-akaunting/tasks/main.yml index 49f91540..72535180 100644 --- a/roles/docker-akaunting/tasks/main.yml +++ b/roles/docker-akaunting/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: register directory stat: diff --git a/roles/docker-baserow/tasks/main.yml b/roles/docker-baserow/tasks/main.yml index 216da95a..5ba4b0dd 100644 --- a/roles/docker-baserow/tasks/main.yml +++ b/roles/docker-baserow/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-bigbluebutton/tasks/main.yml b/roles/docker-bigbluebutton/tasks/main.yml index 11c97a80..fa76aaaa 100644 --- a/roles/docker-bigbluebutton/tasks/main.yml +++ b/roles/docker-bigbluebutton/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml - name: configure {{domain}}.conf template: src=templates/nginx-proxy.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf diff --git a/roles/docker-elk/tasks/main.yml b/roles/docker-elk/tasks/main.yml index d38de01d..b0ec3fdc 100644 --- a/roles/docker-elk/tasks/main.yml +++ b/roles/docker-elk/tasks/main.yml @@ -1,11 +1,7 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: create elasticsearch-sysctl.conf copy: diff --git a/roles/docker-funkwhale/tasks/main.yml b/roles/docker-funkwhale/tasks/main.yml index e2eae661..b68cb3a9 100644 --- a/roles/docker-funkwhale/tasks/main.yml +++ b/roles/docker-funkwhale/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-gitea/tasks/main.yml b/roles/docker-gitea/tasks/main.yml index c1f8761c..da9f0511 100644 --- a/roles/docker-gitea/tasks/main.yml +++ b/roles/docker-gitea/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}} https - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-jenkins/tasks/main.yml b/roles/docker-jenkins/tasks/main.yml index 2f99b428..f38e8a0d 100644 --- a/roles/docker-jenkins/tasks/main.yml +++ b/roles/docker-jenkins/tasks/main.yml @@ -1,9 +1,5 @@ -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "docker jenkins" docker_compose: diff --git a/roles/docker-joomla/tasks/main.yml b/roles/docker-joomla/tasks/main.yml index ef524fcf..9c993607 100644 --- a/roles/docker-joomla/tasks/main.yml +++ b/roles/docker-joomla/tasks/main.yml @@ -1,10 +1,9 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml + loop: "{{ domains }}" + loop_control: + loop_var: domain - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-listmonk/tasks/main.yml b/roles/docker-listmonk/tasks/main.yml index 5cfca8d3..b51fba5b 100644 --- a/roles/docker-listmonk/tasks/main.yml +++ b/roles/docker-listmonk/tasks/main.yml @@ -1,12 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: - src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2" - dest: "/etc/nginx/conf.d/{{domain}}.conf" - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index d3100934..080ea80c 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -1,13 +1,8 @@ --- - -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml vars: client_max_body_size: "31M" - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx - name: "create {{path_docker_compose_files}}mailu" file: diff --git a/roles/docker-mastodon/tasks/main.yml b/roles/docker-mastodon/tasks/main.yml index 4c0ff52b..7d01bd7d 100644 --- a/roles/docker-mastodon/tasks/main.yml +++ b/roles/docker-mastodon/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml - name: configure {{domain}}.conf template: src=templates/mastodon.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf diff --git a/roles/docker-matomo/tasks/main.yml b/roles/docker-matomo/tasks/main.yml index e35626ad..ff9ca982 100644 --- a/roles/docker-matomo/tasks/main.yml +++ b/roles/docker-matomo/tasks/main.yml @@ -1,12 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: - src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2" - dest: "/etc/nginx/conf.d/{{domain}}.conf" - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-mediawiki/tasks/main.yml b/roles/docker-mediawiki/tasks/main.yml index 409f8358..b0b2e0b9 100644 --- a/roles/docker-mediawiki/tasks/main.yml +++ b/roles/docker-mediawiki/tasks/main.yml @@ -1,9 +1,5 @@ -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "docker mediawiki" docker_compose: diff --git a/roles/docker-nextcloud/tasks/main.yml b/roles/docker-nextcloud/tasks/main.yml index fc28225e..0399eb29 100644 --- a/roles/docker-nextcloud/tasks/main.yml +++ b/roles/docker-nextcloud/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml - name: configure {{domain}}.conf template: diff --git a/roles/docker-peertube/tasks/main.yml b/roles/docker-peertube/tasks/main.yml index 15a07774..a0838bdc 100644 --- a/roles/docker-peertube/tasks/main.yml +++ b/roles/docker-peertube/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=templates/peertube.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-pixelfed/tasks/main.yml b/roles/docker-pixelfed/tasks/main.yml index 7ac3db74..8f397ce1 100644 --- a/roles/docker-pixelfed/tasks/main.yml +++ b/roles/docker-pixelfed/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-roulette-wheel/tasks/main.yml b/roles/docker-roulette-wheel/tasks/main.yml index 9741507f..f94c55f3 100644 --- a/roles/docker-roulette-wheel/tasks/main.yml +++ b/roles/docker-roulette-wheel/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-wordpress/tasks/create-wordpress-nginx.yml b/roles/docker-wordpress/tasks/create-wordpress-nginx.yml deleted file mode 100644 index 06689927..00000000 --- a/roles/docker-wordpress/tasks/create-wordpress-nginx.yml +++ /dev/null @@ -1,10 +0,0 @@ -- name: Activate NGINX matomo tracking for {{domain}} - include_role: - name: nginx-matomo-tracking - when: nginx_matomo_tracking_active - -- name: configure wordpress nginx configurations - vars: - client_max_body_size: "{{wordpress_max_upload_size}}" - template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{ domain }}.conf - notify: restart nginx \ No newline at end of file diff --git a/roles/docker-wordpress/tasks/main.yml b/roles/docker-wordpress/tasks/main.yml index a8ad46f6..8969a183 100644 --- a/roles/docker-wordpress/tasks/main.yml +++ b/roles/docker-wordpress/tasks/main.yml @@ -1,19 +1,12 @@ --- -- name: "include task receive certbot certificate" - include_tasks: recieve-certbot-certificate.yml - vars: - domain: "{{ item }}" - loop: "{{ wordpress_domains }}" - loop_control: - loop_var: item -- name: "include task create wordpress nginx" - include_tasks: create-wordpress-nginx.yml - vars: - domain: "{{ item }}" - loop: "{{ wordpress_domains }}" +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml + loop: "{{ domains }}" loop_control: - loop_var: item + loop_var: domain + vars: + client_max_body_size: "{{wordpress_max_upload_size}}" - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/docker-yourls/tasks/main.yml b/roles/docker-yourls/tasks/main.yml index 5f2d2bab..dd8f2af7 100644 --- a/roles/docker-yourls/tasks/main.yml +++ b/roles/docker-yourls/tasks/main.yml @@ -1,12 +1,6 @@ --- -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - -- name: configure {{domain}}.conf - template: - src: "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2" - dest: "/etc/nginx/conf.d/{{domain}}.conf" - notify: restart nginx +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/nginx-homepage/tasks/main.yml b/roles/nginx-homepage/tasks/main.yml index 4d16e19a..44f3d871 100644 --- a/roles/nginx-homepage/tasks/main.yml +++ b/roles/nginx-homepage/tasks/main.yml @@ -1,10 +1,11 @@ +--- +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml + - name: configure {{domain}}.conf template: src=homepage.nginx.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf notify: restart nginx -- name: recieve {{domain}} certificate - command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} - - name: nginx-homepage repo git git: repo: "{{nginx_homepage_repository_address}}" diff --git a/tasks/certbot-matomo.yml b/tasks/certbot-matomo.yml new file mode 100644 index 00000000..7a63bdbc --- /dev/null +++ b/tasks/certbot-matomo.yml @@ -0,0 +1,5 @@ +- name: "include task receive certbot certificate" + include_tasks: recieve-certbot-certificate.yml + +- name: "include task implement-matomo-tracking.yml" + include_tasks: implement-matomo-tracking.yml \ No newline at end of file diff --git a/tasks/nginx-docker-proxy-domain.yml b/tasks/nginx-docker-proxy-domain.yml index b34b9569..f0a72f20 100644 --- a/tasks/nginx-docker-proxy-domain.yml +++ b/tasks/nginx-docker-proxy-domain.yml @@ -1,8 +1,5 @@ -- name: "include task receive certbot certificate" - include_tasks: recieve-certbot-certificate.yml - -- name: "include task implement-matomo-tracking.yml" - include_tasks: implement-matomo-tracking.yml +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml - name: "include task create-domain-conf.yml" include_tasks: create-domain-conf.yml From fe77fb623ef744a2fe8baf7b7d9adb87aebe5f97 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 7 Dec 2023 15:35:57 +0100 Subject: [PATCH 2/6] Updated mybb README.md, renamed variables, solved mybb bug --- group_vars/all | 2 +- roles/docker-akaunting/README.md | 2 +- roles/docker-akaunting/vars/main.yml | 2 +- roles/docker-attendize/vars/main.yml | 2 +- roles/docker-baserow/handlers/main.yml | 2 +- roles/docker-baserow/vars/main.yml | 2 +- roles/docker-bigbluebutton/vars/main.yml | 2 +- roles/docker-funkwhale/vars/main.yml | 2 +- roles/docker-gitea/vars/main.yml | 2 +- roles/docker-joomla/vars/main.yml | 2 +- roles/docker-listmonk/handlers/main.yml | 2 +- roles/docker-listmonk/vars/main.yml | 2 +- roles/docker-mailu/tasks/main.yml | 4 +- roles/docker-mailu/vars/main.yml | 2 +- roles/docker-mastodon/README.md | 6 +- roles/docker-mastodon/vars/main.yml | 2 +- roles/docker-matomo/README.md | 2 +- roles/docker-matomo/vars/main.yml | 2 +- roles/docker-mybb/README.md | 58 ++++++++++++++++--- roles/docker-mybb/tasks/main.yml | 8 +-- roles/docker-mybb/templates/default.conf | 8 --- .../templates/docker-compose.yml.j2 | 4 +- roles/docker-mybb/vars/main.yml | 8 +-- roles/docker-nextcloud/README.md | 2 +- roles/docker-nextcloud/vars/main.yml | 2 +- roles/docker-peertube/README.md | 2 +- roles/docker-peertube/vars/main.yml | 2 +- roles/docker-pixelfed/README.md | 2 +- roles/docker-pixelfed/handlers/main.yml | 2 +- roles/docker-pixelfed/vars/main.yml | 2 +- roles/docker-roulette-wheel/vars/main.yml | 4 +- roles/docker-wordpress/vars/main.yml | 2 +- roles/docker-yourls/vars/main.yml | 2 +- roles/docker/tasks/main.yml | 4 +- .../templates/update-docker.service.j2 | 2 +- roles/update/tasks/main.yml | 4 +- 36 files changed, 97 insertions(+), 63 deletions(-) diff --git a/group_vars/all b/group_vars/all index b6cad69d..d86e4af8 100644 --- a/group_vars/all +++ b/group_vars/all @@ -29,7 +29,7 @@ size_percent_cleanup_disc_space: 90 path_administrator_home: "/home/administrator/" path_administrator_scripts: "{{path_administrator_home}}scripts/" path_docker_volumes: "{{path_administrator_home}}volumes/docker/" -path_docker_compose_files: "{{path_administrator_home}}docker-compose/" +docker_compose_instances_directory: "{{path_administrator_home}}docker-compose/" # Runtime Variables activate_all_timers (bool): false # Activates all timers, independend if the handlers had been triggered diff --git a/roles/docker-akaunting/README.md b/roles/docker-akaunting/README.md index 0ceecc90..6ef7e5cd 100644 --- a/roles/docker-akaunting/README.md +++ b/roles/docker-akaunting/README.md @@ -19,7 +19,7 @@ Due to license issues, bugs and that in the past after an akaunting update your 1. **Navigate to Docker Compose Directory**: Change to the directory containing your Docker Compose files for Akaunting. ```bash - cd {{path_docker_compose_files}}akaunting/ + cd {{docker_compose_instances_directory}}akaunting/ ``` 2. **Set Environment Variables**: These are necessary to prevent timeouts during long operations. diff --git a/roles/docker-akaunting/vars/main.yml b/roles/docker-akaunting/vars/main.yml index 6a272858..06efb319 100644 --- a/roles/docker-akaunting/vars/main.yml +++ b/roles/docker-akaunting/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}akaunting/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}akaunting/" diff --git a/roles/docker-attendize/vars/main.yml b/roles/docker-attendize/vars/main.yml index 5645bf91..741d1608 100644 --- a/roles/docker-attendize/vars/main.yml +++ b/roles/docker-attendize/vars/main.yml @@ -1,3 +1,3 @@ --- -docker_compose_instance_directory: "{{path_docker_compose_files}}attendize/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}attendize/" mail_interface_domain: "mail.{{domain}}" diff --git a/roles/docker-baserow/handlers/main.yml b/roles/docker-baserow/handlers/main.yml index 9cad282a..3e37556d 100644 --- a/roles/docker-baserow/handlers/main.yml +++ b/roles/docker-baserow/handlers/main.yml @@ -2,7 +2,7 @@ - name: recreate baserow command: cmd: docker-compose -p baserow up -d --force-recreate - chdir: "{{path_docker_compose_files}}baserow/" + chdir: "{{docker_compose_instances_directory}}baserow/" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-baserow/vars/main.yml b/roles/docker-baserow/vars/main.yml index fbd997e8..9c98e0d7 100644 --- a/roles/docker-baserow/vars/main.yml +++ b/roles/docker-baserow/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}baserow/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}baserow/" \ No newline at end of file diff --git a/roles/docker-bigbluebutton/vars/main.yml b/roles/docker-bigbluebutton/vars/main.yml index 7b1a7790..edafc84f 100644 --- a/roles/docker-bigbluebutton/vars/main.yml +++ b/roles/docker-bigbluebutton/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}bigbluebutton/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}bigbluebutton/" \ No newline at end of file diff --git a/roles/docker-funkwhale/vars/main.yml b/roles/docker-funkwhale/vars/main.yml index a04726fa..b65f6013 100644 --- a/roles/docker-funkwhale/vars/main.yml +++ b/roles/docker-funkwhale/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}funkwhale/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}funkwhale/" client_max_body_size: "512M" diff --git a/roles/docker-gitea/vars/main.yml b/roles/docker-gitea/vars/main.yml index bf380fda..1e663c61 100644 --- a/roles/docker-gitea/vars/main.yml +++ b/roles/docker-gitea/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}gitea/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}gitea/" diff --git a/roles/docker-joomla/vars/main.yml b/roles/docker-joomla/vars/main.yml index 5abb2051..30a906ea 100644 --- a/roles/docker-joomla/vars/main.yml +++ b/roles/docker-joomla/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}joomla/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}joomla/" diff --git a/roles/docker-listmonk/handlers/main.yml b/roles/docker-listmonk/handlers/main.yml index 95f93475..286bef09 100644 --- a/roles/docker-listmonk/handlers/main.yml +++ b/roles/docker-listmonk/handlers/main.yml @@ -2,7 +2,7 @@ - name: recreate listmonk command: cmd: docker-compose -p listmonk up -d --force-recreate - chdir: "{{path_docker_compose_files}}listmonk/" + chdir: "{{docker_compose_instances_directory}}listmonk/" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-listmonk/vars/main.yml b/roles/docker-listmonk/vars/main.yml index e1eb20aa..ef1a09a8 100644 --- a/roles/docker-listmonk/vars/main.yml +++ b/roles/docker-listmonk/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}listmonk/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}listmonk/" diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index 080ea80c..fe93dd73 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -4,9 +4,9 @@ vars: client_max_body_size: "31M" -- name: "create {{path_docker_compose_files}}mailu" +- name: "create {{docker_compose_instances_directory}}mailu" file: - path: "{{path_docker_compose_files}}mailu" + path: "{{docker_compose_instances_directory}}mailu" state: directory mode: 0755 diff --git a/roles/docker-mailu/vars/main.yml b/roles/docker-mailu/vars/main.yml index 11ff0ae1..85d5c496 100644 --- a/roles/docker-mailu/vars/main.yml +++ b/roles/docker-mailu/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}mailu/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}mailu/" \ No newline at end of file diff --git a/roles/docker-mastodon/README.md b/roles/docker-mastodon/README.md index 3dc6a2c5..d2b4b113 100644 --- a/roles/docker-mastodon/README.md +++ b/roles/docker-mastodon/README.md @@ -5,11 +5,11 @@ ``` ## cleanup ```bash -cd {{path_docker_compose_files}}mastodon/ +cd {{docker_compose_instances_directory}}mastodon/ docker-compose down docker volume rm mastodon_data mastodon_database mastodon_redis -cd {{path_docker_compose_files}} && -rm -vR {{path_docker_compose_files}}mastodon +cd {{docker_compose_instances_directory}} && +rm -vR {{docker_compose_instances_directory}}mastodon ``` ## access terminal diff --git a/roles/docker-mastodon/vars/main.yml b/roles/docker-mastodon/vars/main.yml index 31c78177..d6893ba3 100644 --- a/roles/docker-mastodon/vars/main.yml +++ b/roles/docker-mastodon/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}mastodon/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}mastodon/" diff --git a/roles/docker-matomo/README.md b/roles/docker-matomo/README.md index 6c25ebfb..efac16f7 100644 --- a/roles/docker-matomo/README.md +++ b/roles/docker-matomo/README.md @@ -12,7 +12,7 @@ This Ansible role deploys a Matomo analytics platform instance using Docker. - `domain`: The domain where Matomo will be accessible. - `administrator_email`: The email used for SSL certificate registration. -- `path_docker_compose_files`: Path to store Docker Compose files. +- `docker_compose_instances_directory`: Path to store Docker Compose files. - `http_port`: The host port that Matomo will be accessible on. - `matomo_database_password`: Password for the Matomo database. diff --git a/roles/docker-matomo/vars/main.yml b/roles/docker-matomo/vars/main.yml index 1bf79ec3..6e3581df 100644 --- a/roles/docker-matomo/vars/main.yml +++ b/roles/docker-matomo/vars/main.yml @@ -1,2 +1,2 @@ --- -docker_compose_instance_directory: "{{path_docker_compose_files}}matomo/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}matomo/" \ No newline at end of file diff --git a/roles/docker-mybb/README.md b/roles/docker-mybb/README.md index c73aa738..8d2f6bdd 100644 --- a/roles/docker-mybb/README.md +++ b/roles/docker-mybb/README.md @@ -5,9 +5,9 @@ ## Variables - `docker_compose_instance_directory`: The directory where Docker Compose files for MyBB are stored. -- `conf_d_docker_directory`: Directory for Docker Nginx configuration. -- `default_conf_server_file`: The default Nginx configuration file for the server. -- `conf_d_server_directory`: The Nginx server's configuration directory. +- `target_mount_conf_d_directory`: Directory for Docker Nginx configuration. +- `default_conf_docker_file`: The default Nginx configuration file for the server. +- `docker_compose_instance_confd_directory`: The Nginx server's configuration directory. ## Tasks 1. **Domain Certificate Retrieval:** Automates the process of obtaining SSL certificates for the specified domain using Certbot. @@ -18,11 +18,53 @@ ## Usage -### Install Plugins -To install MyBB plugins, extract them to a mounted volume and sync using the provided `docker run` command -```bash -docker run --rm -v mybb-data:/target/ -v /mnt/:/origin/ "kevinveenbirkenbach/alpine-rsync" sh -c "rsync -avv /origin/inc/plugins/ /target/" -``` +### Manual Installation of MyBB Plugins + +This guide describes the process of manually installing MyBB plugins in your Docker-MyBB environment. This can be useful if you want to quickly test plugins or do not wish to execute the Ansible role. + +#### Steps for Manual Installation + + +1. **Prepare Plugin Files:** + - Download the desired MyBB plugin zip files. + +2. **Copy plugin to host:** + - ```bash scp administrator@:/home/administrator/docker-compose/mybb/plugins``` + +3. **Unzip Plugin Files on the Host:** + - Unzip the plugin zip files in the host's plugin directory: + ```bash + unzip /home/administrator/docker-compose/mybb/plugins/.zip -d /home/administrator/docker-compose/mybb/plugins/ + ``` + - Replace `.zip` with the name of the plugin zip file. + - Repeat this step for each plugin. + +4. **Access the Docker Container:** + - Open a terminal or SSH session on the server where the Docker container is running. + +5. **Copy Unzipped Plugin Files to the Container:** + - Copy the unzipped plugin files from the host directory to the Docker container: + ```bash + docker compose cp /home/administrator/docker-compose/mybb/plugins/ application:/var/www/html/inc/plugins/ + ``` + - Replace `` with the name of the unzipped plugin folder. + +6. **Restart the Container:** + - Execute the following command to restart the MyBB container: + ```bash + docker-compose -p mybb up -d --force-recreate + ``` + - This ensures all changes take effect. + +7. **Activate Plugins in the MyBB Admin Panel:** + - Open the MyBB admin panel in your web browser. + - Navigate to the plugin settings and activate the newly installed plugins. + +#### Important Notes + +- Ensure you use the correct paths and filenames. +- Do not forget to regularly back up your MyBB database and files before making changes. +- If encountering issues, refer to the MyBB documentation or specific instructions from the plugin author. ### Running the Role Execute the Ansible playbook containing this role to set up MyBB in a Docker environment. diff --git a/roles/docker-mybb/tasks/main.yml b/roles/docker-mybb/tasks/main.yml index 641cdb9a..7b2f348c 100644 --- a/roles/docker-mybb/tasks/main.yml +++ b/roles/docker-mybb/tasks/main.yml @@ -5,17 +5,17 @@ loop_control: loop_var: domain -- name: "create {{conf_d_server_directory}} and parent directories" +- name: "create {{docker_compose_instance_confd_directory}} and parent directories" file: - path: "{{conf_d_server_directory}}" + path: "{{docker_compose_instance_confd_directory}}" state: directory mode: 0755 recurse: yes -- name: "create {{default_conf_server_file}}" +- name: "create {{docker_compose_instance_confd_defaultconf_file}}" template: src: "default.conf" - dest: "{{default_conf_server_file}}" + dest: "{{docker_compose_instance_confd_defaultconf_file}}" notify: recreate mybb - name: add docker-compose.yml diff --git a/roles/docker-mybb/templates/default.conf b/roles/docker-mybb/templates/default.conf index 170581e3..f4b7b1e8 100644 --- a/roles/docker-mybb/templates/default.conf +++ b/roles/docker-mybb/templates/default.conf @@ -7,7 +7,6 @@ server { error_log stderr debug; root /var/www/html; index index.html index.php; - worker_processes auto; location / { try_files $uri $uri/ /index.php?$args; @@ -30,13 +29,6 @@ server { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; - # client timeout - keepalive_timeout 60s; - client_header_timeout 60s; - client_body_timeout 60s; - send_timeout 300s; - reset_timedout_connection on; - # proxy timeouts proxy_connect_timeout 300s; proxy_send_timeout 300s; diff --git a/roles/docker-mybb/templates/docker-compose.yml.j2 b/roles/docker-mybb/templates/docker-compose.yml.j2 index 68aba48c..40a2317c 100644 --- a/roles/docker-mybb/templates/docker-compose.yml.j2 +++ b/roles/docker-mybb/templates/docker-compose.yml.j2 @@ -23,7 +23,7 @@ services: ports: - "127.0.0.1:{{http_port}}:80" volumes: - - "{{conf_d_server_directory}}:{{conf_d_docker_directory}}:ro" + - "{{docker_compose_instance_confd_directory}}:{{target_mount_conf_d_directory}}:ro" - "data:/var/www/html:ro" database: logging: @@ -36,7 +36,7 @@ services: POSTGRES_USER: mybb image: postgres:14-alpine volumes: - - ${PWD}/postgres/data:/var/lib/postgresql/data:rw + - database:/var/lib/postgresql/data:rw restart: always volumes: database: diff --git a/roles/docker-mybb/vars/main.yml b/roles/docker-mybb/vars/main.yml index 36c875b8..0a54dd9e 100644 --- a/roles/docker-mybb/vars/main.yml +++ b/roles/docker-mybb/vars/main.yml @@ -1,5 +1,5 @@ --- -docker_compose_instance_directory: "{{path_docker_compose_files}}mybb/" -conf_d_server_directory: "{{docker_compose_instance_directory}}conf.d/" -default_conf_server_file: "{{conf_d_docker_directory}}default.conf" -conf_d_docker_directory: "/etc/nginx/conf.d/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}mybb/" +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: "/etc/nginx/conf.d/" diff --git a/roles/docker-nextcloud/README.md b/roles/docker-nextcloud/README.md index 27090552..e2fa527c 100644 --- a/roles/docker-nextcloud/README.md +++ b/roles/docker-nextcloud/README.md @@ -57,7 +57,7 @@ and disable the not functioning apps. ## recover latest backup ```bash -cd {{path_docker_compose_files}}nextcloud && +cd {{docker_compose_instances_directory}}nextcloud && docker-compose down && docker-compose exec -i database mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/backup-docker-to-local/latest/nextcloud_database/sql/backup.sql" && cd {{path_administrator_scripts}}backup-docker-to-local && diff --git a/roles/docker-nextcloud/vars/main.yml b/roles/docker-nextcloud/vars/main.yml index 603e4458..d0779010 100644 --- a/roles/docker-nextcloud/vars/main.yml +++ b/roles/docker-nextcloud/vars/main.yml @@ -1,2 +1,2 @@ --- -docker_compose_instance_directory: "{{path_docker_compose_files}}nextcloud/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}nextcloud/" \ No newline at end of file diff --git a/roles/docker-peertube/README.md b/roles/docker-peertube/README.md index 9daf673d..784925ed 100644 --- a/roles/docker-peertube/README.md +++ b/roles/docker-peertube/README.md @@ -7,7 +7,7 @@ watch -n 2 "docker ps -a | grep peertube" ## clean rebuild ```bash -cd {{path_docker_compose_files}}peertube/ && +cd {{docker_compose_instances_directory}}peertube/ && docker-compose down docker volume rm peertube_assets peertube_config peertube_data peertube_database peertube_redis docker-compose up -d diff --git a/roles/docker-peertube/vars/main.yml b/roles/docker-peertube/vars/main.yml index 5c652012..672fbf42 100644 --- a/roles/docker-peertube/vars/main.yml +++ b/roles/docker-peertube/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}peertube/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}peertube/" diff --git a/roles/docker-pixelfed/README.md b/roles/docker-pixelfed/README.md index d4b304ef..cd1bd31e 100644 --- a/roles/docker-pixelfed/README.md +++ b/roles/docker-pixelfed/README.md @@ -49,7 +49,7 @@ docker volume rm pixelfed_application_data pixelfed_database pixelfed_redis_data To update your Pixelfed instance, navigate to the directory where your `docker-compose.yml` file is located and run these commands: ```bash -cd {{path_docker_compose_files}}pixelfed/ && +cd {{docker_compose_instances_directory}}pixelfed/ && docker-compose down && docker network prune -f && docker-compose pull && diff --git a/roles/docker-pixelfed/handlers/main.yml b/roles/docker-pixelfed/handlers/main.yml index 7d828b11..734fbd45 100644 --- a/roles/docker-pixelfed/handlers/main.yml +++ b/roles/docker-pixelfed/handlers/main.yml @@ -2,7 +2,7 @@ - name: recreate pixelfed command: cmd: docker-compose -p pixelfed up -d --force-recreate - chdir: "{{path_docker_compose_files}}pixelfed/" + chdir: "{{docker_compose_instances_directory}}pixelfed/" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-pixelfed/vars/main.yml b/roles/docker-pixelfed/vars/main.yml index 64128963..8401f979 100644 --- a/roles/docker-pixelfed/vars/main.yml +++ b/roles/docker-pixelfed/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}pixelfed/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}pixelfed/" client_max_body_size: "512M" diff --git a/roles/docker-roulette-wheel/vars/main.yml b/roles/docker-roulette-wheel/vars/main.yml index ab0e3aac..8db7cdee 100644 --- a/roles/docker-roulette-wheel/vars/main.yml +++ b/roles/docker-roulette-wheel/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}roulette-wheel/" -app_path: "{{path_docker_compose_files}}roulette-wheel/app/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}roulette-wheel/" +app_path: "{{docker_compose_instances_directory}}roulette-wheel/app/" \ No newline at end of file diff --git a/roles/docker-wordpress/vars/main.yml b/roles/docker-wordpress/vars/main.yml index 21e4e324..50b25d30 100644 --- a/roles/docker-wordpress/vars/main.yml +++ b/roles/docker-wordpress/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}wordpress/" +docker_compose_instance_directory: "{{docker_compose_instances_directory}}wordpress/" wordpress_max_upload_size: "64M" diff --git a/roles/docker-yourls/vars/main.yml b/roles/docker-yourls/vars/main.yml index dbaf8c01..f8d09cad 100644 --- a/roles/docker-yourls/vars/main.yml +++ b/roles/docker-yourls/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{path_docker_compose_files}}yourls/" \ No newline at end of file +docker_compose_instance_directory: "{{docker_compose_instances_directory}}yourls/" \ No newline at end of file diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index f5936a39..0ab1c2bb 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -6,9 +6,9 @@ state: present notify: docker restart -- name: "create {{path_docker_compose_files}}" +- name: "create {{docker_compose_instances_directory}}" file: - path: "{{path_docker_compose_files}}" + path: "{{docker_compose_instances_directory}}" state: directory mode: 0700 owner: administrator diff --git a/roles/update-docker/templates/update-docker.service.j2 b/roles/update-docker/templates/update-docker.service.j2 index 3e438cc0..4c1d19d5 100644 --- a/roles/update-docker/templates/update-docker.service.j2 +++ b/roles/update-docker/templates/update-docker.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_files}}' \ No newline at end of file +ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{docker_compose_instances_directory}}' \ No newline at end of file diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml index 8b12836b..7c414087 100644 --- a/roles/update/tasks/main.yml +++ b/roles/update/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: "Check if {{ path_docker_compose_files }} directory exists" +- name: "Check if {{ docker_compose_instances_directory }} directory exists" stat: - path: "{{ path_docker_compose_files }}" + path: "{{ docker_compose_instances_directory }}" register: docker_compose_directory_stat - name: "Update with pacman" From 3721e9e0ad1cb0c4f227a1561a41de49cb615140 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 7 Dec 2023 16:56:43 +0100 Subject: [PATCH 3/6] renamed variable --- group_vars/all | 2 +- roles/docker-akaunting/README.md | 2 +- roles/docker-akaunting/vars/main.yml | 2 +- roles/docker-attendize/vars/main.yml | 2 +- roles/docker-baserow/handlers/main.yml | 2 +- roles/docker-baserow/vars/main.yml | 2 +- roles/docker-bigbluebutton/vars/main.yml | 2 +- roles/docker-funkwhale/vars/main.yml | 2 +- roles/docker-gitea/vars/main.yml | 2 +- roles/docker-joomla/vars/main.yml | 2 +- roles/docker-listmonk/handlers/main.yml | 2 +- roles/docker-listmonk/vars/main.yml | 2 +- roles/docker-mailu/tasks/main.yml | 4 ++-- roles/docker-mailu/vars/main.yml | 2 +- roles/docker-mastodon/README.md | 6 +++--- roles/docker-mastodon/vars/main.yml | 2 +- roles/docker-matomo/README.md | 2 +- roles/docker-matomo/vars/main.yml | 2 +- roles/docker-mybb/vars/main.yml | 2 +- roles/docker-nextcloud/README.md | 2 +- roles/docker-nextcloud/vars/main.yml | 2 +- roles/docker-peertube/README.md | 2 +- roles/docker-peertube/vars/main.yml | 2 +- roles/docker-pixelfed/README.md | 2 +- roles/docker-pixelfed/handlers/main.yml | 2 +- roles/docker-pixelfed/vars/main.yml | 2 +- roles/docker-roulette-wheel/vars/main.yml | 4 ++-- roles/docker-wordpress/vars/main.yml | 2 +- roles/docker-yourls/vars/main.yml | 2 +- roles/docker/tasks/main.yml | 4 ++-- roles/update-docker/templates/update-docker.service.j2 | 2 +- roles/update/tasks/main.yml | 4 ++-- 32 files changed, 38 insertions(+), 38 deletions(-) diff --git a/group_vars/all b/group_vars/all index d86e4af8..44605668 100644 --- a/group_vars/all +++ b/group_vars/all @@ -29,7 +29,7 @@ size_percent_cleanup_disc_space: 90 path_administrator_home: "/home/administrator/" path_administrator_scripts: "{{path_administrator_home}}scripts/" path_docker_volumes: "{{path_administrator_home}}volumes/docker/" -docker_compose_instances_directory: "{{path_administrator_home}}docker-compose/" +path_docker_compose_instances: "{{path_administrator_home}}docker-compose/" # Runtime Variables activate_all_timers (bool): false # Activates all timers, independend if the handlers had been triggered diff --git a/roles/docker-akaunting/README.md b/roles/docker-akaunting/README.md index 6ef7e5cd..14fab794 100644 --- a/roles/docker-akaunting/README.md +++ b/roles/docker-akaunting/README.md @@ -19,7 +19,7 @@ Due to license issues, bugs and that in the past after an akaunting update your 1. **Navigate to Docker Compose Directory**: Change to the directory containing your Docker Compose files for Akaunting. ```bash - cd {{docker_compose_instances_directory}}akaunting/ + cd {{path_docker_compose_instances}}akaunting/ ``` 2. **Set Environment Variables**: These are necessary to prevent timeouts during long operations. diff --git a/roles/docker-akaunting/vars/main.yml b/roles/docker-akaunting/vars/main.yml index 06efb319..4644f7d3 100644 --- a/roles/docker-akaunting/vars/main.yml +++ b/roles/docker-akaunting/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}akaunting/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}akaunting/" diff --git a/roles/docker-attendize/vars/main.yml b/roles/docker-attendize/vars/main.yml index 741d1608..e3e8c7cb 100644 --- a/roles/docker-attendize/vars/main.yml +++ b/roles/docker-attendize/vars/main.yml @@ -1,3 +1,3 @@ --- -docker_compose_instance_directory: "{{docker_compose_instances_directory}}attendize/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}attendize/" mail_interface_domain: "mail.{{domain}}" diff --git a/roles/docker-baserow/handlers/main.yml b/roles/docker-baserow/handlers/main.yml index 3e37556d..c508f4ef 100644 --- a/roles/docker-baserow/handlers/main.yml +++ b/roles/docker-baserow/handlers/main.yml @@ -2,7 +2,7 @@ - name: recreate baserow command: cmd: docker-compose -p baserow up -d --force-recreate - chdir: "{{docker_compose_instances_directory}}baserow/" + chdir: "{{path_docker_compose_instances}}baserow/" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-baserow/vars/main.yml b/roles/docker-baserow/vars/main.yml index 9c98e0d7..eb1c8010 100644 --- a/roles/docker-baserow/vars/main.yml +++ b/roles/docker-baserow/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}baserow/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}baserow/" \ No newline at end of file diff --git a/roles/docker-bigbluebutton/vars/main.yml b/roles/docker-bigbluebutton/vars/main.yml index edafc84f..9b40ea81 100644 --- a/roles/docker-bigbluebutton/vars/main.yml +++ b/roles/docker-bigbluebutton/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}bigbluebutton/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}bigbluebutton/" \ No newline at end of file diff --git a/roles/docker-funkwhale/vars/main.yml b/roles/docker-funkwhale/vars/main.yml index b65f6013..fe67f9b4 100644 --- a/roles/docker-funkwhale/vars/main.yml +++ b/roles/docker-funkwhale/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}funkwhale/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}funkwhale/" client_max_body_size: "512M" diff --git a/roles/docker-gitea/vars/main.yml b/roles/docker-gitea/vars/main.yml index 1e663c61..a029ab64 100644 --- a/roles/docker-gitea/vars/main.yml +++ b/roles/docker-gitea/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}gitea/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}gitea/" diff --git a/roles/docker-joomla/vars/main.yml b/roles/docker-joomla/vars/main.yml index 30a906ea..49af5787 100644 --- a/roles/docker-joomla/vars/main.yml +++ b/roles/docker-joomla/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}joomla/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}joomla/" diff --git a/roles/docker-listmonk/handlers/main.yml b/roles/docker-listmonk/handlers/main.yml index 286bef09..747b0bc5 100644 --- a/roles/docker-listmonk/handlers/main.yml +++ b/roles/docker-listmonk/handlers/main.yml @@ -2,7 +2,7 @@ - name: recreate listmonk command: cmd: docker-compose -p listmonk up -d --force-recreate - chdir: "{{docker_compose_instances_directory}}listmonk/" + chdir: "{{path_docker_compose_instances}}listmonk/" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-listmonk/vars/main.yml b/roles/docker-listmonk/vars/main.yml index ef1a09a8..75a5cf4f 100644 --- a/roles/docker-listmonk/vars/main.yml +++ b/roles/docker-listmonk/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}listmonk/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}listmonk/" diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index fe93dd73..26fedd3f 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -4,9 +4,9 @@ vars: client_max_body_size: "31M" -- name: "create {{docker_compose_instances_directory}}mailu" +- name: "create {{path_docker_compose_instances}}mailu" file: - path: "{{docker_compose_instances_directory}}mailu" + path: "{{path_docker_compose_instances}}mailu" state: directory mode: 0755 diff --git a/roles/docker-mailu/vars/main.yml b/roles/docker-mailu/vars/main.yml index 85d5c496..27b1f5a5 100644 --- a/roles/docker-mailu/vars/main.yml +++ b/roles/docker-mailu/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}mailu/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}mailu/" \ No newline at end of file diff --git a/roles/docker-mastodon/README.md b/roles/docker-mastodon/README.md index d2b4b113..2d1dd775 100644 --- a/roles/docker-mastodon/README.md +++ b/roles/docker-mastodon/README.md @@ -5,11 +5,11 @@ ``` ## cleanup ```bash -cd {{docker_compose_instances_directory}}mastodon/ +cd {{path_docker_compose_instances}}mastodon/ docker-compose down docker volume rm mastodon_data mastodon_database mastodon_redis -cd {{docker_compose_instances_directory}} && -rm -vR {{docker_compose_instances_directory}}mastodon +cd {{path_docker_compose_instances}} && +rm -vR {{path_docker_compose_instances}}mastodon ``` ## access terminal diff --git a/roles/docker-mastodon/vars/main.yml b/roles/docker-mastodon/vars/main.yml index d6893ba3..4ccb7d3e 100644 --- a/roles/docker-mastodon/vars/main.yml +++ b/roles/docker-mastodon/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}mastodon/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}mastodon/" diff --git a/roles/docker-matomo/README.md b/roles/docker-matomo/README.md index efac16f7..8e2df4d2 100644 --- a/roles/docker-matomo/README.md +++ b/roles/docker-matomo/README.md @@ -12,7 +12,7 @@ This Ansible role deploys a Matomo analytics platform instance using Docker. - `domain`: The domain where Matomo will be accessible. - `administrator_email`: The email used for SSL certificate registration. -- `docker_compose_instances_directory`: Path to store Docker Compose files. +- `path_docker_compose_instances`: Path to store Docker Compose files. - `http_port`: The host port that Matomo will be accessible on. - `matomo_database_password`: Password for the Matomo database. diff --git a/roles/docker-matomo/vars/main.yml b/roles/docker-matomo/vars/main.yml index 6e3581df..3adfaaad 100644 --- a/roles/docker-matomo/vars/main.yml +++ b/roles/docker-matomo/vars/main.yml @@ -1,2 +1,2 @@ --- -docker_compose_instance_directory: "{{docker_compose_instances_directory}}matomo/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}matomo/" \ No newline at end of file diff --git a/roles/docker-mybb/vars/main.yml b/roles/docker-mybb/vars/main.yml index 0a54dd9e..02445e66 100644 --- a/roles/docker-mybb/vars/main.yml +++ b/roles/docker-mybb/vars/main.yml @@ -1,5 +1,5 @@ --- -docker_compose_instance_directory: "{{docker_compose_instances_directory}}mybb/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}mybb/" 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: "/etc/nginx/conf.d/" diff --git a/roles/docker-nextcloud/README.md b/roles/docker-nextcloud/README.md index e2fa527c..2bb8edb2 100644 --- a/roles/docker-nextcloud/README.md +++ b/roles/docker-nextcloud/README.md @@ -57,7 +57,7 @@ and disable the not functioning apps. ## recover latest backup ```bash -cd {{docker_compose_instances_directory}}nextcloud && +cd {{path_docker_compose_instances}}nextcloud && docker-compose down && docker-compose exec -i database mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/backup-docker-to-local/latest/nextcloud_database/sql/backup.sql" && cd {{path_administrator_scripts}}backup-docker-to-local && diff --git a/roles/docker-nextcloud/vars/main.yml b/roles/docker-nextcloud/vars/main.yml index d0779010..7b09fc97 100644 --- a/roles/docker-nextcloud/vars/main.yml +++ b/roles/docker-nextcloud/vars/main.yml @@ -1,2 +1,2 @@ --- -docker_compose_instance_directory: "{{docker_compose_instances_directory}}nextcloud/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}nextcloud/" \ No newline at end of file diff --git a/roles/docker-peertube/README.md b/roles/docker-peertube/README.md index 784925ed..8e5f840e 100644 --- a/roles/docker-peertube/README.md +++ b/roles/docker-peertube/README.md @@ -7,7 +7,7 @@ watch -n 2 "docker ps -a | grep peertube" ## clean rebuild ```bash -cd {{docker_compose_instances_directory}}peertube/ && +cd {{path_docker_compose_instances}}peertube/ && docker-compose down docker volume rm peertube_assets peertube_config peertube_data peertube_database peertube_redis docker-compose up -d diff --git a/roles/docker-peertube/vars/main.yml b/roles/docker-peertube/vars/main.yml index 672fbf42..2eec12de 100644 --- a/roles/docker-peertube/vars/main.yml +++ b/roles/docker-peertube/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}peertube/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}peertube/" diff --git a/roles/docker-pixelfed/README.md b/roles/docker-pixelfed/README.md index cd1bd31e..dee4be76 100644 --- a/roles/docker-pixelfed/README.md +++ b/roles/docker-pixelfed/README.md @@ -49,7 +49,7 @@ docker volume rm pixelfed_application_data pixelfed_database pixelfed_redis_data To update your Pixelfed instance, navigate to the directory where your `docker-compose.yml` file is located and run these commands: ```bash -cd {{docker_compose_instances_directory}}pixelfed/ && +cd {{path_docker_compose_instances}}pixelfed/ && docker-compose down && docker network prune -f && docker-compose pull && diff --git a/roles/docker-pixelfed/handlers/main.yml b/roles/docker-pixelfed/handlers/main.yml index 734fbd45..f2c134e8 100644 --- a/roles/docker-pixelfed/handlers/main.yml +++ b/roles/docker-pixelfed/handlers/main.yml @@ -2,7 +2,7 @@ - name: recreate pixelfed command: cmd: docker-compose -p pixelfed up -d --force-recreate - chdir: "{{docker_compose_instances_directory}}pixelfed/" + chdir: "{{path_docker_compose_instances}}pixelfed/" environment: COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 diff --git a/roles/docker-pixelfed/vars/main.yml b/roles/docker-pixelfed/vars/main.yml index 8401f979..976ab2df 100644 --- a/roles/docker-pixelfed/vars/main.yml +++ b/roles/docker-pixelfed/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}pixelfed/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}pixelfed/" client_max_body_size: "512M" diff --git a/roles/docker-roulette-wheel/vars/main.yml b/roles/docker-roulette-wheel/vars/main.yml index 8db7cdee..f081efb9 100644 --- a/roles/docker-roulette-wheel/vars/main.yml +++ b/roles/docker-roulette-wheel/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}roulette-wheel/" -app_path: "{{docker_compose_instances_directory}}roulette-wheel/app/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}roulette-wheel/" +app_path: "{{path_docker_compose_instances}}roulette-wheel/app/" \ No newline at end of file diff --git a/roles/docker-wordpress/vars/main.yml b/roles/docker-wordpress/vars/main.yml index 50b25d30..61f40599 100644 --- a/roles/docker-wordpress/vars/main.yml +++ b/roles/docker-wordpress/vars/main.yml @@ -1,2 +1,2 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}wordpress/" +docker_compose_instance_directory: "{{path_docker_compose_instances}}wordpress/" wordpress_max_upload_size: "64M" diff --git a/roles/docker-yourls/vars/main.yml b/roles/docker-yourls/vars/main.yml index f8d09cad..02676317 100644 --- a/roles/docker-yourls/vars/main.yml +++ b/roles/docker-yourls/vars/main.yml @@ -1 +1 @@ -docker_compose_instance_directory: "{{docker_compose_instances_directory}}yourls/" \ No newline at end of file +docker_compose_instance_directory: "{{path_docker_compose_instances}}yourls/" \ No newline at end of file diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 0ab1c2bb..159f0a63 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -6,9 +6,9 @@ state: present notify: docker restart -- name: "create {{docker_compose_instances_directory}}" +- name: "create {{path_docker_compose_instances}}" file: - path: "{{docker_compose_instances_directory}}" + path: "{{path_docker_compose_instances}}" state: directory mode: 0700 owner: administrator diff --git a/roles/update-docker/templates/update-docker.service.j2 b/roles/update-docker/templates/update-docker.service.j2 index 4c1d19d5..cbc1ba8c 100644 --- a/roles/update-docker/templates/update-docker.service.j2 +++ b/roles/update-docker/templates/update-docker.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{docker_compose_instances_directory}}' \ No newline at end of file +ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}}' \ No newline at end of file diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml index 7c414087..51a33951 100644 --- a/roles/update/tasks/main.yml +++ b/roles/update/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: "Check if {{ docker_compose_instances_directory }} directory exists" +- name: "Check if {{ path_docker_compose_instances }} directory exists" stat: - path: "{{ docker_compose_instances_directory }}" + path: "{{ path_docker_compose_instances }}" register: docker_compose_directory_stat - name: "Update with pacman" From f3aa6eba51530f0415de62050cfef22f6cb3244c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 7 Dec 2023 18:54:47 +0100 Subject: [PATCH 4/6] implemented multiple domain string substitution for mybb --- roles/docker-funkwhale/vars/main.yml | 2 +- roles/docker-mailu/tasks/main.yml | 2 +- roles/docker-mybb/README.md | 19 ++++++------------- roles/docker-mybb/tasks/main.yml | 6 +++--- roles/docker-mybb/tasks/mybb-proxy-domain.yml | 7 +++++++ roles/docker-mybb/vars/main.yml | 1 + roles/docker-pixelfed/vars/main.yml | 2 +- roles/docker-wordpress/tasks/main.yml | 2 +- .../templates/domain.conf.j2 | 7 ++++--- 9 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 roles/docker-mybb/tasks/mybb-proxy-domain.yml diff --git a/roles/docker-funkwhale/vars/main.yml b/roles/docker-funkwhale/vars/main.yml index fe67f9b4..95783741 100644 --- a/roles/docker-funkwhale/vars/main.yml +++ b/roles/docker-funkwhale/vars/main.yml @@ -1,2 +1,2 @@ docker_compose_instance_directory: "{{path_docker_compose_instances}}funkwhale/" -client_max_body_size: "512M" +nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" diff --git a/roles/docker-mailu/tasks/main.yml b/roles/docker-mailu/tasks/main.yml index 26fedd3f..f7a710e8 100644 --- a/roles/docker-mailu/tasks/main.yml +++ b/roles/docker-mailu/tasks/main.yml @@ -2,7 +2,7 @@ - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml vars: - client_max_body_size: "31M" + nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 31M;" - name: "create {{path_docker_compose_instances}}mailu" file: diff --git a/roles/docker-mybb/README.md b/roles/docker-mybb/README.md index 8d2f6bdd..e4ec6fc7 100644 --- a/roles/docker-mybb/README.md +++ b/roles/docker-mybb/README.md @@ -3,21 +3,14 @@ ## Dependencies - nginx-docker-reverse-proxy -## Variables -- `docker_compose_instance_directory`: The directory where Docker Compose files for MyBB are stored. -- `target_mount_conf_d_directory`: Directory for Docker Nginx configuration. -- `default_conf_docker_file`: The default Nginx configuration file for the server. -- `docker_compose_instance_confd_directory`: The Nginx server's configuration directory. - -## Tasks -1. **Domain Certificate Retrieval:** Automates the process of obtaining SSL certificates for the specified domain using Certbot. -2. **Nginx Configuration:** Handles the configuration of Nginx for the MyBB domain. -3. **Directory Creation:** Ensures the creation of necessary directories including parent directories as required. -4. **MyBB and Nginx Configuration:** Manages the configuration for MyBB and Nginx, including setting up the `default.conf` file. -5. **Docker Compose Setup:** Adds and manages the `docker-compose.yml` file necessary for running MyBB with Docker. - ## Usage +### Multi Domain Installation +If you want to access your mybb over multiple domains, keep the following in mind: +- Set Cookie Domain to nothing +- Access mybb for installation via mybb. +- Set the Board Url to mybb. + ### Manual Installation of MyBB Plugins This guide describes the process of manually installing MyBB plugins in your Docker-MyBB environment. This can be useful if you want to quickly test plugins or do not wish to execute the Ansible role. diff --git a/roles/docker-mybb/tasks/main.yml b/roles/docker-mybb/tasks/main.yml index 7b2f348c..924361e1 100644 --- a/roles/docker-mybb/tasks/main.yml +++ b/roles/docker-mybb/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: "include tasks nginx-docker-proxy-domain.yml" - include_tasks: nginx-docker-proxy-domain.yml - loop: "{{ domains }}" +- name: "include tasks mybb-proxy-domain.yml" + include_tasks: mybb-proxy-domain.yml + loop: "{{ domains + [mybb_main_domain] }}" loop_control: loop_var: domain diff --git a/roles/docker-mybb/tasks/mybb-proxy-domain.yml b/roles/docker-mybb/tasks/mybb-proxy-domain.yml new file mode 100644 index 00000000..547dc771 --- /dev/null +++ b/roles/docker-mybb/tasks/mybb-proxy-domain.yml @@ -0,0 +1,7 @@ +- name: "include task certbot-matomo.yml" + include_tasks: certbot-matomo.yml + +- name: "include task create-domain-conf.yml" + include_tasks: create-domain-conf.yml + vars: + nginx_docker_reverse_proxy_extra_configuration: "sub_filter '{{mybb_main_domain}}' '{{domain}}';" diff --git a/roles/docker-mybb/vars/main.yml b/roles/docker-mybb/vars/main.yml index 02445e66..7a71791c 100644 --- a/roles/docker-mybb/vars/main.yml +++ b/roles/docker-mybb/vars/main.yml @@ -3,3 +3,4 @@ docker_compose_instance_directory: "{{path_docker_compose_instances}}mybb/" 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: "/etc/nginx/conf.d/" +mybb_main_domain: "mybb.{{top_domain}}" diff --git a/roles/docker-pixelfed/vars/main.yml b/roles/docker-pixelfed/vars/main.yml index 976ab2df..18e0fd57 100644 --- a/roles/docker-pixelfed/vars/main.yml +++ b/roles/docker-pixelfed/vars/main.yml @@ -1,2 +1,2 @@ docker_compose_instance_directory: "{{path_docker_compose_instances}}pixelfed/" -client_max_body_size: "512M" +nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" diff --git a/roles/docker-wordpress/tasks/main.yml b/roles/docker-wordpress/tasks/main.yml index 8969a183..f9738e7a 100644 --- a/roles/docker-wordpress/tasks/main.yml +++ b/roles/docker-wordpress/tasks/main.yml @@ -6,7 +6,7 @@ loop_control: loop_var: domain vars: - client_max_body_size: "{{wordpress_max_upload_size}}" + nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size {{wordpress_max_upload_size}};" - name: "create {{docker_compose_instance_directory}}" file: diff --git a/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 b/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 index e69f4226..a160264b 100644 --- a/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 +++ b/roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 @@ -2,13 +2,14 @@ server { server_name {{domain}}; + # Include Matomo Tracking Code {% if nginx_matomo_tracking_active | default(False) %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% endif %} - - {% if client_max_body_size is defined %} - client_max_body_size {{ client_max_body_size }}; + # Additional Domain Specific Configuration + {% if nginx_docker_reverse_proxy_extra_configuration is defined %} + {{nginx_docker_reverse_proxy_extra_configuration}} {% endif %} {% include 'roles/letsencrypt/templates/ssl_header.j2' %} From 1d887d3278ec6d3b22341042f1cc802a6d5bbf20 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 8 Dec 2023 00:34:48 +0100 Subject: [PATCH 5/6] implemented discourse draft --- playbook-servers.yml | 9 ++ roles/docker-discourse/README.md | 0 roles/docker-discourse/handlers/main.yml | 12 ++ roles/docker-discourse/meta/main.yml | 2 + roles/docker-discourse/tasks/main.yml | 53 +++++++++ roles/docker-discourse/templates/app.yml.j2 | 109 ++++++++++++++++++ .../templates/docker-compose.yml.j2 | 34 ++++++ roles/docker-discourse/vars/main.yml | 1 + 8 files changed, 220 insertions(+) create mode 100644 roles/docker-discourse/README.md create mode 100644 roles/docker-discourse/handlers/main.yml create mode 100644 roles/docker-discourse/meta/main.yml create mode 100644 roles/docker-discourse/tasks/main.yml create mode 100644 roles/docker-discourse/templates/app.yml.j2 create mode 100644 roles/docker-discourse/templates/docker-compose.yml.j2 create mode 100644 roles/docker-discourse/vars/main.yml diff --git a/playbook-servers.yml b/playbook-servers.yml index 59b1eb67..a6b99990 100644 --- a/playbook-servers.yml +++ b/playbook-servers.yml @@ -202,6 +202,15 @@ domain: listmonk.{{top_domain}} http_port: 8019 +- name: setup discourse + hosts: discourse + become: true + roles: + - role: docker-discourse + vars: + domain: discourse.{{top_domain}} + http_port: 8020 + - name: setup akaunting hosts hosts: akaunting become: true diff --git a/roles/docker-discourse/README.md b/roles/docker-discourse/README.md new file mode 100644 index 00000000..e69de29b diff --git a/roles/docker-discourse/handlers/main.yml b/roles/docker-discourse/handlers/main.yml new file mode 100644 index 00000000..b9d8cc4e --- /dev/null +++ b/roles/docker-discourse/handlers/main.yml @@ -0,0 +1,12 @@ +--- +#- name: recreate discourse +# command: +# cmd: docker-compose up -d --force-recreate +# chdir: "{{docker_compose_instance_directory}}" +# environment: +# COMPOSE_HTTP_TIMEOUT: 600 +# DOCKER_CLIENT_TIMEOUT: 600 +- name: recreate discourse + command: + cmd: ./launcher rebuild app + chdir: "{{docker_compose_instance_directory}}" diff --git a/roles/docker-discourse/meta/main.yml b/roles/docker-discourse/meta/main.yml new file mode 100644 index 00000000..d3606e63 --- /dev/null +++ b/roles/docker-discourse/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: +- nginx-docker-reverse-proxy diff --git a/roles/docker-discourse/tasks/main.yml b/roles/docker-discourse/tasks/main.yml new file mode 100644 index 00000000..c047f7db --- /dev/null +++ b/roles/docker-discourse/tasks/main.yml @@ -0,0 +1,53 @@ +--- +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml + +- name: "create {{docker_compose_instance_directory}}" + file: + path: "{{docker_compose_instance_directory}}" + state: directory + mode: 0755 + +#- name: add docker-compose.yml +# template: src=docker-compose.yml.j2 dest={{docker_compose_instance_directory}}docker-compose.yml +# notify: recreate discourse + +- name: register directory + stat: + path: "{{docker_compose_instance_directory}}" + register: docker_compose_instance_directory_register + +- name: checkout repository + ansible.builtin.shell: git checkout . + become: true + args: + chdir: "{{docker_compose_instance_directory}}" + when: docker_compose_instance_directory_register.stat.exists + +- name: pull docker repository + git: + repo: "https://github.com/discourse/discourse_docker.git" + dest: "{{docker_compose_instance_directory}}" + update: yes + notify: recreate discourse + become: true + register: git_result + ignore_errors: true + +- name: Warn if repo is not reachable + debug: + msg: "Warning: Repository is not reachable." + when: git_result.failed + +- name: set chmod 700 for {{docker_compose_instance_directory}}/containers + ansible.builtin.file: + path: "{{docker_compose_instance_directory}}/containers" + mode: '700' + state: directory + +- name: copy configuration + template: + src: app.yml.j2 + dest: "{{docker_compose_instance_directory}}/containers/app.yml" + force: no + notify: recreate discourse \ No newline at end of file diff --git a/roles/docker-discourse/templates/app.yml.j2 b/roles/docker-discourse/templates/app.yml.j2 new file mode 100644 index 00000000..7a97751d --- /dev/null +++ b/roles/docker-discourse/templates/app.yml.j2 @@ -0,0 +1,109 @@ +## this is the all-in-one, standalone Discourse Docker container template +## +## After making changes to this file, you MUST rebuild +## /var/discourse/launcher rebuild app +## +## BE *VERY* CAREFUL WHEN EDITING! +## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT! +## visit http://www.yamllint.com/ to validate this file as needed + +templates: + - "templates/postgres.template.yml" + - "templates/redis.template.yml" + - "templates/web.template.yml" + ## Uncomment the next line to enable the IPv6 listener + #- "templates/web.ipv6.template.yml" + - "templates/web.ratelimited.template.yml" + ## Uncomment these two lines if you wish to add Lets Encrypt (https) + #- "templates/web.ssl.template.yml" + #- "templates/web.letsencrypt.ssl.template.yml" + +## which TCP/IP ports should this container expose? +## If you want Discourse to share a port with another webserver like Apache or nginx, +## see https://meta.discourse.org/t/17247 for details +expose: + - "127.0.0.1:{{http_port}}:80" # http + #- "443:443" # https + +params: + db_default_text_search_config: "pg_catalog.english" + + ## Set db_shared_buffers to a max of 25% of the total memory. + ## will be set automatically by bootstrap based on detected RAM, or you can override + db_shared_buffers: "4096MB" + + ## can improve sorting performance, but adds memory usage per-connection + #db_work_mem: "40MB" + + ## Which Git revision should this container use? (default: tests-passed) + #version: tests-passed + +env: + LC_ALL: en_US.UTF-8 + LANG: en_US.UTF-8 + LANGUAGE: en_US.UTF-8 + # DISCOURSE_DEFAULT_LOCALE: en + + ## How many concurrent web requests are supported? Depends on memory and CPU cores. + ## will be set automatically by bootstrap based on detected CPUs, or you can override + UNICORN_WORKERS: 8 + + ## TODO: The domain name this Discourse instance will respond to + ## Required. Discourse will not work with a bare IP number. + DISCOURSE_HOSTNAME: localhost + + ## Uncomment if you want the container to be started with the same + ## hostname (-h option) as specified above (default "$hostname-$config") + #DOCKER_USE_HOSTNAME: true + + ## TODO: List of comma delimited emails that will be made admin and developer + ## on initial signup example 'user1@example.com,user2@example.com' + DISCOURSE_DEVELOPER_EMAILS: {{administrator_email}} + + ## 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_domain}} + DISCOURSE_SMTP_PORT: 587 + DISCOURSE_SMTP_USER_NAME: {{system_email}} + DISCOURSE_SMTP_PASSWORD: {{system_email_password}} + DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true) + DISCOURSE_SMTP_DOMAIN: {{system_email_domain}} + DISCOURSE_NOTIFICATION_EMAIL: {{system_email}} + + ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate + #LETSENCRYPT_ACCOUNT_EMAIL: administrator@veen.world + + ## The http or https CDN address for this Discourse instance (configured to pull) + ## see https://meta.discourse.org/t/14857 for details + #DISCOURSE_CDN_URL: https://discourse-cdn.example.com + + ## The maxmind geolocation IP address key for IP address lookup + ## see https://meta.discourse.org/t/-/137387/23 for details + #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456 + +## The Docker container is stateless; all data is stored in /shared +volumes: + - volume: + host: /var/discourse/shared/standalone + guest: /shared + - volume: + host: /var/discourse/shared/standalone/log/var-log + guest: /var/log + +## Plugins go here +## see https://meta.discourse.org/t/19157 for details +hooks: + after_code: + - exec: + cd: $home/plugins + cmd: + - git clone https://github.com/discourse/docker_manager.git + +## Any custom commands to run after building +run: + - exec: echo "Beginning of custom commands" + ## If you want to set the 'From' email address for your first registration, uncomment and change: + ## After getting the first signup email, re-comment the line. It only needs to run once. + #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'" + - exec: echo "End of custom commands" diff --git a/roles/docker-discourse/templates/docker-compose.yml.j2 b/roles/docker-discourse/templates/docker-compose.yml.j2 new file mode 100644 index 00000000..d0fe2d93 --- /dev/null +++ b/roles/docker-discourse/templates/docker-compose.yml.j2 @@ -0,0 +1,34 @@ +version: '3' + +services: + discourse: + image: discourse/base:release + depends_on: + - database + - redis + volumes: + - data:/shared + environment: + DISCOURSE_DB_HOST: database + DISCOURSE_DB_NAME: discourse + DISCOURSE_DB_USERNAME: discourse + DISCOURSE_DB_PASSWORD: {{discourse_database_password}} + DISCOURSE_REDIS_HOST: redis + ports: + - "127.0.0.1:{{http_port}}:80" + database: + image: postgres:latest + environment: + POSTGRES_DB: discourse + POSTGRES_USER: discourse + POSTGRES_PASSWORD: {{discourse_database_password}} + volumes: + - database:/var/lib/postgresql/data + redis: + image: redis:latest + volumes: + - redis_data:/data +volumes: + database: + data: + redis_data: \ No newline at end of file diff --git a/roles/docker-discourse/vars/main.yml b/roles/docker-discourse/vars/main.yml new file mode 100644 index 00000000..024b3cfb --- /dev/null +++ b/roles/docker-discourse/vars/main.yml @@ -0,0 +1 @@ +docker_compose_instance_directory: "{{path_docker_compose_instances}}discourse/" From 1552e62ea2f1fd47e6ae1b7788567a4cbf0fc709 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 8 Dec 2023 01:01:18 +0100 Subject: [PATCH 6/6] solved bug --- roles/docker-discourse/tasks/main.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/roles/docker-discourse/tasks/main.yml b/roles/docker-discourse/tasks/main.yml index c047f7db..e0081785 100644 --- a/roles/docker-discourse/tasks/main.yml +++ b/roles/docker-discourse/tasks/main.yml @@ -39,15 +39,14 @@ msg: "Warning: Repository is not reachable." when: git_result.failed -- name: set chmod 700 for {{docker_compose_instance_directory}}/containers +- name: set chmod 700 for {{docker_compose_instance_directory}}containers ansible.builtin.file: path: "{{docker_compose_instance_directory}}/containers" mode: '700' state: directory -- name: copy configuration +- name: "copy configuration {{docker_compose_instance_directory}}containers/app.yml" template: src: app.yml.j2 - dest: "{{docker_compose_instance_directory}}/containers/app.yml" - force: no + dest: "{{docker_compose_instance_directory}}containers/app.yml" notify: recreate discourse \ No newline at end of file