datacoop.ansible/roles/docker/tasks/services/matrix_element.yml

121 lines
3.4 KiB
YAML
Raw Normal View History

# vim: ft=yaml.ansible
2019-02-09 10:20:11 +00:00
---
2023-04-07 22:35:49 +00:00
- name: Create Matrix volume folders
file:
name: "{{ services.matrix.volume_folder }}/{{ volume }}"
state: directory
owner: "991"
group: "991"
loop:
- "data"
- "data/uploads"
- "data/media"
loop_control:
loop_var: volume
2023-04-07 22:35:49 +00:00
- name: Create Matrix DB folder
file:
name: "{{ services.matrix.volume_folder }}/db"
state: "directory"
2023-04-07 22:35:49 +00:00
- name: Create Element volume folders
file:
2023-04-07 22:35:49 +00:00
name: "{{ services.element.volume_folder }}/{{ volume }}"
state: directory
loop:
- "data"
loop_control:
loop_var: volume
2019-02-09 10:20:11 +00:00
2023-04-07 22:35:49 +00:00
- name: Upload Element config.json
template:
src: element.config.json.j2
2023-04-07 22:35:49 +00:00
dest: "{{ services.element.volume_folder }}/data/config.json"
2023-04-07 22:35:49 +00:00
- name: Upload Element riot.im.conf
copy:
src: element/riot.im.conf
2023-04-07 22:35:49 +00:00
dest: "{{ services.element.volume_folder }}/data/riot.im.conf"
2019-03-05 08:06:19 +00:00
- name: upload vhost config for matrix domain
copy:
src: vhost/matrix
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}"
2019-03-05 08:06:19 +00:00
2023-04-07 22:35:49 +00:00
- name: Upload vhost config for Element domain
copy:
src: vhost/element
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ item }}"
2023-04-07 22:35:49 +00:00
loop: "{{ services.element.domains }}"
2023-04-07 22:35:49 +00:00
- name: Upload homeserver.yaml
template:
src: matrix.homeserver.yaml.j2
dest: "{{ services.matrix.volume_folder }}/data/homeserver.yaml"
- name: upload matrix logging config
copy:
src: matrix/log.config
dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config"
2023-04-07 22:35:49 +00:00
- name: Set up Matrix and Element
docker_compose:
project_name: matrix
2023-04-07 22:15:05 +00:00
pull: true
definition:
version: "3.6"
services:
2023-04-07 22:15:05 +00:00
postgres:
image: "postgres:{{ services.matrix.postgres_version }}"
restart: unless-stopped
networks:
- matrix
volumes:
- "{{ services.matrix.volume_folder }}/db:/var/lib/postgresql/data"
environment:
POSTGRES_USER: "synapse"
POSTGRES_PASSWORD: "{{ postgres_passwords.matrix }}"
2023-04-07 22:15:05 +00:00
synapse:
image: "matrixdotorg/synapse:{{ services.matrix.version }}"
restart: unless-stopped
networks:
- matrix
2020-02-26 19:55:21 +00:00
- external_services
2023-07-11 18:42:20 +00:00
- postfix
2020-02-26 19:55:21 +00:00
volumes:
- "{{ services.matrix.volume_folder }}/data:/data"
environment:
SYNAPSE_CONFIG_PATH: "/data/homeserver.yaml"
2019-03-30 08:35:04 +00:00
SYNAPSE_CACHE_FACTOR: "2"
SYNAPSE_LOG_LEVEL: "INFO"
VIRTUAL_HOST: "{{ services.matrix.domain }}"
VIRTUAL_PORT: "8008"
LETSENCRYPT_HOST: "{{ services.matrix.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
2023-04-07 22:15:05 +00:00
element:
2023-04-07 22:35:49 +00:00
image: "avhost/docker-matrix-element:{{ services.element.version }}"
restart: unless-stopped
networks:
- matrix
- external_services
expose:
- 8080
volumes:
2023-04-07 22:35:49 +00:00
- "{{ services.element.volume_folder }}/data:/data"
environment:
2023-04-07 22:35:49 +00:00
VIRTUAL_HOST: "{{ services.element.domains | join(',') }}"
VIRTUAL_PORT: "8080"
2023-04-07 22:35:49 +00:00
LETSENCRYPT_HOST: "{{ services.element.domains | join(',') }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
2019-02-09 17:49:03 +00:00
2020-02-26 19:55:21 +00:00
networks:
external_services:
external:
name: external_services
2023-07-11 18:42:20 +00:00
postfix:
external: true
matrix:
name: "matrix"