services-garbaye/podman-ntfy/10_install.sh

32 lines
1.1 KiB
Bash
Raw Normal View History

2022-11-18 10:02:43 +00:00
#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
ensure_container_not_exists ${container_name}
ensure_variables_are_defined "$envvars"
2022-12-10 18:21:23 +00:00
if ! podman volume exists ${ntfy_data_volume} ; then
echo "Error : data volume ${ntfy_data_volume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
exit 1
fi
2022-11-18 10:02:43 +00:00
if ! podman image exists ${ntfy_image}:${ntfy_version}; then
podman image pull ${ntfy_image}:${ntfy_version} || exit 1
fi
2022-11-18 11:12:29 +00:00
podman run --name ${container_name} \
-p ${listen_if}:${listen_port}:8080 \
-e TZ='Europe/Paris' \
2022-12-10 19:55:47 +00:00
-v ${ntfy_data_volume}:/var/lib/ntfy:Z \
2022-11-18 11:12:29 +00:00
-d ${ntfy_image}:${ntfy_version} serve \
--listen-http :8080 --base-url ${GARBAYE_NTFY_BASE_URL} &&
2022-11-18 10:07:52 +00:00
( podman logs -f ${container_name} 2>&1 & ) | grep -q 'INFO Listening on' &&
2022-11-18 10:02:43 +00:00
podman cp config/server.yml ${container_name}:/etc/ntfy/server.yml &&
podman stop ${container_name} &&
echo Container ${container_name} successfully built and stopped.