Add base containers

This commit is contained in:
Pierre HUBERT 2025-01-15 21:24:08 +01:00
parent 4ac56d8e18
commit 3323dd8a38
9 changed files with 235 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
storage

View File

@ -1,2 +1,19 @@
# Matrix Gateway # Matrix Gateway
WIP project WIP project
## Setup dev environment
```
mkdir -p storage/postgres storage/synapse
docker compose up
```
URLs:
* Element: http://localhost:8080/
* Synapse: http://localhost:8448/
* OpenID configuration: http://127.0.0.1:9001/dex/.well-known/openid-configuration
Auto-created Matrix accounts:
* `admin1` : `admin1`
* `user1` : `user1`

65
docker-compose.yml Normal file
View File

@ -0,0 +1,65 @@
# This compose file is compatible with Compose itself, it might need some
# adjustments to run properly with stack.
version: "3"
services:
synapse:
image: docker.io/matrixdotorg/synapse:latest
user: "1000"
# Since synapse does not retry to connect to the database, restart upon
# failure
restart: unless-stopped
entrypoint: /bin/bash
command: >
-c "nohup bash -c 'sleep 10; /config/delayed_accounts_creation.sh' \&
./start.py"
# See the readme for a full documentation of the environment settings
# NOTE: You must edit homeserver.yaml to use postgres, it defaults to sqlite
environment:
- SYNAPSE_CONFIG_PATH=/config/homeserver.yaml
volumes:
# You may either store all the files in a local folder
- ./storage/synapse:/data
- ./docker/synapse:/config:ro
# .. or you may split this between different storage points
# - ./files:/data
# - /path/to/ssd:/data/uploads
# - /path/to/large_hdd:/data/media
depends_on:
- db
# In order to expose Synapse, remove one of the following, you might for
# instance expose the TLS port directly:
ports:
- 8448:8448/tcp
db:
image: docker.io/postgres:12-alpine
user: "1000"
environment:
- POSTGRES_USER=synapse
- POSTGRES_PASSWORD=changeme
# ensure the database gets created correctly
# https://element-hq.github.io/synapse/latest/postgres.html#set-up-database
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
volumes:
# You may store the database tables in a local folder..
- ./storage/postgres:/var/lib/postgresql/data
# .. or store them on some high performance storage for better results
# - /path/to/ssd/storage:/var/lib/postgresql/data
element:
image: docker.io/vectorim/element-web
ports:
- 8080:80/tcp
volumes:
- ./docker/element/config.json:/app/config.json:ro
oidc:
image: dexidp/dex
ports:
- 9001:9001
volumes:
- ./docker/dex:/conf:ro
command: ["dex", "serve", "/conf/dex.config.yaml"]

View File

@ -0,0 +1,26 @@
issuer: http://127.0.0.1:9001/dex
storage:
type: memory
web:
http: 0.0.0.0:9001
oauth2:
# Automate some clicking
# Note: this might actually make some tests pass that otherwise wouldn't.
skipApprovalScreen: false
connectors:
# Note: this might actually make some tests pass that otherwise wouldn't.
- type: mockCallback
id: mock
name: Example
# Basic OP test suite requires two clients.
staticClients:
- id: foo
secret: bar
redirectURIs:
- http://localhost:3000/oidc_cb
name: Project

View File

@ -0,0 +1,49 @@
{
"default_server_config": {
"m.homeserver": {
"base_url": "http://localhost:8448",
"server_name": "devserver"
},
"m.identity_server": {
"base_url": "https://vector.im"
}
},
"disable_custom_urls": false,
"disable_guests": false,
"disable_login_language_selector": false,
"disable_3pid_login": false,
"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"
],
"default_country_code": "GB",
"show_labs_settings": false,
"features": {},
"default_federate": true,
"default_theme": "light",
"room_directory": {
"servers": ["matrix.org"]
},
"enable_presence_by_hs_url": {
"https://matrix.org": false,
"https://matrix-client.matrix.org": false
},
"setting_defaults": {
"breadcrumbs": true
},
"jitsi": {
"preferred_domain": "meet.element.io"
},
"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"
}

View File

@ -0,0 +1,2 @@
register_new_matrix_user -a --user admin1 --password admin1 --config /config/homeserver.yaml;
register_new_matrix_user --no-admin --user user1 --password user1 --config /config/homeserver.yaml;

View File

@ -0,0 +1,35 @@
# 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://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
server_name: "localhost"
pid_file: /data/homeserver.pid
listeners:
- port: 8448
tls: false
type: http
x_forwarded: true
resources:
- names: [client, federation]
compress: false
database:
name: sqlite3
args:
database: /data/homeserver.db
log_config: "/config/localhost.log.config"
media_store_path: /data/media_store
registration_shared_secret: "+oJd9zgvkQpXN-tt;95Wy,AFAdRH+FSTg&LxUXh6ZSvwMJHT;h"
report_stats: false
macaroon_secret_key: "d@ck1QkQLxlRg^aB#c#oZeII.oxOS6E2DX;YobP^Vm#iB5pQpd"
form_secret: "P.uleBJUYc6AM.UOrFF1q7OKH2N5T*Ae2;fGh46;vIHLIQ#JBP"
signing_key_path: "/config/localhost.signing.key"
trusted_key_servers:
- server_name: "matrix.org"
# vim:ft=yaml

View File

@ -0,0 +1,39 @@
version: 1
formatters:
precise:
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: precise
loggers:
# This is just here so we can leave `loggers` in the config regardless of whether
# we configure other loggers below (avoid empty yaml dict error).
_placeholder:
level: "INFO"
synapse.storage.SQL:
# beware: increasing this to DEBUG will make synapse log sensitive
# information such as access tokens.
level: INFO
root:
level: INFO
handlers: [console]
disable_existing_loggers: false

View File

@ -0,0 +1 @@
ed25519 a_HEcG Q2iG1Yy5WTiZ/VIy+zHPyHCRUpqyE3qrVttGULrVQK4