Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make Docker environment easier to work with #24

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nuke_db:
# Generates the synapse configuration file and saves it
gen_synapse_conf: dotenv
docker run -i --rm \
-u $(id -u):$(id -g) \
-v ./docker/synapse:/data \
--env-file .env \
matrixdotorg/synapse:v1.96.1 generate
Expand All @@ -37,15 +38,18 @@ gen_synapse_conf: dotenv
gen_synapse_admin: dotenv
docker compose exec -i synapse \
register_new_matrix_user http://localhost:8008 \
-u $(id -u):$(id -g) \
-c /data/homeserver.yaml \
-u admin \
-p admin \
-a

# Retrieves admin access token uses de-facto admin user and Development Database Credentials
get_access_token:
curl -sS -d '{"type":"m.login.password", "user":"admin", "password":"admin"}' \
http://localhost:8008/_matrix/client/v3/login | jq --raw-output '.access_token' > access_token.txt
sed -i "s/COMMUNE_SYNAPSE_ADMIN_TOKEN='.*'/COMMUNE_SYNAPSE_ADMIN_TOKEN='$( \
curl -sS -d '{"type":"m.login.password", "user":"admin", "password":"admin"}' \
http://localhost:8008/_matrix/client/v3/login | jq --raw-output '.access_token' \
)'/" .env

# Runs backend dependency services
backend: dotenv
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
- '8001:8001'
volumes:
- redis-state:/data

synapse_database:
image: 'postgres:16'
ports:
Expand All @@ -27,6 +27,7 @@ services:

synapse:
image: 'ghcr.io/element-hq/synapse:v1.100.0'
user: '${UID:-1000}:${GID:-1000}'
ports:
- '8008:8008'
- '8448:8448'
Expand Down
Empty file added docker/synapse/.gitkeep
Empty file.
Loading