Skip to content

Commit

Permalink
refactor(matrix): update scripts
Browse files Browse the repository at this point in the history
- Added pgAdmin container
- Edited default element config
- Edited env vars
  • Loading branch information
n0bodysec committed Mar 23, 2023
1 parent 77f3287 commit 51c85df
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 137 deletions.
10 changes: 4 additions & 6 deletions matrix/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ SYNAPSE_SERVER_NAME=localhost
SYNAPSE_REPORT_STATS=no
SYNAPSE_NO_TLS=0
SYNAPSE_REGISTRATION_SHARED_SECRET=7Er4MQmOOKKBs2UQEAWpY07EmyQtegd7
SYNAPSE_HTTP_PORT=8008
POSTGRES_HOST=postgres

POSTGRES_DB=synapse
POSTGRES_USER=synapse
POSTGRES_PASSWORD=sup3rs3cret
DOCKER_SYNAPSE_PORT_ON_HOST=8008
DOCKER_SYNAPSE_TLS_PORT_ON_HOST=8448
DOCKER_ELEMENT_PORT_ON_HOST=8080
DOCKER_SYNAPSE_ADMIN_PORT_ON_HOST=8081

PGADMIN_DEFAULT_EMAIL=[email protected]
PGADMIN_DEFAULT_PASSWORD=changeme
3 changes: 2 additions & 1 deletion matrix/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker-compose.override.yml
.env
data/
.data/
13 changes: 6 additions & 7 deletions matrix/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Matrix Synapse & Element Web
# Matrix

Deploy Matrix homeserver based on Synapse and optionally Element web.
Deploy a Matrix Synapse homeserver and optionally an Element web server.

## 🃏 Features

- Ready to deploy synapse image.
- Fully configurable through env variables.
- Customized Element web image.
- Optional Synapse Admin Web Panel (`docker compose --profile tools`).
- Optional Synapse admin web panel (`docker compose --profile tools`).
- Optional PostgreSQL admin web panel (`docker compose --profile tools`).

## 🚀 Deploy

Expand All @@ -19,7 +18,7 @@ Deploy Matrix homeserver based on Synapse and optionally Element web.

## 📜 Notes

- Some Element endpoints have been changed to **future** self-hosted alternatives (see **element-config.json**).
You can deploy your own open source alternatives of the services used:
- Open source Integration Manager: [Dimension](https://github.com/turt2live/matrix-dimension).
- Open source Identify Server: [Gridify Server](https://gitlab.com/kamax-io/software/gridify/server) (or [this](https://github.com/kamax-matrix/mxisd) **deprecated** version).
- Open source Identify Server: [Gridify Server](https://gitlab.com/kamax-lu/software/gridify/server) (or [this](https://github.com/kamax-matrix/mxisd) **deprecated** version wich has been forked [here](https://github.com/ma1uta/ma1sd)).
- Self-hosted Jitsi: [Jitsi Meet](https://github.com/jitsi/jitsi-meet).
56 changes: 0 additions & 56 deletions matrix/docker-compose.npm.yml

This file was deleted.

63 changes: 34 additions & 29 deletions matrix/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,63 @@
version: '3.8'
version: '3.9'

services:
synapse:
# first run: docker compose run synapse generate && docker compose down && docker compose --profile element up -d
container_name: synapse
image: matrixdotorg/synapse:latest
restart: unless-stopped
hostname: ${SYNAPSE_SERVER_NAME}
ports:
- '${DOCKER_SYNAPSE_PORT_ON_HOST:-8008}:${SYNAPSE_HTTP_PORT:-8008}'
- '${DOCKER_SYNAPSE_TLS_PORT_ON_HOST:-8448}:8448'
volumes: [ './data/synapse:/data' ]
networks: [ 'web', 'backend' ]
depends_on: [ 'postgres' ]
expose: [ '8008', '8448' ]
volumes: [ './.data/synapse:/data' ]
networks: [ 'backend' ]
depends_on: [ 'db' ]
environment:
# all env variables: https://github.com/matrix-org/synapse/blob/develop/docker/conf/homeserver.yaml
- SYNAPSE_SERVER_NAME=${SYNAPSE_SERVER_NAME}
- SYNAPSE_REPORT_STATS=${SYNAPSE_REPORT_STATS:-no}
- SYNAPSE_HTTP_PORT=${SYNAPSE_HTTP_PORT:-8008}
- SYNAPSE_NO_TLS=${SYNAPSE_NO_TLS:-0}
- SYNAPSE_REGISTRATION_SHARED_SECRET=${SYNAPSE_REGISTRATION_SHARED_SECRET}
- POSTGRES_HOST=${POSTGRES_HOST:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-synapse}
- POSTGRES_USER=${POSTGRES_USER:-synapse}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-sup3rs3cret}
- SYNAPSE_SERVER_NAME
- SYNAPSE_REPORT_STATS
- SYNAPSE_NO_TLS
- SYNAPSE_REGISTRATION_SHARED_SECRET
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD

postgres:
container_name: synapse_postgres
db:
image: postgres:alpine
restart: unless-stopped
volumes: [ './data/postgres:/var/lib/postgresql/data' ]
expose: [ '5432' ]
volumes: [ './.data/db:/var/lib/postgresql/data' ]
networks: [ 'backend' ]
environment:
- POSTGRES_DB=${POSTGRES_DB:-synapse}
- POSTGRES_USER=${POSTGRES_USER:-synapse}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-sup3rs3cret}
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD

element:
container_name: synapse_element
image: vectorim/element-web:latest
restart: unless-stopped
ports: [ '${DOCKER_ELEMENT_PORT_ON_HOST:-8080}:80' ]
expose: [ '80' ]
volumes: [ './element-config.json:/app/config.json:ro' ]
networks: [ 'web' ]
profiles: [ 'element' ]

admin:
container_name: synapse_admin
synadmin:
image: awesometechnologies/synapse-admin:latest
restart: unless-stopped
ports: [ '${DOCKER_SYNAPSE_ADMIN_PORT_ON_HOST:-8081}:80' ]
expose: [ '80' ]
networks: [ 'web' ]
profiles: [ 'tools' ]

pgadmin:
image: dpage/pgadmin4
restart: unless-stopped
expose: [ '80', '443' ]
volumes: [ './.data/pgadmin:/var/lib/pgadmin' ]
networks: [ 'backend' ]
profiles: [ 'tools' ]
depends_on: [ 'db' ]
environment:
# all env variables: https://www.pgadmin.org/docs/pgadmin4/development/container_deployment.html
- PGADMIN_DEFAULT_EMAIL
- PGADMIN_DEFAULT_PASSWORD

networks:
web:
backend:
74 changes: 36 additions & 38 deletions matrix/element-config.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
{
"default_server_config": {
"m.homeserver": {
"base_url": "http://localhost:8008"
},
"m.identity_server": {
"base_url": "http://localhost/identity-server"
}
},
"disable_custom_urls": false,
"disable_guests": false,
"disable_login_language_selector": false,
"disable_3pid_login": true,
"brand": "Element",
"show_labs_settings": false,
"features": {},
"default_federate": true,
"default_theme": "dark",
"setting_defaults": {
"breadcrumbs": true
},
"room_directory": {
"servers": [
"matrix.org"
]
},
"enable_presence_by_hs_url": {
"https://matrix.org": false,
"https://matrix-client.matrix.org": false
},
"integrations_ui_url": "https://localhost/integrations-server",
"integrations_rest_url": "https://localhost/integrations-server",
"integrations_widgets_urls": [
"https://localhost/integrations-server"
],
"integrations_jitsi_widget_url": "https://localhost/integrations-server",
"jitsi": {
"preferred_domain": "https://localhost/jitsi"
}
"default_server_config": {
"m.homeserver": {
"base_url": "http://localhost:8008",
"server_name": "My homeserver"
},
"m.identity_server": {
"base_url": "https://vector.im"
}
},
"disable_custom_urls": true,
"brand": "Element",
"integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar.vector.im/api",
"integrations_widgets_urls": [
"https://scalar.vector.im/_matrix/integrations/v1",
"https://scalar.vector.im/api",
"https://scalar-staging.vector.im/_matrix/integrations/v1",
"https://scalar-staging.vector.im/api",
"https://scalar-staging.riot.im/scalar/api"
],
"show_labs_settings": true,
"default_federate": false,
"default_theme": "dark",
"enable_presence_by_hs_url": {
"https://matrix.org": false,
"https://matrix-client.matrix.org": false
},
"jitsi": {
"preferred_domain": "meet.jit.si"
},
"element_call": {
"url": "https://call.element.io",
"participant_limit": 8,
"brand": "Element Call"
},
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
}

0 comments on commit 51c85df

Please sign in to comment.