peerjs : deprov

This commit is contained in:
Gitouche 2024-05-19 15:02:28 +02:00
parent 9524a1bf92
commit 593cb4f013
12 changed files with 0 additions and 120 deletions

View file

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

View file

@ -1 +0,0 @@
../_podman-common/00_status_container.sh

View file

@ -1,18 +0,0 @@
#!/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}
if ! podman image exists ${upstream_images}:${version}; then
podman image pull ${upstream_images}:${version} || exit 1
fi
podman container run --name ${container_name} --user nobody -p ${listen_if}:${listen_port}:9000 -d ${upstream_images}:${version} --port 9000 --path /myapp &&
( podman container logs -f ${container_name} 2>&1 & ) | grep -q 'Started PeerServer' &&
podman container stop ${container_name} &&
echo Container ${container_name} successfully built and stopped.

View file

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

View file

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

View file

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

View file

@ -1,33 +0,0 @@
#!/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_exists ${container_name}
upstream_imageversion=${upstream_images}:${version}
current_imageversion=$(podman container inspect -f '{{.ImageName}}' ${container_name})
if [[ "${upstream_imageversion}" == "${current_imageversion}" ]] ; then
echo Container ${container_name} does not need rebuilding. Exiting.
exit 0
fi
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
# pull first for minimal downtime
podman image pull ${upstream_images}:${version} &&
${ABSDIR}/40_stop.sh &&
${ABSDIR}/80_destroy.sh &&
${ABSDIR}/10_install.sh &&
${ABSDIR}/20_enable.sh &&
${ABSDIR}/30_start.sh &&
podman image rm ${current_imageversion} &&
${ABSDIR}/00_status.sh

View file

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

View file

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

View file

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

View file

@ -1,30 +0,0 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
buildfolder=/tmp/peerjs-server-$$
if ! podman image exists ${upstream_images}:${version}; then
mkdir ${buildfolder} &&
git clone -b v${version} --depth=1 https://github.com/peers/peerjs-server/ ${buildfolder} &&
TMPDIR=${HOME} podman image build \
--label org.opencontainers.image.description='PeerServer helps establishing connections between PeerJS clients. Data is not proxied through the server.' \
--label org.opencontainers.image.source='https://github.com/peers/peerjs-server' \
--label org.opencontainers.image.title='PeerServer' \
--label org.opencontainers.image.url='https://peerjs.com' \
-t ${upstream_images}:${version} ${buildfolder}/ || retval=false
podman image prune -a -f --filter dangling=true
podman image prune -a -f --filter intermediate=true
podman image rm -f $(podman image list -a -q -- docker.io/library/node)
rm -rf ${buildfolder}
eval "$retval"
else
echo "Image ${upstream_images}:${version} already built"
fi &&
oci_push_to_registry ${upstream_images}:${version}

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
## vars
upstream_images='git.garbaye.fr/garbaye/peerjs-server'
version='1.0.2'
## default vars : override with ENV var
listen_if="${GARBAYE_PEERJS_ENV_LISTENIF:-127.0.0.1}"
listen_port="${GARBAYE_PEERJS_ENV_LISTENPORT:-8081}"
## internal vars : do not touch
project_name=${PWD##*/}
container_name="${project_name}"
service_name="container-${container_name}.service"