From a692e7d2cb8fc7e11ff856d9ae7c64132ed69feb Mon Sep 17 00:00:00 2001 From: Jesper Hess Nielsen Date: Wed, 27 Jan 2021 13:46:06 +0100 Subject: [PATCH] Migrate Passit to docker_service & set correct volume folder path --- roles/docker/defaults/main.yml | 1 + roles/docker/tasks/services/passit.yml | 79 +++++++++++++------------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 7229a005..2e1cd681 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -19,6 +19,7 @@ gitea: passit: domain: "passit.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/passit" fider: domain: "feedback.{{ base_domain }}" diff --git a/roles/docker/tasks/services/passit.yml b/roles/docker/tasks/services/passit.yml index fd972ef2..b57f9159 100644 --- a/roles/docker/tasks/services/passit.yml +++ b/roles/docker/tasks/services/passit.yml @@ -1,45 +1,46 @@ --- -- name: passit network - docker_network: - name: passit +- docker_service: + project_name: "passit" + pull: "yes" + definition: + version: "3.6" + services: -- name: passit database volume - docker_volume: - name: passit_db + passit_db: + image: "postgres:10" + restart: "always" + networks: + - "passit" + volumes: + - "{{ passit.volume_folder }}/data:/var/lib/postgresql/data" + environment: + POSTGRES_USER: "passit" + POSTGRES_PASSWORD: "{{ postgres_passwords.passit }}" -- name: passit database container - docker_container: - name: passit_db - image: postgres:10 - state: started - restart_policy: always - networks: - - name: passit - volumes: - - passit_db:/var/lib/postgresql/data - env: - POSTGRES_USER: passit - POSTGRES_PASSWORD: "{{ postgres_passwords.passit }}" + passit_app: + image: "passit/passit:stable" + command: "bin/start.sh" + restart: "always" + networks: + - "passit" + - "postfix" + - "external_services" + environment: + DATABASE_URL: "postgres://passit:{{ postgres_passwords.passit }}@passit_db:5432/passit" + SECRET_KEY: "{{ passit_secret_key }}" + IS_DEBUG: 'False' + EMAIL_URL: "smtp://noop@{{ smtp_host }}:{{ smtp_port }}" + DEFAULT_FROM_EMAIL: "noreply@{{ passit.domain }}" + EMAIL_CONFIRMATION_HOST: "https://{{ passit.domain }}" -- name: passit app container - docker_container: - name: passit - image: passit/passit:stable - command: bin/start.sh - restart_policy: always - networks: - - name: passit - - name: postfix - - name: external_services - env: - DATABASE_URL: "postgres://passit:{{ postgres_passwords.passit }}@passit_db:5432/passit" - SECRET_KEY: "{{ passit_secret_key }}" - IS_DEBUG: 'False' - EMAIL_URL: smtp://noop@{{ smtp_host }}:{{ smtp_port }} - DEFAULT_FROM_EMAIL: "noreply@{{ passit.domain }}" - EMAIL_CONFIRMATION_HOST: "https://{{ passit.domain }}" + VIRTUAL_HOST: "{{ passit.domain }}" + LETSENCRYPT_HOST: "{{ passit.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" - VIRTUAL_HOST: "{{ passit.domain }}" - LETSENCRYPT_HOST: "{{ passit.domain }}" - LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + networks: + passit: + postfix: + external: true + external_services: + external: true \ No newline at end of file