Rename a bunch of playbook variables for better consistency
This commit is contained in:
		@@ -46,9 +46,9 @@ matrix_synapse_macaroon_secret_key: ""
 | 
			
		||||
matrix_synapse_registration_shared_secret: "{{ matrix_synapse_macaroon_secret_key }}"
 | 
			
		||||
matrix_synapse_form_secret: "{{ matrix_synapse_macaroon_secret_key }}"
 | 
			
		||||
 | 
			
		||||
matrix_max_upload_size_mb: 10
 | 
			
		||||
matrix_max_log_file_size_mb: 100
 | 
			
		||||
matrix_max_log_files_count: 10
 | 
			
		||||
matrix_synapse_max_upload_size_mb: 10
 | 
			
		||||
matrix_synapse_max_log_file_size_mb: 100
 | 
			
		||||
matrix_synapse_max_log_files_count: 10
 | 
			
		||||
 | 
			
		||||
matrix_postgres_data_path: "{{ matrix_base_data_path }}/postgres"
 | 
			
		||||
matrix_nginx_proxy_data_path: "{{ matrix_base_data_path }}/nginx-proxy"
 | 
			
		||||
@@ -59,16 +59,16 @@ matrix_coturn_config_path: "{{ matrix_coturn_base_path }}/turnserver.conf"
 | 
			
		||||
matrix_scratchpad_dir: "{{ matrix_base_data_path }}/scratchpad"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
docker_postgres_image_v9: "postgres:9.6.9-alpine"
 | 
			
		||||
docker_postgres_image_v10: "postgres:10.4-alpine"
 | 
			
		||||
docker_postgres_image_latest: "{{ docker_postgres_image_v10 }}"
 | 
			
		||||
matrix_docker_image_postgres_v9: "postgres:9.6.9-alpine"
 | 
			
		||||
matrix_docker_image_postgres_v10: "postgres:10.4-alpine"
 | 
			
		||||
matrix_docker_image_postgres_latest: "{{ matrix_docker_image_postgres_v10 }}"
 | 
			
		||||
 | 
			
		||||
docker_matrix_image: "matrixdotorg/synapse:v0.33.1"
 | 
			
		||||
docker_nginx_image: "nginx:1.15.2-alpine"
 | 
			
		||||
docker_riot_image: "avhost/docker-matrix-riot:v0.16.0"
 | 
			
		||||
docker_s3fs_image: "xueshanf/s3fs:latest"
 | 
			
		||||
docker_goofys_image: "cloudproto/goofys:latest"
 | 
			
		||||
docker_coturn_image: "instrumentisto/coturn:4.5.0.7"
 | 
			
		||||
matrix_docker_image_synapse: "matrixdotorg/synapse:v0.33.1"
 | 
			
		||||
matrix_docker_image_nginx: "nginx:1.15.2-alpine"
 | 
			
		||||
matrix_docker_image_riot: "avhost/docker-matrix-riot:v0.16.0"
 | 
			
		||||
matrix_docker_image_s3fs: "xueshanf/s3fs:latest"
 | 
			
		||||
matrix_docker_image_goofys: "cloudproto/goofys:latest"
 | 
			
		||||
matrix_docker_image_coturn: "instrumentisto/coturn:4.5.0.7"
 | 
			
		||||
 | 
			
		||||
# The Docker network that all services would be put into
 | 
			
		||||
matrix_docker_network: "matrix"
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@
 | 
			
		||||
- name: Importing SQLite database into Postgres
 | 
			
		||||
  docker_container:
 | 
			
		||||
    name: matrix-synapse-migrate
 | 
			
		||||
    image: "{{ docker_matrix_image }}"
 | 
			
		||||
    image: "{{ matrix_docker_image_synapse }}"
 | 
			
		||||
    detach: no
 | 
			
		||||
    cleanup: yes
 | 
			
		||||
    entrypoint: /usr/bin/python
 | 
			
		||||
@@ -69,4 +69,4 @@
 | 
			
		||||
- name: Ensure scratchpad directory is deleted
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ matrix_scratchpad_dir }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
    state: absent
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Coturn image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_coturn_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_coturn }}"
 | 
			
		||||
 | 
			
		||||
- name: Ensure Coturn configuration path exists
 | 
			
		||||
  file:
 | 
			
		||||
@@ -39,4 +39,4 @@
 | 
			
		||||
    - '3478/tcp' # STUN
 | 
			
		||||
    - '3478/udp' # STUN
 | 
			
		||||
    - "{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp" # TURN
 | 
			
		||||
  when: ansible_os_family == 'RedHat'
 | 
			
		||||
  when: ansible_os_family == 'RedHat'
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Goofys Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_goofys_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_goofys }}"
 | 
			
		||||
  when: matrix_s3_media_store_enabled
 | 
			
		||||
 | 
			
		||||
# This will throw a Permission Denied error if already mounted
 | 
			
		||||
@@ -65,6 +65,6 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Goofys Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_goofys_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_goofys }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_s3_media_store_enabled"
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
#
 | 
			
		||||
- name: Ensure nginx Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_nginx_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_nginx }}"
 | 
			
		||||
  when: matrix_nginx_proxy_enabled
 | 
			
		||||
 | 
			
		||||
- name: Allow access to nginx proxy ports in firewalld
 | 
			
		||||
@@ -87,4 +87,4 @@
 | 
			
		||||
  file:
 | 
			
		||||
    path: "/etc/cron.d/matrix-nginx-proxy-periodic-restarter"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_nginx_proxy_enabled"
 | 
			
		||||
  when: "not matrix_nginx_proxy_enabled"
 | 
			
		||||
 
 | 
			
		||||
@@ -26,21 +26,21 @@
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (default to latest)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    docker_postgres_image_to_use: "{{ docker_postgres_image_latest }}"
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_latest }}"
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (use 9.x, if detected)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    docker_postgres_image_to_use: "{{ docker_postgres_image_v9 }}"
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_v9 }}"
 | 
			
		||||
  when: "pg_version.startswith('9.')"
 | 
			
		||||
 | 
			
		||||
- debug:
 | 
			
		||||
    msg: "NOTE: Your setup is on an old Postgres version ({{ docker_postgres_image_to_use }}), while {{ docker_postgres_image_latest }} is supported. You can upgrade using --tags=upgrade-postgres"
 | 
			
		||||
  when: "docker_postgres_image_to_use != docker_postgres_image_latest"
 | 
			
		||||
    msg: "NOTE: Your setup is on an old Postgres version ({{ matrix_docker_image_postgres_to_use }}), while {{ matrix_docker_image_postgres_latest }} is supported. You can upgrade using --tags=upgrade-postgres"
 | 
			
		||||
  when: "matrix_docker_image_postgres_to_use != matrix_docker_image_postgres_latest"
 | 
			
		||||
 | 
			
		||||
# Even if we don't run the internal server, we still need this for running the CLI
 | 
			
		||||
- name: Ensure postgres Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_postgres_image_to_use }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_postgres_to_use }}"
 | 
			
		||||
 | 
			
		||||
- name: Ensure Postgres environment variables file created
 | 
			
		||||
  template:
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure riot-web Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_riot_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_riot }}"
 | 
			
		||||
  when: matrix_riot_web_enabled
 | 
			
		||||
 | 
			
		||||
- name: Ensure Matrix riot-web configured
 | 
			
		||||
@@ -64,6 +64,6 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure riot-web Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_riot_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_riot }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: "not matrix_riot_web_enabled"
 | 
			
		||||
 
 | 
			
		||||
@@ -23,5 +23,5 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure S3fs Docker image doesn't exist
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_s3fs_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_s3fs }}"
 | 
			
		||||
    state: absent
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@
 | 
			
		||||
 | 
			
		||||
- name: Ensure Matrix Docker image is pulled
 | 
			
		||||
  docker_image:
 | 
			
		||||
    name: "{{ docker_matrix_image }}"
 | 
			
		||||
    name: "{{ matrix_docker_image_synapse }}"
 | 
			
		||||
 | 
			
		||||
- name: Check if a Matrix Synapse configuration exists
 | 
			
		||||
  stat:
 | 
			
		||||
@@ -51,7 +51,7 @@
 | 
			
		||||
- name: Generate initial Matrix config
 | 
			
		||||
  docker_container:
 | 
			
		||||
    name: matrix-config
 | 
			
		||||
    image: "{{ docker_matrix_image }}"
 | 
			
		||||
    image: "{{ matrix_docker_image_synapse }}"
 | 
			
		||||
    detach: no
 | 
			
		||||
    cleanup: yes
 | 
			
		||||
    command: generate
 | 
			
		||||
 
 | 
			
		||||
@@ -52,16 +52,16 @@
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (default to latest)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    docker_postgres_image_to_use: "{{ docker_postgres_image_latest }}"
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_latest }}"
 | 
			
		||||
 | 
			
		||||
- name: Determine Postgres version to use (use 9.x, if detected)
 | 
			
		||||
  set_fact:
 | 
			
		||||
    docker_postgres_image_to_use: "{{ docker_postgres_image_v9 }}"
 | 
			
		||||
    matrix_docker_image_postgres_to_use: "{{ matrix_docker_image_postgres_v9 }}"
 | 
			
		||||
  when: "pg_version.startswith('9.')"
 | 
			
		||||
 | 
			
		||||
- name: Abort, if already at latest Postgres version
 | 
			
		||||
  fail: msg="You are already running the latest Postgres version supported. Nothing to do"
 | 
			
		||||
  when: "docker_postgres_image_to_use == docker_postgres_image_latest"
 | 
			
		||||
  when: "matrix_docker_image_postgres_to_use == matrix_docker_image_postgres_latest"
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-synapse is stopped
 | 
			
		||||
  service: name=matrix-synapse state=stopped
 | 
			
		||||
@@ -81,7 +81,7 @@
 | 
			
		||||
    --link matrix-postgres:postgres \
 | 
			
		||||
    --env-file={{ matrix_environment_variables_data_path }}/env-postgres-pgsql-docker \
 | 
			
		||||
    -v {{ postgres_dump_dir }}:/out \
 | 
			
		||||
    {{ docker_postgres_image_to_use }} pg_dump -h postgres {{ matrix_postgres_db_name }} -f /out/{{ postgres_dump_name }}
 | 
			
		||||
    {{ matrix_docker_image_postgres_to_use }} pg_dump -h postgres {{ matrix_postgres_db_name }} -f /out/{{ postgres_dump_name }}
 | 
			
		||||
 | 
			
		||||
- name: Ensure matrix-postgres is stopped
 | 
			
		||||
  service: name=matrix-postgres state=stopped
 | 
			
		||||
@@ -109,7 +109,7 @@
 | 
			
		||||
    --link matrix-postgres:postgres \
 | 
			
		||||
    --env-file={{ matrix_environment_variables_data_path }}/env-postgres-pgsql-docker \
 | 
			
		||||
    -v {{ postgres_dump_dir }}:/in:ro \
 | 
			
		||||
    {{ docker_postgres_image_latest }} psql -h postgres -f /in/{{ postgres_dump_name }}
 | 
			
		||||
    {{ matrix_docker_image_postgres_latest }} psql -h postgres -f /in/{{ postgres_dump_name }}
 | 
			
		||||
 | 
			
		||||
- name: Delete Postgres database dump file
 | 
			
		||||
  file:
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ server {
 | 
			
		||||
		proxy_set_header X-Forwarded-For $remote_addr;
 | 
			
		||||
 | 
			
		||||
		client_body_buffer_size 25M;
 | 
			
		||||
		client_max_body_size {{ matrix_max_upload_size_mb }}M;
 | 
			
		||||
		client_max_body_size {{ matrix_synapse_max_upload_size_mb }}M;
 | 
			
		||||
		proxy_max_temp_file_size 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -257,7 +257,7 @@ media_store_path: "/matrix-storage/media-store"
 | 
			
		||||
uploads_path: "/matrix-run/uploads"
 | 
			
		||||
 | 
			
		||||
# The largest allowed upload size in bytes
 | 
			
		||||
max_upload_size: "{{ matrix_max_upload_size_mb }}M"
 | 
			
		||||
max_upload_size: "{{ matrix_synapse_max_upload_size_mb }}M"
 | 
			
		||||
 | 
			
		||||
# Maximum number of pixels that will be thumbnailed
 | 
			
		||||
max_image_pixels: "32M"
 | 
			
		||||
 
 | 
			
		||||
@@ -15,8 +15,8 @@ handlers:
 | 
			
		||||
        class: logging.handlers.RotatingFileHandler
 | 
			
		||||
        formatter: precise
 | 
			
		||||
        filename: /matrix-run/homeserver.log
 | 
			
		||||
        maxBytes: {{ matrix_max_log_file_size_mb * 1024 * 1024 }}
 | 
			
		||||
        backupCount: {{ matrix_max_log_files_count }}
 | 
			
		||||
        maxBytes: {{ matrix_synapse_max_log_file_size_mb * 1024 * 1024 }}
 | 
			
		||||
        backupCount: {{ matrix_synapse_max_log_files_count }}
 | 
			
		||||
        filters: [context]
 | 
			
		||||
    console:
 | 
			
		||||
        class: logging.StreamHandler
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-coturn \
 | 
			
		||||
			-p {{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}:{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp \
 | 
			
		||||
			-v {{ matrix_synapse_config_dir_path }}:/matrix-config:ro \
 | 
			
		||||
			-v {{ matrix_coturn_config_path }}:/turnserver.conf:ro \
 | 
			
		||||
			{{ docker_coturn_image }} \
 | 
			
		||||
			{{ matrix_docker_image_coturn }} \
 | 
			
		||||
			-c /turnserver.conf
 | 
			
		||||
ExecStop=-/usr/bin/docker kill matrix-coturn
 | 
			
		||||
ExecStop=-/usr/bin/docker rm matrix-coturn
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ ExecStart=/usr/bin/docker run --rm --name %n \
 | 
			
		||||
				-v {{ matrix_synapse_media_store_path }}:/s3:shared \
 | 
			
		||||
				--env-file={{ matrix_environment_variables_data_path }}/goofys \
 | 
			
		||||
				--entrypoint /bin/sh \
 | 
			
		||||
				{{ docker_goofys_image }} \
 | 
			
		||||
				{{ matrix_docker_image_goofys }} \
 | 
			
		||||
				-c 'goofys -f --storage-class=STANDARD_IA --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3'
 | 
			
		||||
TimeoutStartSec=5min
 | 
			
		||||
ExecStop=-/usr/bin/docker stop %n
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-nginx-proxy \
 | 
			
		||||
			-p 443:443 \
 | 
			
		||||
			-v {{ matrix_nginx_proxy_confd_path }}:/etc/nginx/conf.d:ro \
 | 
			
		||||
			-v {{ matrix_ssl_certs_path }}:{{ matrix_ssl_certs_path }}:ro \
 | 
			
		||||
			{{ docker_nginx_image }}
 | 
			
		||||
			{{ matrix_docker_image_nginx }}
 | 
			
		||||
ExecStop=-/usr/bin/docker kill matrix-nginx-proxy
 | 
			
		||||
ExecStop=-/usr/bin/docker rm matrix-nginx-proxy
 | 
			
		||||
ExecReload=/usr/bin/docker exec matrix-nginx-proxy /usr/sbin/nginx -s reload
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-postgres \
 | 
			
		||||
			--env-file={{ matrix_environment_variables_data_path }}/env-postgres-server-docker \
 | 
			
		||||
			-v {{ matrix_postgres_data_path }}:/var/lib/postgresql/data \
 | 
			
		||||
			-v /etc/passwd:/etc/passwd:ro \
 | 
			
		||||
			{{ docker_postgres_image_to_use }}
 | 
			
		||||
			{{ matrix_docker_image_postgres_to_use }}
 | 
			
		||||
ExecStop=-/usr/bin/docker stop matrix-postgres
 | 
			
		||||
ExecStop=-/usr/bin/docker rm matrix-postgres
 | 
			
		||||
Restart=always
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-riot-web \
 | 
			
		||||
			{% if not matrix_nginx_proxy_enabled %}
 | 
			
		||||
			-p 127.0.0.1:8765:8765 \
 | 
			
		||||
			{% endif %}
 | 
			
		||||
			{{ docker_riot_image }}
 | 
			
		||||
			{{ matrix_docker_image_riot }}
 | 
			
		||||
ExecStop=-/usr/bin/docker kill matrix-riot-web
 | 
			
		||||
ExecStop=-/usr/bin/docker rm matrix-riot-web
 | 
			
		||||
Restart=always
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \
 | 
			
		||||
			-v {{ matrix_synapse_run_path }}:/matrix-run \
 | 
			
		||||
			-v {{ matrix_synapse_storage_path }}:/matrix-storage:slave \
 | 
			
		||||
			-e SYNAPSE_CONFIG_PATH=/data/homeserver.yaml \
 | 
			
		||||
			{{ docker_matrix_image }}
 | 
			
		||||
			{{ matrix_docker_image_synapse }}
 | 
			
		||||
ExecStop=-/usr/bin/docker kill matrix-synapse
 | 
			
		||||
ExecStop=-/usr/bin/docker rm matrix-synapse
 | 
			
		||||
Restart=always
 | 
			
		||||
 
 | 
			
		||||
@@ -5,5 +5,5 @@ docker run \
 | 
			
		||||
	--rm \
 | 
			
		||||
	--env-file={{ matrix_environment_variables_data_path }}/env-postgres-pgsql-docker \
 | 
			
		||||
	--network {{ matrix_docker_network }} \
 | 
			
		||||
	{{ docker_postgres_image_to_use }} \
 | 
			
		||||
	psql -h {{ matrix_postgres_connection_hostname }}
 | 
			
		||||
	{{ matrix_docker_image_postgres_to_use }} \
 | 
			
		||||
	psql -h {{ matrix_postgres_connection_hostname }}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user