Update 4 files
- /group_vars/all.yml - /roles/matrix/tasks/main.yml - /roles/matrix/templates/docker-compose.yml.j2 - /vault.yml
This commit is contained in:
parent
879ebf6e3b
commit
1b4cb67ed6
@ -152,18 +152,13 @@ matrix_port: "45132"
|
|||||||
matrix_domain: "matrix.zailon.ru"
|
matrix_domain: "matrix.zailon.ru"
|
||||||
matrix_server_name: "{{ matrix_domain }}"
|
matrix_server_name: "{{ matrix_domain }}"
|
||||||
matrix_registration_enabled: false
|
matrix_registration_enabled: false
|
||||||
matrix_report_stats: false
|
matrix_report_stats: "no"
|
||||||
matrix_admin_user: "@admin:{{ matrix_domain }}"
|
matrix_postgres_user: "synapse"
|
||||||
vault_matrix_postgres_password: "13qeadZC"
|
matrix_postgres_password: "13qeadZC"
|
||||||
vault_matrix_synapse_secret: "f9e5c2071a178dd8260c7a07b8e133417ff0d7c5d5ca12efdb215d56e19f05f4"
|
matrix_postgres_db: "synapse"
|
||||||
vault_matrix_macaroon_secret: "11e917490abf2306026ee6e3f49137ca911bd166dc0b8f4bccd62602bf9e6966"
|
|
||||||
vault_matrix_form_secret: "f61c53b083b51e14d2875940971b9e2d5f9ea4c69944cecf458075bf055eca45"
|
|
||||||
vault_matrix_admin_password: "13qeadZC"
|
|
||||||
matrix_postgres_password: "{{ vault_matrix_postgres_password }}"
|
|
||||||
matrix_synapse_secret: "{{ vault_matrix_synapse_secret }}"
|
matrix_synapse_secret: "{{ vault_matrix_synapse_secret }}"
|
||||||
matrix_macaroon_secret: "{{ vault_matrix_macaroon_secret }}"
|
matrix_macaroon_secret: "{{ vault_matrix_macaroon_secret }}"
|
||||||
matrix_form_secret: "{{ vault_matrix_form_secret }}"
|
matrix_form_secret: "{{ vault_matrix_form_secret }}"
|
||||||
|
|
||||||
# ------------192.168.1.208 manage------------
|
# ------------192.168.1.208 manage------------
|
||||||
|
|
||||||
# MeshCentral
|
# MeshCentral
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
owner: "991"
|
|
||||||
group: "991"
|
|
||||||
loop:
|
loop:
|
||||||
- "{{ matrix_base_dir }}"
|
- "{{ matrix_base_dir }}"
|
||||||
- "{{ matrix_data_dir }}"
|
- "{{ matrix_data_dir }}"
|
||||||
@ -13,38 +11,67 @@
|
|||||||
- "{{ matrix_media_dir }}"
|
- "{{ matrix_media_dir }}"
|
||||||
- "{{ matrix_postgres_dir }}"
|
- "{{ matrix_postgres_dir }}"
|
||||||
|
|
||||||
- name: Generate Synapse configuration
|
- name: Generate Synapse configuration file
|
||||||
command: >
|
command: >
|
||||||
docker run --rm
|
docker run --rm
|
||||||
-v {{ matrix_config_dir }}:/data
|
-v {{ matrix_config_dir }}:/data
|
||||||
|
-e SYNAPSE_SERVER_NAME={{ matrix_server_name }}
|
||||||
|
-e SYNAPSE_REPORT_STATS={{ matrix_report_stats }}
|
||||||
matrixdotorg/synapse:latest
|
matrixdotorg/synapse:latest
|
||||||
python -m synapse.app.homeserver
|
generate
|
||||||
--server-name {{ matrix_server_name }}
|
|
||||||
--config-path /data/homeserver.yaml
|
|
||||||
--generate-config
|
|
||||||
--report-stats={{ "yes" if matrix_report_stats else "no" }}
|
|
||||||
args:
|
args:
|
||||||
creates: "{{ matrix_config_dir }}/homeserver.yaml"
|
creates: "{{ matrix_config_dir }}/homeserver.yaml"
|
||||||
|
|
||||||
- name: Copy custom configuration files
|
- name: Update homeserver.yaml with PostgreSQL configuration
|
||||||
template:
|
blockinfile:
|
||||||
src: "{{ item }}"
|
path: "{{ matrix_config_dir }}/homeserver.yaml"
|
||||||
dest: "{{ matrix_config_dir }}/"
|
marker: "# {mark} ANSIBLE MANAGED POSTGRES CONFIG"
|
||||||
mode: 0644
|
block: |
|
||||||
loop:
|
database:
|
||||||
- "homeserver.yaml"
|
name: psycopg2
|
||||||
- "log.config"
|
args:
|
||||||
|
user: {{ matrix_postgres_user }}
|
||||||
|
password: {{ matrix_postgres_password }}
|
||||||
|
database: {{ matrix_postgres_db }}
|
||||||
|
host: matrix-postgres
|
||||||
|
cp_min: 5
|
||||||
|
cp_max: 10
|
||||||
|
sslmode: disable
|
||||||
|
|
||||||
|
- name: Update homeserver.yaml with media storage settings
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ matrix_config_dir }}/homeserver.yaml"
|
||||||
|
marker: "# {mark} ANSIBLE MANAGED MEDIA CONFIG"
|
||||||
|
block: |
|
||||||
|
media_store_path: /data/media_store
|
||||||
|
uploads_path: /data/uploads
|
||||||
|
max_upload_size: "50M"
|
||||||
|
url_preview_enabled: true
|
||||||
|
|
||||||
|
- name: Update homeserver.yaml with registration settings
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ matrix_config_dir }}/homeserver.yaml"
|
||||||
|
marker: "# {mark} ANSIBLE MANAGED REGISTRATION CONFIG"
|
||||||
|
block: |
|
||||||
|
enable_registration: {{ matrix_registration_enabled | bool | lower }}
|
||||||
|
registration_shared_secret: "{{ matrix_synapse_secret }}"
|
||||||
|
|
||||||
|
- name: Update homeserver.yaml with additional settings
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ matrix_config_dir }}/homeserver.yaml"
|
||||||
|
marker: "# {mark} ANSIBLE MANAGED ADDITIONAL CONFIG"
|
||||||
|
block: |
|
||||||
|
macaroon_secret_key: "{{ matrix_macaroon_secret }}"
|
||||||
|
form_secret: "{{ matrix_form_secret }}"
|
||||||
|
trusted_key_servers:
|
||||||
|
- server_name: "matrix.org"
|
||||||
|
|
||||||
- name: Set proper permissions on config files
|
- name: Set proper permissions on config files
|
||||||
file:
|
file:
|
||||||
path: "{{ matrix_config_dir }}/{{ item }}"
|
path: "{{ matrix_config_dir }}/homeserver.yaml"
|
||||||
owner: "991"
|
owner: "991"
|
||||||
group: "991"
|
group: "991"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
loop:
|
|
||||||
- "homeserver.yaml"
|
|
||||||
- "log.config"
|
|
||||||
- "homeserver.yaml.generated" # если файл существует
|
|
||||||
|
|
||||||
- name: Deploy Matrix docker-compose.yml
|
- name: Deploy Matrix docker-compose.yml
|
||||||
template:
|
template:
|
||||||
@ -59,14 +86,14 @@
|
|||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: Wait for database to be ready
|
- name: Wait for PostgreSQL to be ready
|
||||||
wait_for:
|
wait_for:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: "{{ matrix_port }}"
|
port: 5432
|
||||||
timeout: 60
|
timeout: 60
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Wait for services to start
|
- name: Wait for Synapse to start
|
||||||
pause:
|
pause:
|
||||||
seconds: 30
|
seconds: 30
|
||||||
|
|
||||||
@ -81,23 +108,20 @@
|
|||||||
debug:
|
debug:
|
||||||
var: matrix_status.stdout
|
var: matrix_status.stdout
|
||||||
|
|
||||||
- name: Register admin user (if specified)
|
- name: Register admin user (if enabled)
|
||||||
shell: |
|
shell: |
|
||||||
cd {{ matrix_base_dir }}
|
cd {{ matrix_base_dir }}
|
||||||
docker exec matrix-synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u admin -p {{ vault_matrix_admin_password }} --admin
|
docker exec matrix-synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u admin -p {{ vault_matrix_admin_password }} --admin
|
||||||
when: matrix_admin_user != "" and matrix_registration_enabled
|
when: matrix_registration_enabled
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: no
|
become: no
|
||||||
|
|
||||||
- name: Show connection info
|
- name: Show deployment info
|
||||||
debug:
|
debug:
|
||||||
msg: |
|
msg: |
|
||||||
Matrix Synapse deployed!
|
Matrix Synapse успешно развернут!
|
||||||
Server: {{ matrix_server_name }}
|
|
||||||
Client port: {{ matrix_port }}
|
|
||||||
Admin: {{ matrix_admin_user }}
|
|
||||||
|
|
||||||
Next steps:
|
Сервер: {{ matrix_server_name }}
|
||||||
1. Configure reverse proxy in NPM
|
Порт: {{ matrix_port }}
|
||||||
2. Open ports in firewall if needed
|
PostgreSQL: matrix-postgres:5432
|
||||||
3. Configure SSL certificates
|
|
||||||
@ -4,37 +4,44 @@ services:
|
|||||||
matrix-postgres:
|
matrix-postgres:
|
||||||
image: postgres:13
|
image: postgres:13
|
||||||
container_name: matrix-postgres
|
container_name: matrix-postgres
|
||||||
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: synapse
|
POSTGRES_USER: {{ matrix_postgres_user }}
|
||||||
POSTGRES_USER: synapse
|
|
||||||
POSTGRES_PASSWORD: {{ matrix_postgres_password }}
|
POSTGRES_PASSWORD: {{ matrix_postgres_password }}
|
||||||
|
POSTGRES_DB: {{ matrix_postgres_db }}
|
||||||
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=C --lc-ctype=C"
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=C --lc-ctype=C"
|
||||||
volumes:
|
volumes:
|
||||||
- {{ matrix_postgres_dir }}:/var/lib/postgresql/data
|
- {{ matrix_postgres_dir }}:/var/lib/postgresql/data
|
||||||
restart: always
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U synapse"]
|
test: ["CMD-SHELL", "pg_isready -U {{ matrix_postgres_user }}"]
|
||||||
interval: 5s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- matrix-network
|
||||||
|
|
||||||
matrix-synapse:
|
matrix-synapse:
|
||||||
image: matrixdotorg/synapse:latest
|
image: matrixdotorg/synapse:latest
|
||||||
container_name: matrix-synapse
|
container_name: matrix-synapse
|
||||||
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "{{ matrix_port }}:8008"
|
- "{{ matrix_port }}:8008"
|
||||||
volumes:
|
volumes:
|
||||||
- {{ matrix_data_dir }}:/data
|
|
||||||
- {{ matrix_config_dir }}:/data
|
- {{ matrix_config_dir }}:/data
|
||||||
- {{ matrix_media_dir }}:/data/media
|
- {{ matrix_media_dir }}:/data/media
|
||||||
environment:
|
environment:
|
||||||
SYNAPSE_CONFIG_PATH: /data/homeserver.yaml
|
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
|
||||||
depends_on:
|
depends_on:
|
||||||
matrix-postgres:
|
matrix-postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
restart: always
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8008/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8008/health"]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
networks:
|
||||||
|
- matrix-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
matrix-network:
|
||||||
|
driver: bridge
|
||||||
@ -1,5 +1,5 @@
|
|||||||
vault_matrix_postgres_password: "your_secure_postgres_password_here"
|
vault_matrix_postgres_password: "13qeadZC"
|
||||||
vault_matrix_synapse_secret: "f9e5c2071a178dd8260c7a07b8e133417ff0d7c5d5ca12efdb215d56e19f05f4"
|
vault_matrix_synapse_secret: "f9e5c2071a178dd8260c7a07b8e133417ff0d7c5d5ca12efdb215d56e19f05f4"
|
||||||
vault_matrix_macaroon_secret: "11e917490abf2306026ee6e3f49137ca911bd166dc0b8f4bccd62602bf9e6966"
|
vault_matrix_macaroon_secret: "11e917490abf2306026ee6e3f49137ca911bd166dc0b8f4bccd62602bf9e6966"
|
||||||
vault_matrix_form_secret: "f61c53b083b51e14d2875940971b9e2d5f9ea4c69944cecf458075bf055eca45"
|
vault_matrix_form_secret: "f61c53b083b51e14d2875940971b9e2d5f9ea4c69944cecf458075bf055eca45"
|
||||||
vault_matrix_admin_password: "your_admin_password_here"
|
vault_matrix_admin_password: "13qeadZC"
|
||||||
Loading…
Reference in New Issue
Block a user