podman: Fix and tweak run script
This commit is contained in:
parent
c3064395f8
commit
0113cdad85
|
@ -5,7 +5,11 @@ IFS=$'\n\t'
|
||||||
|
|
||||||
DIR="${0%/*}"
|
DIR="${0%/*}"
|
||||||
|
|
||||||
podman run -d --name=nextcloud --replace=true -p 8080:80 -v "$DIR:/var/www/html/custom_apps/upschooling" docker.io/nextcloud
|
# replace containers
|
||||||
|
podman rm -if synapse
|
||||||
|
podman rm -if nextcloud
|
||||||
|
|
||||||
|
podman run -d --name=nextcloud -p 8080:80 -v "$DIR:/var/www/html/custom_apps/upschooling" docker.io/nextcloud
|
||||||
podman exec nextcloud chown -R 33 /var/www/html/custom_apps
|
podman exec nextcloud chown -R 33 /var/www/html/custom_apps
|
||||||
"$DIR/podman-reown.sh"
|
"$DIR/podman-reown.sh"
|
||||||
podman exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make composer'
|
podman exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make composer'
|
||||||
|
@ -18,7 +22,6 @@ if podman volume exists synapse-data; then
|
||||||
else
|
else
|
||||||
podman run -d --rm \
|
podman run -d --rm \
|
||||||
--name=synapse \
|
--name=synapse \
|
||||||
--replace=true \
|
|
||||||
--hostname synapse \
|
--hostname synapse \
|
||||||
"--mount=type=volume,src=synapse-data,dst=/data" \
|
"--mount=type=volume,src=synapse-data,dst=/data" \
|
||||||
-e SYNAPSE_SERVER_NAME=synapse \
|
-e SYNAPSE_SERVER_NAME=synapse \
|
||||||
|
@ -30,23 +33,39 @@ fi
|
||||||
|
|
||||||
podman run -d \
|
podman run -d \
|
||||||
--name=synapse \
|
--name=synapse \
|
||||||
--replace=true \
|
|
||||||
"--mount=type=volume,src=synapse-data,dst=/data" \
|
"--mount=type=volume,src=synapse-data,dst=/data" \
|
||||||
"--network=container:$(podman inspect --format "{{.Id}}" nextcloud)" \
|
"--network=container:$(podman inspect --format "{{.Id}}" nextcloud)" \
|
||||||
--hostname synapse \
|
--hostname synapse \
|
||||||
docker.io/matrixdotorg/synapse
|
docker.io/matrixdotorg/synapse
|
||||||
|
|
||||||
|
# wait for synapse to start
|
||||||
|
MAX_TRIES=15
|
||||||
|
for ((i = 0 ; i < $MAX_TRIES ; i++)); do
|
||||||
|
if podman logs synapse 2>&1 | grep -q "Synapse now listening on TCP port 8008"; then
|
||||||
|
echo -e "Synapse has started. \e[1;38;5;2mOK\033[0m"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $i -ge $MAX_TRIES ]]; then
|
||||||
|
echo "Synapse did not start in time! Use \`podman logs synapse\` to investigate"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
REGISTER_USER_OUTPUT="$(podman exec synapse register_new_matrix_user -u upschooling -p secret -a -c /data/homeserver.yaml http://localhost:8008)"
|
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=$?
|
REGISTER_USER_SUCCESS=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
if [[ "$REGISTER_USER_SUCCESS" != "0" ]]; then
|
if [[ "$REGISTER_USER_SUCCESS" != "0" ]]; then
|
||||||
if echo $REGISTER_USER_OUTPUT | grep -q "User ID already taken."; then
|
if echo $REGISTER_USER_OUTPUT | grep -q "User ID already taken."; then
|
||||||
echo "User @upschooling:synapse already exists. OK"
|
echo -e "User @upschooling:synapse already exists. \e[1;38;5;2mOK\033[0m"
|
||||||
else
|
else
|
||||||
echo "Could not create user @upschooling:synapse"
|
echo "Could not create user @upschooling:synapse"
|
||||||
echo $REGISTER_USER_OUTPUT
|
echo $REGISTER_USER_OUTPUT
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Matrix user @upschooling:synapse created. OK"
|
echo -e "Matrix user @upschooling:synapse created. \e[1;38;5;2mOK\033[0m"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue