From 6f45a4ee3740d5f936777f9be062817da733f455 Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Wed, 15 Sep 2021 14:30:15 +0200 Subject: [PATCH] podman: Add starting synapse homeserver --- podman-run.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/podman-run.sh b/podman-run.sh index e00aaf1..1ab7b59 100755 --- a/podman-run.sh +++ b/podman-run.sh @@ -12,3 +12,41 @@ podman exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschoolin podman exec --user 33 nextcloud php occ maintenance:install --database sqlite --admin-user admin --admin-pass admin podman exec --user 33 nextcloud php occ config:system:set --value=true --type=boolean debug podman exec --user 33 nextcloud php occ app:enable --force upschooling + +if podman volume exists synapse-data; then + echo "Found existing synapse-data volume" +else + podman run -d --rm \ + --name=synapse \ + --replace=true \ + --hostname synapse \ + "--mount=type=volume,src=synapse-data,dst=/data" \ + -e SYNAPSE_SERVER_NAME=synapse \ + -e SYNAPSE_REPORT_STATS=no \ + docker.io/matrixdotorg/synapse \ + generate + echo "Generated fresh synapse-data volume" +fi + +podman run -d \ + --name=synapse \ + --replace=true \ + "--mount=type=volume,src=synapse-data,dst=/data" \ + "--network=container:$(podman inspect --format "{{.Id}}" nextcloud)" \ + --hostname synapse \ + docker.io/matrixdotorg/synapse + +REGISTER_USER_OUTPUT="$(podman exec synapse register_new_matrix_user -u upschooling -p secret -a -c /data/homeserver.yaml http://localhost:8008)" +REGISTER_USER_SUCCESS=$? + +if [[ "$REGISTER_USER_SUCCESS" != "0" ]]; then + if echo $REGISTER_USER_OUTPUT | grep -q "User ID already taken."; then + echo "User @upschooling:synapse already exists. OK" + else + echo "Could not create user @upschooling:synapse" + echo $REGISTER_USER_OUTPUT + exit 1 + fi +else + echo "Matrix user @upschooling:synapse created. OK" +fi