matrix-synapse : shellcheck + fix database reconnects?

This commit is contained in:
Gitouche 2023-07-29 08:53:07 +02:00
parent d909497e63
commit 4baf3641ad
2 changed files with 7 additions and 7 deletions

View file

@ -22,5 +22,5 @@ podman volume create ${confvolume} &&
podman volume create ${dbvolume} && podman volume create ${dbvolume} &&
podman container run -it --rm --name ${container_name}-generate --mount type=volume,src=${confvolume},dst=/data -e SYNAPSE_SERVER_NAME=${GARBAYE_MATRIX_DOMAIN} -e SYNAPSE_REPORT_STATS=no ${synapse_image}:${synapse_version} generate && podman container run -it --rm --name ${container_name}-generate --mount type=volume,src=${confvolume},dst=/data -e SYNAPSE_SERVER_NAME=${GARBAYE_MATRIX_DOMAIN} -e SYNAPSE_REPORT_STATS=no ${synapse_image}:${synapse_version} generate &&
podman_unshare_sed_in_place "^pid_file: /data/homeserver.pid$" "pid_file: /data/homeserver.pid\npublic_baseurl: ${GARBAYE_MATRIX_URL}\nallow_public_rooms_over_federation: true" `get_podman_volume_path ${confvolume}`/homeserver.yaml && podman_unshare_sed_in_place "^pid_file: /data/homeserver.pid$" "pid_file: /data/homeserver.pid\npublic_baseurl: ${GARBAYE_MATRIX_URL}\nallow_public_rooms_over_federation: true" `get_podman_volume_path ${confvolume}`/homeserver.yaml &&
podman_unshare_sed_in_place_multiline "database:\n name: sqlite3\n args:\n database: /data/homeserver.db" "database:\n name: psycopg2\n args:\n user: synapse\n password: ${GARBAYE_MATRIX_POSTGRES_PASSWORD}\n database: synapse\n host: synapse-db\n port: 5432\n cp_min: 5\n cp_max: 10" `get_podman_volume_path ${confvolume}`/homeserver.yaml && podman_unshare_sed_in_place_multiline "database:\n name: sqlite3\n args:\n database: /data/homeserver.db" "database:\n name: psycopg2\n args:\n user: synapse\n password: ${GARBAYE_MATRIX_POSTGRES_PASSWORD}\n database: synapse\n host: synapse-db\n port: 5432\n cp_min: 5\n cp_max: 10\n cp_reconnect: true" `get_podman_volume_path ${confvolume}`/homeserver.yaml &&
${ABSDIR}/10_install.sh ${ABSDIR}/10_install.sh

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )" ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh source "${ABSDIR}"/../functions.sh
source ${ABSDIR}/vars.sh source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir ensure_pwd_is_scriptdir
ensure_not_root ensure_not_root
@ -14,7 +14,7 @@ buildkitd_args='--oci-worker-snapshotter=native' # needed as of v0.12.0
if ! podman image exists ${synapse_image}:${synapse_version}; then if ! podman image exists ${synapse_image}:${synapse_version}; then
mkdir ${buildfolder} && mkdir ${buildfolder} &&
curl -sSfL -- "https://github.com/matrix-org/synapse/archive/refs/tags/${synapse_version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ && { if curl -sSfL -- "https://github.com/matrix-org/synapse/archive/refs/tags/${synapse_version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ ; then
podman image pull docker.io/moby/buildkit:${buildkitd_version} podman image pull docker.io/moby/buildkit:${buildkitd_version}
podman container run -d --name buildkitd --privileged docker.io/moby/buildkit:${buildkitd_version} ${buildkitd_args} && podman container run -d --name buildkitd --privileged docker.io/moby/buildkit:${buildkitd_version} ${buildkitd_args} &&
sleep 3 sleep 3
@ -22,13 +22,13 @@ if ! podman image exists ${synapse_image}:${synapse_version}; then
--frontend dockerfile.v0 \ --frontend dockerfile.v0 \
--local context=${buildfolder}/ \ --local context=${buildfolder}/ \
--local dockerfile=${buildfolder}/docker/ \ --local dockerfile=${buildfolder}/docker/ \
--output type=oci,name="${synapse_image}:${synapse_version}" | \ --output type=oci,name=${synapse_image}:${synapse_version} | \
podman image load || retval=false podman image load || retval=false
podman container rm --volumes --force buildkitd && podman container rm --volumes --force buildkitd &&
podman image rm --force docker.io/moby/buildkit:${buildkitd_version} podman image rm --force docker.io/moby/buildkit:${buildkitd_version}
} fi
rm -rf ${buildfolder} rm -rf ${buildfolder}
eval $retval eval "$retval"
else else
echo "Image ${synapse_image}:${synapse_version} already built" echo "Image ${synapse_image}:${synapse_version} already built"
fi && fi &&