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:
- sonic-preprod
- scaleway
handlers:
- name: reboot
reboot:

View File

@ -1,11 +1,10 @@
---
- hosts: synapse
# todo: create user for synapse
- hosts: scaleway
vars:
matrix_synapse_version: "v1.5.1-py3"
# matrix_synapse_version: "v1.5.1"
matrix_server_name: matrix-sonic-beta.local
matrix_bind_address: "192.168.42.4"
matrix_server_name: matrix-test.local
matrix_bind_address: "51.158.114.109"
matrix_synapse_pg_host: synapse-postgres # does it need to be an IP?
matrix_synapse_db_name: psycopg2
@ -14,7 +13,10 @@
matrix_synapse_pg_db: "synapse"
matrix_registration_shared_secret: "xxxxx"
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
# matrix_no_tls: true
@ -22,18 +24,49 @@
tasks:
# - docker_volume:
# name: synapse-data
- name: Create config directory
file:
path: "{{ matrix_synapse_config_dir }}"
state: directory
- template:
src: templates/synapse_homeserver.yaml.j2
dest: {{ matrix_synapse_config_path }}
src: templates/homeserver.yaml.j2
dest: "{{ matrix_synapse_config_path }}"
- name: Create config directory
file:
path: "/etc/docker"
state: directory
- template:
src: templates/docker-compose-matrix.yml.j2
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
docker_compose:
project_src: matrix
project_src: /etc/docker/
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'
services:
{# matrix_synapse_version: "v1.5.1-py3"
# matrix_synapse_version: "v1.5.1-py3"
# matrix_synapse_version: "v1.5.1"
matrix_server_name: matrix-sonic-beta.local
matrix_synapse_pg_host: synapse-postgres
matrix_synapse_pg_user: ""
matrix_synapse_pg_pass: ""
matrix_synapse_pg_db: " #}
#matrix_synapse_pg_host: synapse-postgres
synapse:
{# build:
context: ../..
dockerfile: docker/Dockerfile #}
image: "docker.io/matrixdotorg/synapse: {{ matrix_synapse_version }}"
# build:
# context: ../..
# dockerfile: docker/Dockerfile
image: "matrixdotorg/synapse:{{ matrix_synapse_version }}"
# Since synapse does not retry to connect to the database, restart upon
# failure
restart: unless-stopped
# See the readme for a full documentation of the environment settings
environment:
- SYNAPSE_CONFIG_PATH={{ matrix_synapse_config_path }}
- SYNAPSE_REPORT_STATS={{ matrix_synapse_report_stats }}
- SYNAPSE_CONFIG_PATH={{ matrix_synapse_config_docker_path }}
volumes:
# 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
# .. or you may split this between different storage points
# - ./files:/data
@ -38,24 +33,7 @@ services:
# instance expose the TLS port directly:
ports:
- 8008:8008/tcp
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 #}
# labels:
db:
image: docker.io/postgres:10-alpine