From 42fa44e3ec60cea033ce89eda86c9983ae2a2ed8 Mon Sep 17 00:00:00 2001 From: Viyurz <128215328+Viyurz@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:01:43 +0000 Subject: [PATCH] Add mc & synapse --- maj.sh | 2 +- mc/docker-compose.yaml | 23 +++++++++++++++++++ nginx-rp/nginx.conf | 26 +++++++++++++++++++++- synapse/docker-compose.yaml | 36 ++++++++++++++++++++++++++++++ synapse/homeserver.yaml | 44 +++++++++++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 mc/docker-compose.yaml create mode 100644 synapse/docker-compose.yaml create mode 100644 synapse/homeserver.yaml diff --git a/maj.sh b/maj.sh index 129fda9..59e8061 100755 --- a/maj.sh +++ b/maj.sh @@ -1,7 +1,7 @@ #!/bin/bash -services=(nginx-rp nginx-www searxng vw) +services=(mc nginx-rp nginx-www searxng synapse vw) if [[ ! $(echo "${services[*]} all" | grep -P "\b$1\b" ) ]]; then diff --git a/mc/docker-compose.yaml b/mc/docker-compose.yaml new file mode 100644 index 0000000..20b873e --- /dev/null +++ b/mc/docker-compose.yaml @@ -0,0 +1,23 @@ +services: + minecraft: + image: itzg/minecraft-server:latest + container_name: minecraft + restart: always + environment: + VERSION: latest + EULA: "TRUE" + MEMORY: 2G + ENABLE_COMMAND_BLOCK: "true" + MOTD: "Fjeaj" + OPS: | + Viyurz + ports: + - "5432:25565" + - "25565:25565" + volumes: + - minecraft:/data + +volumes: + minecraft: + name: minecraft + diff --git a/nginx-rp/nginx.conf b/nginx-rp/nginx.conf index abc827e..38359bd 100644 --- a/nginx-rp/nginx.conf +++ b/nginx-rp/nginx.conf @@ -213,6 +213,23 @@ http { } } + server { + listen 443 ssl; + listen [::]:443 ssl; + + http2 on; + + server_name matrix.viyurz.fr; + + location ~ ^(/_matrix|/_synapse/client) { + proxy_pass http://localhost:8008; + + # Nginx by default only allows file uploads up to 1M in size + # Increase client_max_body_size to match max_upload_size defined in homeserver.yaml + client_max_body_size 50M; + } + } + server { listen 443 ssl; listen [::]:443 ssl; @@ -234,6 +251,13 @@ http { server_name viyurz.fr; - return 308 https://www.viyurz.fr$request_uri; + location /.well-known/matrix/server { + default_type application/json; + return 200 '{ "m.server": "matrix.viyurz.fr:443" }'; + } + + location / { + return 308 https://www.viyurz.fr$request_uri; + } } } diff --git a/synapse/docker-compose.yaml b/synapse/docker-compose.yaml new file mode 100644 index 0000000..29361d6 --- /dev/null +++ b/synapse/docker-compose.yaml @@ -0,0 +1,36 @@ +services: + postgres: + container_name: synapse_postgres + image: postgres:alpine + environment: + LANG: C + POSTGRES_INITDB_ARGS: "--locale=C --encoding=UTF8" + POSTGRES_USER: synapse + POSTGRES_PASSWORD: synapse + networks: + - synapse + volumes: + - /mnt/synapsepgdata:/var/lib/postgresql/data + + synapse: + container_name: synapse + image: matrixdotorg/synapse:latest + # command: generate + restart: always + environment: + # SYNAPSE_SERVER_NAME: viyurz.fr + # SYNAPSE_REPORT_STATS: "yes" + # SYNAPSE_HTTP_PORT: 8008 + TZ: "Europe/Paris" + networks: + - synapse + ports: + - "[::1]:8008:8008" + volumes: + - /mnt/synapsedata:/data + - ./homeserver.yaml:/data/homeserver.yaml + +networks: + synapse: + ipam: + driver: default diff --git a/synapse/homeserver.yaml b/synapse/homeserver.yaml new file mode 100644 index 0000000..6c3312f --- /dev/null +++ b/synapse/homeserver.yaml @@ -0,0 +1,44 @@ +# Configuration file for Synapse. +# +# This is a YAML file: see [1] for a quick introduction. Note in particular +# that *indentation is important*: all the elements of a list or dictionary +# should have the same indentation. +# +# [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html +# +# For more information on how to configure Synapse, including a complete accounting of +# each option, go to docs/usage/configuration/config_documentation.md or +# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html +server_name: "viyurz.fr" +pid_file: /data/homeserver.pid +listeners: + - port: 8008 + tls: false + type: http + x_forwarded: true + resources: + - names: [client, federation] + compress: false +database: + name: psycopg2 + args: + user: synapse + password: synapse + dbname: synapse + host: synapse_postgres + cp_min: 5 + cp_max: 10 +log_config: "/data/viyurz.fr.log.config" +media_store_path: /data/media_store +enable_registration: true +registration_requires_token: true +registration_shared_secret: "=ttPttyH=QslvTeg:owJKCI7w9Dhlz&PRLvCRaz#:de^T1Dcq@" +report_stats: true +macaroon_secret_key: "Ibz1OAyP+:IR_BgLx:*cID82B=pYlDy*76gwh#kQV4,iEUDE~h" +form_secret: "bj5sv.-B:R.2Z@@cK*rBti&J,v^34.gXNNR*5tNPWTUpkrE+Sv" +signing_key_path: "/data/viyurz.fr.signing.key" +trusted_key_servers: + - server_name: "matrix.org" + + +# vim:ft=yaml