2021-06-14 10:42:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
|
|
|
source ${ABSDIR}/../functions.sh
|
|
|
|
source ${ABSDIR}/vars.sh
|
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
2022-01-28 20:15:15 +00:00
|
|
|
ensure_pod_not_exists ${pod_name}
|
2021-07-01 17:28:13 +00:00
|
|
|
ensure_variables_are_defined "$envvars"
|
|
|
|
|
2022-01-28 13:21:27 +00:00
|
|
|
if ! podman volume exists ${confvolume} ; then
|
2021-06-14 10:42:59 +00:00
|
|
|
echo "Error : conf volume ${confvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-01-28 13:21:27 +00:00
|
|
|
if ! podman volume exists ${dbvolume} ; then
|
2021-06-14 10:42:59 +00:00
|
|
|
echo "Error : conf volume ${dbvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-07-04 19:21:54 +00:00
|
|
|
|
2022-11-13 13:08:31 +00:00
|
|
|
if ! podman image pull ${synapse_image}:${synapse_version}; then
|
|
|
|
podman image pull ${synapse_image}:${synapse_version} || exit 1
|
|
|
|
fi
|
2022-02-25 12:52:29 +00:00
|
|
|
podman pull ${postgres_image}:${postgres_version} &&
|
2022-11-05 18:46:53 +00:00
|
|
|
podman network create ${project_name}_default &&
|
|
|
|
podman pod create --name ${pod_name} --infra=true --infra-name=${project_name}_infra --share='' &&
|
2022-11-05 18:30:32 +00:00
|
|
|
podman run -d --name ${db_container_name} --pod ${pod_name} --requires=${project_name}_infra --net ${project_name}_default \
|
2021-06-14 16:46:29 +00:00
|
|
|
--mount type=volume,src=${dbvolume},dst=/var/lib/postgresql/data/ \
|
2021-07-01 17:28:13 +00:00
|
|
|
-e POSTGRES_PASSWORD=${GARBAYE_MATRIX_POSTGRES_PASSWORD} \
|
2021-06-14 10:42:59 +00:00
|
|
|
-e POSTGRES_USER=${container_name} \
|
|
|
|
-e POSTGRES_DB=${container_name} \
|
|
|
|
-e POSTGRES_INITDB_ARGS="--encoding=UTF8 --locale=C" \
|
2022-02-12 18:09:02 +00:00
|
|
|
${postgres_image}:${postgres_version} &&
|
|
|
|
echo -n "Waiting for PostgreSQL to be ready... " &&
|
|
|
|
( podman logs -f synapse-db 2>&1 & ) | grep -q 'database system is ready to accept connections' &&
|
|
|
|
echo "OK." &&
|
2022-11-05 18:30:32 +00:00
|
|
|
podman run -d --name ${container_name} --pod ${pod_name} --requires=${project_name}_infra --net ${project_name}_default \
|
2022-11-05 19:00:03 +00:00
|
|
|
--mount type=volume,src=${confvolume},dst=/data --publish ${listen_if}:${listen_port}:8008 ${synapse_image}:${synapse_version} &&
|
2022-02-12 18:09:02 +00:00
|
|
|
echo -n "Waiting for background tasks to end... " &&
|
|
|
|
( podman logs -f synapse 2>&1 & ) | grep -q 'No more background updates to do' &&
|
|
|
|
echo "OK." &&
|
|
|
|
podman pod stop ${pod_name} &&
|
2022-01-28 21:26:01 +00:00
|
|
|
echo "Done. Pod built and stopped."
|