ntfy : tous les scripts

This commit is contained in:
Gitouche 2022-11-18 11:02:43 +01:00
parent 4d2d04ea7a
commit 37b1b28743
10 changed files with 52 additions and 2 deletions

View File

@ -1,10 +1,20 @@
# Si besoin d'executer le before_script manuellement :
# sed -n 's/^ - \(.*\)$/\1/p' .gitlab-ci.yml | bash
before_script:
- podman container exists podman-ntfy && podman container rm --force podman-ntfy
- rm -f ~/.config/systemd/user/container-podman-ntfy.service && systemctl --user daemon-reload
ntfy:
stage: test
script:
- cd podman-ntfy
- ./ci_build-images.sh
- GARBAYE_NTFY_ENV_LISTENIF='18099' GARBAYE_NTFY_BASE_URL='http://notif.garbaye.fr' ./10_install.sh
- ./20_enable.sh
- ./30_start.sh && sleep 10
- ./40_stop.sh
- ./70_disable.sh
- ./80_destroy.sh
tags:
- garbaye
- compute

21
podman-ntfy/10_install.sh Executable file
View File

@ -0,0 +1,21 @@
#!/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"
if ! podman image exists ${ntfy_image}:${ntfy_version}; then
podman image pull ${ntfy_image}:${ntfy_version} || exit 1
fi
podman run --name ${container_name} -p ${listen_if}:${listen_port}:8080 -d ${ntfy_image}:${ntfy_version} serve --listen-http :8080 --base-url ${GARBAYE_NTFY_BASE_URL} &&
podman cp config/server.yml ${container_name}:/etc/ntfy/server.yml &&
sleep 10 &&
podman stop ${container_name} &&
echo Container ${container_name} successfully built and stopped.

1
podman-ntfy/20_enable.sh Symbolic link
View File

@ -0,0 +1 @@
../_podman-common/20_enable_container.sh

1
podman-ntfy/30_start.sh Symbolic link
View File

@ -0,0 +1 @@
../_podman-common/30_start_container.sh

1
podman-ntfy/40_stop.sh Symbolic link
View File

@ -0,0 +1 @@
../_podman-common/40_stop_container.sh

1
podman-ntfy/70_disable.sh Symbolic link
View File

@ -0,0 +1 @@
../_podman-common/70_disable_container.sh

1
podman-ntfy/80_destroy.sh Symbolic link
View File

@ -0,0 +1 @@
../_podman-common/80_destroy_container.sh

1
podman-ntfy/90_prune.sh Symbolic link
View File

@ -0,0 +1 @@
../_podman-common/90_prune_container.sh

View File

@ -0,0 +1,12 @@
# ntfy server config file
#
cache-file: /var/cache/ntfy/cache.db
cache-startup-queries: |
pragma journal_mode = WAL;
pragma synchronous = normal;
pragma temp_store = memory;
pragma busy_timeout = 15000;
vacuum;
behind-proxy: true

View File

@ -3,11 +3,12 @@
ntfy_image="git.garbaye.fr/garbaye/ntfy"
ntfy_version='v1.29.0'
## default vars : override with ENV var
listen_if="${GARBAYE_NTFY_ENV_LISTENIF:-127.0.0.1}"
listen_port="${GARBAYE_NTFY_ENV_LISTENPORT:-8099}"
## mandatory ENV vars
envvars='GARBAYE_NTFY_BASE_URL'
## internal vars : do not touch
project_name=${PWD##*/}
container_name="${project_name}"
service_name="container-${container_name}.service"
cachevolume='podman-ntfy_cache'
container_name='ntfy'