podman: Add starting synapse homeserver

This commit is contained in:
Ben 2021-09-15 14:30:15 +02:00
parent f62380a768
commit 6f45a4ee37
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -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 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 config:system:set --value=true --type=boolean debug
podman exec --user 33 nextcloud php occ app:enable --force upschooling 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