diff --git a/.gitignore b/.gitignore index 845959d..9fb6f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -**/.env \ No newline at end of file +**/.env +**/vault.yml \ No newline at end of file diff --git a/matrix/additional-containers/.env.example b/matrix/additional-containers/.env.example new file mode 100644 index 0000000..fbe80be --- /dev/null +++ b/matrix/additional-containers/.env.example @@ -0,0 +1,2 @@ +TAILSCALE_OAUTH_KEY= +TAILSCALE_TAGS= \ No newline at end of file diff --git a/matrix/additional-containers/docker-compose.yml b/matrix/additional-containers/docker-compose.yml new file mode 100644 index 0000000..807758c --- /dev/null +++ b/matrix/additional-containers/docker-compose.yml @@ -0,0 +1,54 @@ +--- +services: + ts-matrix: + image: tailscale/tailscale:latest + container_name: ts-matrix + hostname: matrix + environment: + - TS_AUTHKEY=${TAILSCALE_OAUTH_KEY} + - TS_EXTRA_ARGS=--advertise-tags=${TAILSCALE_TAGS} + - TS_STATE_DIR=/var/lib/tailscale + - TS_SOCKET=/var/run/tailscale/tailscaled.sock + volumes: + - ts-matrix-state:/var/lib/tailscale + - /dev/net/tun:/dev/net/tun + - ${PWD}/ts-matrix/tailscale-socket:/var/run/tailscale + cap_add: + - net_admin + - sys_module + restart: unless-stopped + + traefik: + image: "traefik:v3.0" + restart: always + container_name: "traefik" + networks: + - traefik + command: + - "--api.insecure=true" + - "--providers.docker=true" + - "--providers.docker.network=traefik" + - "--providers.docker.exposedbydefault=false" + - "--entrypoints.web-secure.address=:443" + - "--entrypoints.matrix-federation.address=:8448" + - "--entrypoints.matrix-internal-matrix-client-api.address=:8008" + - "--certificatesresolvers.default.tailscale=true" + ports: + - "443:443" + - "8448:8448" + volumes: +# - "./letsencrypt:/letsencrypt" + - "/var/run/docker.sock:/var/run/docker.sock:ro" + - ${PWD}/ts-matrix/tailscale-socket:/var/run/tailscale + depends_on: + - ts-matrix + +networks: + traefik: + external: true + +volumes: + ts-matrix-state: + driver: local + postgres-data: + driver: local \ No newline at end of file diff --git a/matrix/ansible-playbook-config/inventory/group_vars/matrix_servers/vars.yml b/matrix/ansible-playbook-config/inventory/group_vars/matrix_servers/vars.yml new file mode 100644 index 0000000..d3cffc3 --- /dev/null +++ b/matrix/ansible-playbook-config/inventory/group_vars/matrix_servers/vars.yml @@ -0,0 +1,74 @@ +--- +# The bare domain name which represents your Matrix identity. +# Matrix user ids for your server will be of the form (`@user:`). +# +# Note: this playbook does not touch the server referenced here. +# Installation happens on another server ("matrix."). +# +# If you've deployed using the wrong domain, you'll have to run the Uninstalling step, +# because you can't change the Domain after deployment. +# +# Example value: example.com +matrix_domain: "{{ vault_matrix_domain }}" + +# The Matrix homeserver software to install. +# See: +# - `roles/custom/matrix-base/defaults/main.yml` for valid options +# - the `docs/configuring-playbook-IMPLEMENTATION_NAME.md` documentation page, if one is available for your implementation choice +matrix_homeserver_implementation: synapse + +# A secret used as a base, for generating various other secrets. +# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). +matrix_homeserver_generic_secret_key: "{{ vault_matrix_homeserver_generic_secret_key }}" + +# By default, the playbook manages its own Traefik (https://doc.traefik.io/traefik/) reverse-proxy server. +# It will retrieve SSL certificates for you on-demand and forward requests to all other components. +# For alternatives, see `docs/configuring-playbook-own-webserver.md`. +matrix_playbook_reverse_proxy_type: other-traefik-container + +# Uncomment and adjust if your Traefik container is on another network +matrix_playbook_reverse_proxy_container_network: traefik + +# Adjust to point to your Traefik container +matrix_playbook_reverse_proxy_hostname: traefik + +devture_traefik_certs_dumper_ssl_dir_path: "/path/to/your/traefiks/acme.json/directory" + +# Uncomment and tweak the variable below if the name of your federation entrypoint is different +# than the default value (matrix-federation). +# matrix_federation_traefik_entrypoint_name: matrix-federation + +# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains. +# +# In case SSL renewal fails at some point, you'll also get an email notification there. +# +# If you decide to use another method for managing SSL certificates (different than the default Let's Encrypt), +# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`). +# +# Example value: someone@example.com +devture_traefik_config_certificatesResolvers_acme_email: '' + +# A Postgres password to use for the superuser Postgres user (called `matrix` by default). +# +# The playbook creates additional Postgres users and databases (one for each enabled service) +# using this superuser account. +devture_postgres_connection_password: "{{ vault_devture_postgres_connection_password }}" + +# By default, we configure Coturn's external IP address using the value specified for `ansible_host` in your `inventory/hosts` file. +# If this value is an external IP address, you can skip this section. +# +# If `ansible_host` is not the server's external IP address, you have 2 choices: +# 1. Uncomment the line below, to allow IP address auto-detection to happen (more on this below) +# 2. Uncomment and adjust the line below to specify an IP address manually +# +# By default, auto-detection will be attempted using the `https://ifconfig.co/json` API. +# Default values for this are specified in `matrix_coturn_turn_external_ip_address_auto_detection_*` variables in the Coturn role +# (see `roles/custom/matrix-coturn/defaults/main.yml`). +# +# If your server has multiple IP addresses, you may define them in another variable which allows a list of addresses. +# Example: `matrix_coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']` +# +# matrix_coturn_turn_external_ip_address: '' + +# No coturn needed for my own personal server +matrix_coturn_enabled: false \ No newline at end of file diff --git a/matrix/ansible-playbook-config/inventory/group_vars/matrix_servers/vault.yml.example b/matrix/ansible-playbook-config/inventory/group_vars/matrix_servers/vault.yml.example new file mode 100644 index 0000000..656d996 --- /dev/null +++ b/matrix/ansible-playbook-config/inventory/group_vars/matrix_servers/vault.yml.example @@ -0,0 +1,3 @@ +vault_matrix_domain: +vault_matrix_homeserver_generic_secret_key: +vault_devture_postgres_connection_password: \ No newline at end of file diff --git a/matrix/ansible-playbook-config/inventory/hosts.yml b/matrix/ansible-playbook-config/inventory/hosts.yml new file mode 100644 index 0000000..f7f19a9 --- /dev/null +++ b/matrix/ansible-playbook-config/inventory/hosts.yml @@ -0,0 +1,4 @@ +matrix_servers: + matrix.: + ansible_host: + ansible_ssh_user: root \ No newline at end of file