From e98d18f3690268696d4006b2bae489ba7da418db Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 5 Feb 2025 02:09:42 +0100 Subject: [PATCH] Solved taiga bug and adapted it to new database layout --- roles/docker-taiga/tasks/main.yml | 34 ++++++-- roles/docker-taiga/templates/.env.j2 | 35 --------- .../templates/docker-compose-inits.yml.j2 | 40 ++-------- .../templates/docker-compose.yml.j2 | 78 +++---------------- roles/docker-taiga/templates/env.j2 | 44 +++++++++++ roles/docker-taiga/vars/main.yml | 10 ++- 6 files changed, 94 insertions(+), 147 deletions(-) delete mode 100644 roles/docker-taiga/templates/.env.j2 create mode 100644 roles/docker-taiga/templates/env.j2 diff --git a/roles/docker-taiga/tasks/main.yml b/roles/docker-taiga/tasks/main.yml index 55f8edc7..c3cc5ec5 100644 --- a/roles/docker-taiga/tasks/main.yml +++ b/roles/docker-taiga/tasks/main.yml @@ -6,10 +6,30 @@ - name: "include tasks nginx-docker-proxy-domain.yml" include_tasks: nginx-docker-proxy-domain.yml -- name: "include tasks update-repository-with-files.yml" - include_tasks: update-repository-with-files.yml - vars: - detached_files: - - "{{docker_compose.directories.env}}env" - - "{{docker_compose.directories.instance}}docker-compose.yml" - - "{{docker_compose.directories.instance}}docker-compose-inits.yml" +- name: pull docker repository + git: + repo: "{{ repository_address }}" + dest: "{{ docker_compose.directories.services }}" + update: yes + notify: docker compose project setup + become: true + +- name: "create {{docker_compose_init}}" + template: + src: "docker-compose-inits.yml.j2" + dest: "{{docker_compose_init}}" + notify: docker compose project setup + +- name: "create {{docker_compose.files.docker_compose}}" + template: + src: "docker-compose.yml.j2" + dest: "{{docker_compose.files.docker_compose}}" + notify: docker compose project setup + +- name: "create {{docker_compose.files.env}}" + template: + src: "env.j2" + dest: "{{docker_compose.files.env}}" + mode: '770' + force: yes + notify: docker compose project setup diff --git a/roles/docker-taiga/templates/.env.j2 b/roles/docker-taiga/templates/.env.j2 deleted file mode 100644 index a3b04e26..00000000 --- a/roles/docker-taiga/templates/.env.j2 +++ /dev/null @@ -1,35 +0,0 @@ -# Taiga's URLs - Variables to define where Taiga should be served -TAIGA_SCHEME=https # serve Taiga using "http" or "https" (secured) connection -TAIGA_DOMAIN= {{domain}} # Taiga's base URL -SUBPATH="" # it'll be appended to the TAIGA_DOMAIN (use either "" or a "/subpath") -WEBSOCKETS_SCHEME=wss # events connection protocol (use either "ws" or "wss") - -# Taiga's Secret Key - Variable to provide cryptographic signing -SECRET_KEY="{{taiga_secret_key}}" # Please, change it to an unpredictable value!! - -# Taiga's Database settings - Variables to create the Taiga database and connect to it -POSTGRES_USER={{database_username}} # user to connect to PostgreSQL -POSTGRES_PASSWORD={{database_password}} # database user's password - -# Taiga's SMTP settings - Variables to send Taiga's emails to the users -EMAIL_BACKEND = console # use an SMTP server or display the emails in the console (either "smtp" or "console") -EMAIL_HOST = {{system_email.host}} # SMTP server address -EMAIL_PORT = {{system_email.smtp_port}} # default SMTP port -EMAIL_HOST_USER = {{system_email.username}} # user to connect the SMTP server -EMAIL_HOST_PASSWORD = {{system_email.password}} # SMTP user's password -EMAIL_DEFAULT_FROM = {{system_email.from}} # default email address for the automated emails -# EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive (only set one of those to True) -EMAIL_USE_TLS={{ system_email.tls | lower | capitalize }} # use TLS (secure) connection with the SMTP server -EMAIL_USE_SSL={{ 'False' if system_email.start_tls else 'True' }} # use implicit TLS (secure) connection with the SMTP server - -# Taiga's RabbitMQ settings - Variables to leave messages for the realtime and asynchronous events -RABBITMQ_USER=taiga # user to connect to RabbitMQ -RABBITMQ_PASS=taiga # RabbitMQ user's password -RABBITMQ_VHOST=taiga # RabbitMQ container name -RABBITMQ_ERLANG_COOKIE=secret-erlang-cookie # unique value shared by any connected instance of RabbitMQ - -# Taiga's Attachments - Variable to define how long the attachments will be accesible -ATTACHMENTS_MAX_AGE=360 # token expiration date (in seconds) - -# Taiga's Telemetry - Variable to enable or disable the anonymous telemetry -ENABLE_TELEMETRY=True \ No newline at end of file diff --git a/roles/docker-taiga/templates/docker-compose-inits.yml.j2 b/roles/docker-taiga/templates/docker-compose-inits.yml.j2 index cd347e38..d3de71a2 100644 --- a/roles/docker-taiga/templates/docker-compose-inits.yml.j2 +++ b/roles/docker-taiga/templates/docker-compose-inits.yml.j2 @@ -1,42 +1,14 @@ -x-environment: - &default-back-environment - POSTGRES_DB: "{{database_name}}" - POSTGRES_USER: "${POSTGRES_USER}" - POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" - POSTGRES_HOST: "{{database_host}}" - - TAIGA_SECRET_KEY: "${SECRET_KEY}" - TAIGA_SITES_SCHEME: "${TAIGA_SCHEME}" - TAIGA_SITES_DOMAIN: "${TAIGA_DOMAIN}" - - EMAIL_BACKEND: "django.core.mail.backends.${EMAIL_BACKEND}.EmailBackend" - DEFAULT_FROM_EMAIL: "${EMAIL_DEFAULT_FROM}" - EMAIL_USE_TLS: "${EMAIL_USE_TLS}" - EMAIL_USE_SSL: "${EMAIL_USE_SSL}" - EMAIL_HOST: "${EMAIL_HOST}" - EMAIL_PORT: "${EMAIL_PORT}" - EMAIL_HOST_USER: "${EMAIL_HOST_USER}" - EMAIL_HOST_PASSWORD: "${EMAIL_HOST_PASSWORD}" - - RABBITMQ_USER: "${RABBITMQ_USER}" - RABBITMQ_PASS: "${RABBITMQ_PASS}" - CELERY_ENABLED: "False" - -x-volumes: - &default-back-volumes - - static-data:/taiga-back/static - - media-data:/taiga-back/media - # - ./config.py:/taiga-back/settings/config.py - services: taiga-manage: image: taigaio/taiga-back:latest - environment: *default-back-environment -{% include 'roles/docker-compose/templates/services/base.yml.j2' %} + environment: + CELERY_ENABLED: "False" {% include 'templates/docker/container/depends-on-just-database.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %} - entrypoint: "python manage.py" - volumes: *default-back-volumes + volumes: + - static-data:/taiga-back/static + - media-data:/taiga-back/media + # - ./config.py:/taiga-back/settings/config.py {% include 'templates/docker/compose/networks.yml.j2' %} taiga: diff --git a/roles/docker-taiga/templates/docker-compose.yml.j2 b/roles/docker-taiga/templates/docker-compose.yml.j2 index 4fb1af8d..08267756 100644 --- a/roles/docker-taiga/templates/docker-compose.yml.j2 +++ b/roles/docker-taiga/templates/docker-compose.yml.j2 @@ -1,47 +1,13 @@ -x-environment: - &default-back-environment - # These environment variables will be used by taiga-back and taiga-async. - # Database settings - POSTGRES_DB: "{{database_name}}" - POSTGRES_USER: "${POSTGRES_USER}" - POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" - POSTGRES_HOST: "{{database_host}}" - - # Taiga settings - TAIGA_SECRET_KEY: "${SECRET_KEY}" - TAIGA_SITES_SCHEME: "${TAIGA_SCHEME}" - TAIGA_SITES_DOMAIN: "${TAIGA_DOMAIN}" - TAIGA_SUBPATH: "${SUBPATH}" - # Email settings. - EMAIL_BACKEND: "django.core.mail.backends.${EMAIL_BACKEND}.EmailBackend" - DEFAULT_FROM_EMAIL: "${EMAIL_DEFAULT_FROM}" - EMAIL_USE_TLS: "${EMAIL_USE_TLS}" - EMAIL_USE_SSL: "${EMAIL_USE_SSL}" - EMAIL_HOST: "${EMAIL_HOST}" - EMAIL_PORT: "${EMAIL_PORT}" - EMAIL_HOST_USER: "${EMAIL_HOST_USER}" - EMAIL_HOST_PASSWORD: "${EMAIL_HOST_PASSWORD}" - # Rabbitmq settings - RABBITMQ_USER: "${RABBITMQ_USER}" - RABBITMQ_PASS: "${RABBITMQ_PASS}" - # Telemetry settings - ENABLE_TELEMETRY: "${ENABLE_TELEMETRY}" - # ...your customizations go here - -x-volumes: - &default-back-volumes - # These volumens will be used by taiga-back and taiga-async. - - static-data:/taiga-back/static - - media-data:/taiga-back/media - # - ./config.py:/taiga-back/settings/config.py - services: {% include 'roles/docker-central-database/templates/services/' + database_type + '.yml.j2' %} taiga-back: {% include 'roles/docker-compose/templates/services/base.yml.j2' %} image: taigaio/taiga-back:{{applications.taiga.version}} - environment: *default-back-environment - volumes: *default-back-volumes + volumes: + # These volumens will be used by taiga-back and taiga-async. + - static-data:/taiga-back/static + - media-data:/taiga-back/media + # - ./config.py:/taiga-back/settings/config.py {% include 'templates/docker/container/networks.yml.j2' %} taiga: {% include 'templates/docker/container/depends-on-also-database.yml.j2' %} @@ -54,12 +20,13 @@ services: {% include 'roles/docker-compose/templates/services/base.yml.j2' %} image: taigaio/taiga-back:latest entrypoint: ["/taiga-back/docker/async_entrypoint.sh"] - environment: *default-back-environment - volumes: *default-back-volumes - + volumes: + # These volumens will be used by taiga-back and taiga-async. + - static-data:/taiga-back/static + - media-data:/taiga-back/media + # - ./config.py:/taiga-back/settings/config.py {% include 'templates/docker/container/networks.yml.j2' %} taiga: - {% include 'templates/docker/container/depends-on-also-database.yml.j2' %} taiga-events-rabbitmq: condition: service_started @@ -68,27 +35,16 @@ services: taiga-async-rabbitmq: image: rabbitmq:3.8-management-alpine - environment: - RABBITMQ_ERLANG_COOKIE: "${RABBITMQ_ERLANG_COOKIE}" - RABBITMQ_DEFAULT_USER: "${RABBITMQ_USER}" - RABBITMQ_DEFAULT_PASS: "${RABBITMQ_PASS}" - RABBITMQ_DEFAULT_VHOST: "${RABBITMQ_VHOST}" hostname: "taiga-async-rabbitmq" volumes: - async-rabbitmq-data:/var/lib/rabbitmq {% include 'roles/docker-compose/templates/services/base.yml.j2' %} - {% include 'templates/docker/container/networks.yml.j2' %} taiga: taiga-front: image: taigaio/taiga-front:latest - environment: - TAIGA_URL: "${TAIGA_SCHEME}://${TAIGA_DOMAIN}" - TAIGA_WEBSOCKETS_URL: "${WEBSOCKETS_SCHEME}://${TAIGA_DOMAIN}" - TAIGA_SUBPATH: "${SUBPATH}" {% include 'roles/docker-compose/templates/services/base.yml.j2' %} - {% include 'templates/docker/container/networks.yml.j2' %} taiga: # volumes: @@ -96,10 +52,6 @@ services: taiga-events: image: taigaio/taiga-events:latest - environment: - RABBITMQ_USER: "${RABBITMQ_USER}" - RABBITMQ_PASS: "${RABBITMQ_PASS}" - TAIGA_SECRET_KEY: "${SECRET_KEY}" {% include 'roles/docker-compose/templates/services/base.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %} taiga: @@ -109,11 +61,6 @@ services: taiga-events-rabbitmq: image: rabbitmq:3.8-management-alpine - environment: - RABBITMQ_ERLANG_COOKIE: "${RABBITMQ_ERLANG_COOKIE}" - RABBITMQ_DEFAULT_USER: "${RABBITMQ_USER}" - RABBITMQ_DEFAULT_PASS: "${RABBITMQ_PASS}" - RABBITMQ_DEFAULT_VHOST: "${RABBITMQ_VHOST}" hostname: "events-rabbitmq" volumes: - events-rabbitmq-data:/var/lib/rabbitmq @@ -124,9 +71,6 @@ services: taiga-protected: image: taigaio/taiga-protected:latest - environment: - MAX_AGE: "${ATTACHMENTS_MAX_AGE}" - SECRET_KEY: "${SECRET_KEY}" {% include 'roles/docker-compose/templates/services/base.yml.j2' %} {% include 'templates/docker/container/networks.yml.j2' %} @@ -137,7 +81,7 @@ services: ports: - "{{http_port}}:80" volumes: - - ./taiga-gateway/taiga.conf:/etc/nginx/conf.d/default.conf + - {{docker_compose.directories.services}}taiga-gateway/taiga.conf:/etc/nginx/conf.d/default.conf - static-data:/taiga/static - media-data:/taiga/media {% include 'roles/docker-compose/templates/services/base.yml.j2' %} diff --git a/roles/docker-taiga/templates/env.j2 b/roles/docker-taiga/templates/env.j2 new file mode 100644 index 00000000..8a388705 --- /dev/null +++ b/roles/docker-taiga/templates/env.j2 @@ -0,0 +1,44 @@ +# Taiga's URLs - Variables to define where Taiga should be served +TAIGA_SITES_SCHEME = https # serve Taiga using "http" or "https" (secured) connection +TAIGA_SITES_DOMAIN = "{{domain}}" # Taiga's base URL + +TAIGA_SUBPATH = "" # it'll be appended to the TAIGA_DOMAIN (use either "" or a "/subpath") +WEBSOCKETS_SCHEME = wss # events connection protocol (use either "ws" or "wss") + +# Taiga's Secret Key - Variable to provide cryptographic signing +TAIGA_SECRET_KEY = "{{taiga_secret_key}}" # Please, change it to an unpredictable value!! +SECRET_KEY = "{{taiga_secret_key}}" + +# Taiga's Database settings - Variables to create the Taiga database and connect to it +POSTGRES_USER = "{{database_username}}" # user to connect to PostgreSQL +POSTGRES_PASSWORD = "{{database_password}}" # database user's password +POSTGRES_DB = "{{database_name}}" +POSTGRES_HOST = "{{database_host}}" + +# Taiga's SMTP settings - Variables to send Taiga's emails to the users +EMAIL_BACKEND = "{{email_backend}}" # use an SMTP server or display the emails in the console (either "smtp" or "console") +EMAIL_HOST = "{{system_email.host}}" # SMTP server address +EMAIL_PORT = "{{system_email.smtp_port}}" # default SMTP port +EMAIL_HOST_USER = "{{system_email.username}}" # user to connect the SMTP server +EMAIL_HOST_PASSWORD = "{{system_email.password}}" # SMTP user's password +EMAIL_DEFAULT_FROM = "{{system_email.from}}" # default email address for the automated emails +EMAIL_BACKEND: = "django.core.mail.backends.{{email_backend}}.EmailBackend" +DEFAULT_FROM_EMAIL = "{{system_email.from}}" + +# EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive (only set one of those to True) +EMAIL_USE_TLS = "{{ system_email.tls | lower | capitalize }}" # use TLS (secure) connection with the SMTP server +EMAIL_USE_SSL = "{{ 'False' if system_email.start_tls else 'True' }}" # use implicit TLS (secure) connection with the SMTP server + +# Taiga's RabbitMQ settings - Variables to leave messages for the realtime and asynchronous events +RABBITMQ_DEFAULT_RABBITMQ_USER = taiga # user to connect to RabbitMQ +RABBITMQ_DEFAULT_RABBITMQ_PASS = taiga # RabbitMQ user's password +RABBITMQ_DEFAULT_RABBITMQ_VHOST = taiga # RabbitMQ container name +RABBITMQ_ERLANG_COOKIE = secret-erlang-cookie # unique value shared by any connected instance of RabbitMQ + +# Taiga's Attachments - Variable to define how long the attachments will be accesible +ATTACHMENTS_MAX_AG = 360 # token expiration date (in seconds) +MAX_AGE = 360 + + +# Taiga's Telemetry - Variable to enable or disable the anonymous telemetry +ENABLE_TELEMETRY = True diff --git a/roles/docker-taiga/vars/main.yml b/roles/docker-taiga/vars/main.yml index e2b22693..941e663a 100644 --- a/roles/docker-taiga/vars/main.yml +++ b/roles/docker-taiga/vars/main.yml @@ -1,4 +1,6 @@ -application_id: "taiga" -database_type: "postgres" -database_password: "{{taiga_database_password}}" -repository_address: "https://github.com/taigaio/taiga-docker" +application_id: "taiga" +database_type: "postgres" +database_password: "{{taiga_database_password}}" +repository_address: "https://github.com/taigaio/taiga-docker" +email_backend: "smtp" ## use an SMTP server or display the emails in the console (either "smtp" or "console") +docker_compose_init: "{{docker_compose.directories.instance}}docker-compose-inits.yml.j2" \ No newline at end of file