launch and use postgres in a container whilst using mx-tester

This commit is contained in:
jesopo 2022-10-21 09:20:33 +00:00 committed by gnuxie
parent a0da2e1145
commit 8771ca936d
2 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,11 @@ name: mjolnir
up:
before:
- docker run --rm --network $MX_TEST_NETWORK_NAME --name mjolnir-test-postgres --domainname mjolnir-test-postgres -e POSTGRES_PASSWORD=mjolnir-test -e POSTGRES_USER=mjolnir-tester -e POSTGRES_DB=mjolnir-test-db -d -p 127.0.0.1:8082:5432 postgres
# Wait until postgresql is ready
- until psql postgres://mjolnir-tester:mjolnir-test@localhost:8082/mjolnir-test-db -c ""; do echo "Waiting for psql..."; sleep 1s; done
# Make table in postgres
- psql postgres://mjolnir-tester:mjolnir-test@localhost:8082/mjolnir-test-db -c "CREATE TABLE mjolnir (local_part VARCHAR(255), owner VARCHAR(255), management_room TEXT)"
# Launch the reverse proxy, listening for connections *only* on the local host.
- docker run --rm --network host --name mjolnir-test-reverse-proxy -p 127.0.0.1:8081:80 -v $MX_TEST_CWD/test/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
- cp mjolnir-registration.yaml $MX_TEST_SYNAPSE_DIR/data/
@ -15,6 +20,7 @@ run:
down:
finally:
- docker stop mjolnir-test-postgres || true
- docker stop mjolnir-test-reverse-proxy || true
modules:

View File

@ -32,7 +32,7 @@ export class MjolnirAppService {
public readonly mjolnirManager: MjolnirManager = new MjolnirManager();
public constructor() {
this.dataStore = new PgDataStore("foo bar baz");
this.dataStore = new PgDataStore("postgres://mjolnir-tester:mjolnir-test@localhost:8082/mjolnir-test-db");
new Api("http://localhost:8081", this).start(9001);
this.bridge = new Bridge({
homeserverUrl: "http://localhost:8081",