2022-01-17 21:15:42 +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}
|
2022-01-17 21:15:42 +00:00
|
|
|
ensure_variables_are_defined "$envvars"
|
|
|
|
|
2022-01-28 11:45:26 +00:00
|
|
|
if ! podman volume exists ${dbvolume} ; then
|
|
|
|
echo "Error : DB volume ${dbvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
2022-01-17 21:15:42 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-01-28 11:45:26 +00:00
|
|
|
if ! podman volume exists ${datavolume} ; then
|
|
|
|
echo "Error : DATA volume ${datavolume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
2022-01-17 21:15:42 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat <<EOT >> .env
|
|
|
|
MYSQL_ROOT_PASSWORD=${GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD}
|
|
|
|
DB_ROOT_PASSWD=${GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD}
|
|
|
|
SEAFILE_ADMIN_PASSWORD=${GARBAYE_SEAFILE_ADMIN_PASSWORD}
|
|
|
|
SEAFILE_SERVER_HOSTNAME=${GARBAYE_SEAFILE_SERVER_HOSTNAME}
|
|
|
|
SEAFILE_ADMIN_EMAIL=${GARBAYE_SEAFILE_ADMIN_EMAIL}
|
|
|
|
EOT
|
|
|
|
|
2022-03-05 20:03:32 +00:00
|
|
|
export seafile_image
|
2022-02-11 13:47:30 +00:00
|
|
|
export seafile_release
|
2022-02-25 12:30:57 +00:00
|
|
|
export mariadb_release
|
|
|
|
export memcached_release
|
2022-02-11 13:47:30 +00:00
|
|
|
export listen_if
|
|
|
|
export listen_port
|
2023-06-15 20:30:05 +00:00
|
|
|
export listen_ws_port
|
2022-02-11 13:47:30 +00:00
|
|
|
|
2022-11-13 13:12:01 +00:00
|
|
|
if ! podman image exists ${seafile_image}:${seafile_release}; then
|
|
|
|
podman image pull ${seafile_image}:${seafile_release} || exit 1
|
|
|
|
fi
|
2023-04-21 11:53:55 +00:00
|
|
|
podman image pull docker.io/library/memcached:${memcached_release} &&
|
|
|
|
podman image pull docker.io/library/mariadb:${mariadb_release} &&
|
2024-06-11 20:04:14 +00:00
|
|
|
${my_podman_compose} --pod-args="--infra=true --infra-name=${project_name}_infra --share=" --podman-run-args "--requires=${project_name}_infra --env-file .env" up -d &&
|
2022-02-14 06:47:36 +00:00
|
|
|
echo -n "Waiting for seahub_settings.py " &&
|
2022-01-28 11:54:55 +00:00
|
|
|
while [ ! -e `get_podman_volume_path ${datavolume}`/seafile/conf/seahub_settings.py ]; do
|
2022-01-17 21:15:42 +00:00
|
|
|
echo -n "."
|
|
|
|
sleep 1
|
2022-02-14 06:47:36 +00:00
|
|
|
done && echo "OK" &&
|
2023-08-13 14:04:36 +00:00
|
|
|
if ! grep -qF EMAIL_HOST `get_podman_volume_path ${datavolume}`/seafile/conf/seahub_settings.py; then
|
2023-08-13 14:23:56 +00:00
|
|
|
echo 'Configuring seahub_settings.py'
|
2024-02-11 10:17:16 +00:00
|
|
|
podman_unshare_sed_in_place "^FILE_SERVER_ROOT = \"http://${GARBAYE_SEAFILE_SERVER_HOSTNAME}/seafhttp\"" "FILE_SERVER_ROOT = \"https://${GARBAYE_SEAFILE_SERVER_HOSTNAME}/seafhttp\"\nCSRF_TRUSTED_ORIGINS = [\"https://${GARBAYE_SEAFILE_SERVER_HOSTNAME}\"]\nEMAIL_USE_TLS = False\nEMAIL_HOST = '${GARBAYE_SEAFILE_SMTP_SERVER}'\nEMAIL_HOST_USER = ''\nEMAIL_HOST_PASSWORD = ''\nEMAIL_PORT = 25\nDEFAULT_FROM_EMAIL = 'noreply-seafile@garbaye.fr'\nSERVER_EMAIL = 'noreply-seafile@garbaye.fr'" `get_podman_volume_path ${datavolume}`/seafile/conf/seahub_settings.py
|
2023-08-13 14:23:56 +00:00
|
|
|
else
|
|
|
|
echo 'Configuration file seahub_settings.py already exists - not configuring.'
|
2023-08-13 14:04:36 +00:00
|
|
|
fi &&
|
|
|
|
if ! grep -Pzq "\[notification\]\nenabled = true\nhost = 0.0.0.0" `get_podman_volume_path ${datavolume}`/seafile/conf/seafile.conf; then
|
2023-08-13 14:23:56 +00:00
|
|
|
echo 'Configuring seafile.conf'
|
2023-08-13 14:04:36 +00:00
|
|
|
podman_unshare_sed_in_place_multiline "\[notification\]\nenabled = false\nhost = 127.0.0.1" "[notification]\nenabled = true\nhost = 0.0.0.0" `get_podman_volume_path ${datavolume}`/seafile/conf/seafile.conf
|
2023-08-13 14:23:56 +00:00
|
|
|
else
|
|
|
|
echo 'Configuration file seafile.conf already exists - not configuring.'
|
2023-08-13 14:04:36 +00:00
|
|
|
fi &&
|
2022-02-14 06:47:36 +00:00
|
|
|
echo -n "Waiting for seahub to finish starting " &&
|
2023-04-21 11:53:55 +00:00
|
|
|
( podman container logs -f seafile 2>&1 & ) | grep -q 'Seahub is started' &&
|
2022-02-14 06:47:36 +00:00
|
|
|
echo "OK" &&
|
|
|
|
podman pod stop ${pod_name} &&
|
|
|
|
echo Pod built and stopped. &&
|
2022-01-28 21:34:31 +00:00
|
|
|
shred -u .env
|