Skip to content

Commit

Permalink
chore: make Docker environment easier to work with
Browse files Browse the repository at this point in the history
  • Loading branch information
avdb13 committed Feb 13, 2024
1 parent b2d6546 commit 7f066d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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

0 comments on commit 7f066d5

Please sign in to comment.