Split Matrix and Element into their own Compose stacks

This commit is contained in:
Sam A. 2023-09-30 16:42:16 +02:00
parent a47440b6b5
commit 85aa718480
Signed by untrusted user: samsapti
GPG key ID: CBBBE7371E81C4EA
5 changed files with 60 additions and 48 deletions

View file

@ -92,7 +92,7 @@ services:
allowed_sender_domain: true allowed_sender_domain: true
matrix: matrix:
file: matrix_element.yml file: matrix.yml
domain: "matrix.{{ base_domain }}" domain: "matrix.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/matrix" volume_folder: "{{ volume_root_folder }}/matrix"
version: v1.90.0 version: v1.90.0
@ -100,9 +100,8 @@ services:
allowed_sender_domain: true allowed_sender_domain: true
element: element:
domains: file: element.yml
- "riot.{{ base_domain }}" domain: "element.{{ base_domain }}"
- "element.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/element" volume_folder: "{{ volume_root_folder }}/element"
version: v1.11.43 version: v1.11.43

View file

@ -0,0 +1,32 @@
# vim: ft=yaml.ansible
---
- name: Create Element volume folder
file:
name: "{{ services.element.volume_folder }}/data"
state: directory
- name: Upload Element config.json
template:
src: element/config.json.j2
dest: "{{ services.element.volume_folder }}/data/config.json"
- name: Upload Element riot.im.conf
copy:
src: element/riot.im.conf
dest: "{{ services.element.volume_folder }}/data/riot.im.conf"
- name: Upload vhost config for Element domain
copy:
src: vhost/element
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.element.domain }}"
- name: Upload Compose file for Element
template:
src: compose-files/element.yml.j2
dest: "{{ services.element.volume_folder }}/docker-compose.yml"
- name: Deploy Element
docker_compose:
project_src: "{{ services.element.volume_folder }}"
pull: true
state: present

View file

@ -16,38 +16,13 @@
- name: Create Matrix DB folder - name: Create Matrix DB folder
file: file:
name: "{{ services.matrix.volume_folder }}/db" name: "{{ services.matrix.volume_folder }}/db"
state: "directory"
- name: Create Element volume folders
file:
name: "{{ services.element.volume_folder }}/{{ volume }}"
state: directory state: directory
loop:
- "data"
loop_control:
loop_var: volume
- name: Upload Element config.json
template:
src: element/config.json.j2
dest: "{{ services.element.volume_folder }}/data/config.json"
- name: Upload Element riot.im.conf
copy:
src: element/riot.im.conf
dest: "{{ services.element.volume_folder }}/data/riot.im.conf"
- name: upload vhost config for matrix domain - name: upload vhost config for matrix domain
copy: copy:
src: vhost/matrix src: vhost/matrix
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}"
- name: Upload vhost config for Element domain
copy:
src: vhost/element
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ item }}"
loop: "{{ services.element.domains }}"
- name: Upload homeserver.yaml - name: Upload homeserver.yaml
template: template:
src: matrix/homeserver.yaml.j2 src: matrix/homeserver.yaml.j2
@ -58,12 +33,12 @@
src: matrix/log.config src: matrix/log.config
dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config" dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config"
- name: Upload Compose file for Matrix and Element - name: Upload Compose file for Matrix
template: template:
src: compose-files/matrix_element.yml.j2 src: compose-files/matrix.yml.j2
dest: "{{ services.matrix.volume_folder }}/docker-compose.yml" dest: "{{ services.matrix.volume_folder }}/docker-compose.yml"
- name: Deploy Matrix and Element - name: Deploy Matrix
docker_compose: docker_compose:
project_src: "{{ services.matrix.volume_folder }}" project_src: "{{ services.matrix.volume_folder }}"
pull: true pull: true

View file

@ -0,0 +1,22 @@
# vim: ft=yaml.docker-compose
version: "3.8"
services:
element:
image: avhost/docker-matrix-element:{{ services.element.version }}
restart: unless-stopped
networks:
- external_services
expose:
- "8080"
volumes:
- "./data:/data"
environment:
VIRTUAL_HOST: "{{ services.element.domain }}"
VIRTUAL_PORT: "8080"
LETSENCRYPT_HOST: "{{ services.element.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
networks:
external_services:
external: true

View file

@ -29,22 +29,6 @@ services:
LETSENCRYPT_HOST: "{{ services.matrix.domain }}" LETSENCRYPT_HOST: "{{ services.matrix.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
element:
image: avhost/docker-matrix-element:{{ services.element.version }}
restart: unless-stopped
networks:
- default
- external_services
expose:
- "8080"
volumes:
- "{{ services.element.volume_folder }}/data:/data"
environment:
VIRTUAL_HOST: "{{ services.element.domains | join(',') }}"
VIRTUAL_PORT: "8080"
LETSENCRYPT_HOST: "{{ services.element.domains | join(',') }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
networks: networks:
external_services: external_services:
external: true external: true