From 1f8b1827ff71299240a0ca90cd45c31f58893f0e Mon Sep 17 00:00:00 2001 From: Jesper Hess Nielsen Date: Mon, 4 Mar 2019 21:38:36 +0100 Subject: [PATCH] Rearrange matrix+riot ansible script, move volumes to host mounts. --- roles/docker/defaults/main.yml | 2 + .../{riot-config.json => riot/config.json} | 2 +- .../files/configs/{ => riot}/riot.im.conf | 0 roles/docker/tasks/services/matrix_riot.yml | 45 ++++++++++--------- 4 files changed, 28 insertions(+), 21 deletions(-) rename roles/docker/files/configs/{riot-config.json => riot/config.json} (96%) rename roles/docker/files/configs/{ => riot}/riot.im.conf (100%) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 3d0368d..7c97ede 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -23,9 +23,11 @@ fider: matrix: domain: "matrix.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/matrix" riot: domain: "riot.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/riot" privatebin: domain: "paste.{{ base_domain }}" diff --git a/roles/docker/files/configs/riot-config.json b/roles/docker/files/configs/riot/config.json similarity index 96% rename from roles/docker/files/configs/riot-config.json rename to roles/docker/files/configs/riot/config.json index c3b5ca7..a7dbfc9 100644 --- a/roles/docker/files/configs/riot-config.json +++ b/roles/docker/files/configs/riot/config.json @@ -23,7 +23,7 @@ "feature_tabbed_settings": "enable", "feature_sas": "enable" }, - "welcomeUserId": "@riot-bot:matrix.org", + "welcomeUserId": "", "piwik": false, "roomDirectory": { "servers": [ diff --git a/roles/docker/files/configs/riot.im.conf b/roles/docker/files/configs/riot/riot.im.conf similarity index 100% rename from roles/docker/files/configs/riot.im.conf rename to roles/docker/files/configs/riot/riot.im.conf diff --git a/roles/docker/tasks/services/matrix_riot.yml b/roles/docker/tasks/services/matrix_riot.yml index 8579a58..93fbdeb 100644 --- a/roles/docker/tasks/services/matrix_riot.yml +++ b/roles/docker/tasks/services/matrix_riot.yml @@ -1,26 +1,35 @@ --- +- name: create matrix volume folders + file: + name: "{{ matrix.volume_folder }}/{{ volume }}" + state: directory + loop: + - "db" + loop_control: + loop_var: volume + +- name: create riot volume folders + file: + name: "{{ riot.volume_folder }}/{{ volume }}" + state: directory + loop: + - "data" + loop_control: + loop_var: volume - name: matrix network docker_network: name: matrix -- name: matrix database volume - docker_volume: - name: matrix_db - -- name: riot volume - docker_volume: - name: riot_app - - name: upload riot config.json template: - src: files/configs/riot-config.json - dest: /var/lib/docker/volumes/riot_app/_data/config.json + src: files/configs/riot/config.json + dest: "{{ riot.volume_folder }}/data/config.json" - name: upload riot.im.conf template: - src: files/configs/riot.im.conf - dest: /var/lib/docker/volumes/riot_app/_data/riot.im.conf + src: files/configs/riot/riot.im.conf + dest: "{{ riot.volume_folder }}/data/riot.im.conf" - name: matrix database container docker_container: @@ -31,7 +40,7 @@ networks: - name: matrix volumes: - - matrix_db:/var/lib/postgresql/data + - "{{ matrix.volume_folder }}/db:/var/lib/postgresql/data" env: POSTGRES_USER: "synapse" POSTGRES_PASSWORD: "{{ postgres_passwords.matrix }}" @@ -43,9 +52,6 @@ restart_policy: unless-stopped networks: - name: matrix - published_ports: - - 8008:8008 - - 8448:8448 env: SYNAPSE_SERVER_NAME: "{{ base_domain }}" SYNAPSE_REPORT_STATS: "False" @@ -69,13 +75,12 @@ networks: - name: matrix - name: external_services - volumes: - - riot_app:/data published_ports: - - 8080 + - "8080" + volumes: + - "{{ riot.volume_folder }}/data:/data" env: VIRTUAL_HOST: "{{ riot.domain }}" VIRTUAL_PORT: "8080" LETSENCRYPT_HOST: "{{ riot.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" -