lab-ansible/roles/apps/templates/scripts/deploy.sh.j2

34 lines
705 B
Django/Jinja

# THIS FILE IS MANAGED BY ANSIBLE
# vim: ft=bash
# code: language=bash
#!/usr/bin/env bash
ARG="$1"
APPS_DIR="{{ apps_data_root }}"
case $ARG in
start)
for app in $APPS_DIR/*; do
docker compose -f $app/docker-compose.yml up --remove-orphans -d
done
;;
stop)
for app in $APPS_DIR/*; do
docker compose -f $app/docker-compose.yml down --remove-orphans
done
;;
restart)
for app in $APPS_DIR/*; do
docker compose -f $app/docker-compose.yml restart
done
;;
reload-proxy)
docker compose -f $APPS_DIR/nginx/docker-compose.yml exec web \
sh -c "nginx -t && nginx -s reload"
;;
*)
echo "Unrecognized argument"
exit 1
;;
esac