scaleway config

This commit is contained in:
Hadrien 2019-11-28 02:09:17 +01:00
parent a68db5443e
commit 269f3b7997
4 changed files with 55 additions and 43 deletions

1
hosts.ini.example Normal file
View File

@ -0,0 +1 @@
<name> ansible_connection=ssh ansible_user=root ansible_password=<password> ansible_host=<host> ansible_become=yes

View File

@ -1,6 +1,6 @@
--- ---
- hosts: - hosts:
- sonic-preprod - scaleway
handlers: handlers:
- name: reboot - name: reboot
reboot: reboot:

View File

@ -1,11 +1,10 @@
--- ---
- hosts: synapse - hosts: scaleway
# todo: create user for synapse
vars: vars:
matrix_synapse_version: "v1.5.1-py3" matrix_synapse_version: "v1.5.1-py3"
# matrix_synapse_version: "v1.5.1" # matrix_synapse_version: "v1.5.1"
matrix_server_name: matrix-sonic-beta.local matrix_server_name: matrix-test.local
matrix_bind_address: "192.168.42.4" matrix_bind_address: "51.158.114.109"
matrix_synapse_pg_host: synapse-postgres # does it need to be an IP? matrix_synapse_pg_host: synapse-postgres # does it need to be an IP?
matrix_synapse_db_name: psycopg2 matrix_synapse_db_name: psycopg2
@ -14,7 +13,10 @@
matrix_synapse_pg_db: "synapse" matrix_synapse_pg_db: "synapse"
matrix_registration_shared_secret: "xxxxx" matrix_registration_shared_secret: "xxxxx"
matrix_synapse_report_stats: false matrix_synapse_report_stats: false
matrix_synapse_config_path: "/etc/matrix-synapse/homeserver.yaml" matrix_synapse_config_dir: "/etc/matrix-synapse"
matrix_synapse_config_path: "{{ matrix_synapse_config_dir }}/homeserver.yaml"
matrix_synapse_config_docker_path: "/config/homeserver.yaml"
matrix_synapse_config_docker_dir: "/config"
# to implement # to implement
# matrix_no_tls: true # matrix_no_tls: true
@ -22,18 +24,49 @@
tasks: tasks:
# - docker_volume: # - docker_volume:
# name: synapse-data # name: synapse-data
- name: Create config directory
file:
path: "{{ matrix_synapse_config_dir }}"
state: directory
- template: - template:
src: templates/synapse_homeserver.yaml.j2 src: templates/homeserver.yaml.j2
dest: {{ matrix_synapse_config_path }} dest: "{{ matrix_synapse_config_path }}"
- name: Create config directory
file:
path: "/etc/docker"
state: directory
- template: - template:
src: templates/docker-compose-matrix.yml.j2 src: templates/docker-compose-matrix.yml.j2
dest: /etc/docker/docker-compose.yml dest: /etc/docker/docker-compose.yml
- name: Install required system packages
apt: name={{ item }} state=latest update_cache=yes
loop: [ 'apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common', 'python3-pip']
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: Update apt and install docker-ce
apt: update_cache=yes name=docker-ce state=latest
- name: install pip docker
pip: name={{ item }}
loop: ['docker', 'docker-compose']
- name: Create and start matrix services - name: Create and start matrix services
docker_compose: docker_compose:
project_src: matrix project_src: /etc/docker/
register: output register: output

View File

@ -1,32 +1,27 @@
# This compose file is compatible with Compose itself, it might need some
# adjustments to run properly with stack.
version: '3' version: '3'
services: services:
{# matrix_synapse_version: "v1.5.1-py3" # matrix_synapse_version: "v1.5.1-py3"
# matrix_synapse_version: "v1.5.1" # matrix_synapse_version: "v1.5.1"
matrix_server_name: matrix-sonic-beta.local
matrix_synapse_pg_host: synapse-postgres #matrix_synapse_pg_host: synapse-postgres
matrix_synapse_pg_user: ""
matrix_synapse_pg_pass: ""
matrix_synapse_pg_db: " #}
synapse: synapse:
{# build: # build:
context: ../.. # context: ../..
dockerfile: docker/Dockerfile #} # dockerfile: docker/Dockerfile
image: "docker.io/matrixdotorg/synapse: {{ matrix_synapse_version }}" image: "matrixdotorg/synapse:{{ matrix_synapse_version }}"
# Since synapse does not retry to connect to the database, restart upon # Since synapse does not retry to connect to the database, restart upon
# failure # failure
restart: unless-stopped restart: unless-stopped
# See the readme for a full documentation of the environment settings # See the readme for a full documentation of the environment settings
environment: environment:
- SYNAPSE_CONFIG_PATH={{ matrix_synapse_config_path }} - SYNAPSE_REPORT_STATS={{ matrix_synapse_report_stats }}
- SYNAPSE_CONFIG_PATH={{ matrix_synapse_config_docker_path }}
volumes: volumes:
# You may either store all the files in a local folder # You may either store all the files in a local folder
- ./matrix-config:/etc/matrix-synapse - {{ matrix_synapse_config_dir }}:{{ matrix_synapse_config_docker_dir }}
- ./files:/data - ./files:/data
# .. or you may split this between different storage points # .. or you may split this between different storage points
# - ./files:/data # - ./files:/data
@ -38,24 +33,7 @@ services:
# instance expose the TLS port directly: # instance expose the TLS port directly:
ports: ports:
- 8008:8008/tcp - 8008:8008/tcp
labels: # labels:
{# # The following lines are valid for Traefik version 1.x:
- traefik.enable=true
- traefik.frontend.rule=Host:my.matrix.Host
- traefik.port=8008
# Alternatively, for Traefik version 2.0:
- traefik.enable=true
- traefik.http.routers.http-synapse.entryPoints=http
- traefik.http.routers.http-synapse.rule=Host(`my.matrix.host`)
- traefik.http.middlewares.https_redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https_redirect.redirectscheme.permanent=true
- traefik.http.routers.http-synapse.middlewares=https_redirect
- traefik.http.routers.https-synapse.entryPoints=https
- traefik.http.routers.https-synapse.rule=Host(`my.matrix.host`)
- traefik.http.routers.https-synapse.service=synapse
- traefik.http.routers.https-synapse.tls=true
- traefik.http.services.synapse.loadbalancer.server.port=8008
- traefik.http.routers.https-synapse.tls.certResolver=le-ssl #}
db: db:
image: docker.io/postgres:10-alpine image: docker.io/postgres:10-alpine