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: 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
matrix:
file: matrix_element.yml
file: matrix.yml
domain: "matrix.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/matrix"
version: v1.90.0
@ -100,9 +100,8 @@ services:
allowed_sender_domain: true
element:
domains:
- "riot.{{ base_domain }}"
- "element.{{ base_domain }}"
file: element.yml
domain: "element.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/element"
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
file:
name: "{{ services.matrix.volume_folder }}/db"
state: "directory"
- name: Create Element volume folders
file:
name: "{{ services.element.volume_folder }}/{{ volume }}"
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
copy:
src: vhost/matrix
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
template:
src: matrix/homeserver.yaml.j2
@ -58,12 +33,12 @@
src: matrix/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:
src: compose-files/matrix_element.yml.j2
src: compose-files/matrix.yml.j2
dest: "{{ services.matrix.volume_folder }}/docker-compose.yml"
- name: Deploy Matrix and Element
- name: Deploy Matrix
docker_compose:
project_src: "{{ services.matrix.volume_folder }}"
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_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:
external_services:
external: true