Add reload-proxy option to deploy.sh

This commit is contained in:
Sam A. 2023-12-31 18:20:28 +01:00
parent 64f09eded2
commit f190d0bc61
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
4 changed files with 13 additions and 6 deletions

View file

@ -22,6 +22,10 @@ restart)
docker compose -f $app/docker-compose.yml restart docker compose -f $app/docker-compose.yml restart
done done
;; ;;
reload-proxy)
docker compose -f $APPS_DIR/nginx/docker-compose.yml exec web \
sh -c "nginx -t && nginx -s reload"
;;
*) *)
echo "Unrecognized argument" echo "Unrecognized argument"
exit 1 exit 1

View file

@ -1,12 +1,8 @@
{# code: language=ansible-jinja #} {# code: language=ansible-jinja #}
# THIS FILE IS MANAGED BY ANSIBLE # THIS FILE IS MANAGED BY ANSIBLE
{
admin off
}
{% for env in ['production', 'staging'] %} {% for env in ['production', 'staging'] %}
# Environment: {{ env }} # BEGIN Environment: {{ env }}
ipfs.local.{{ proxy_vars[env].app01.apps_base_domain }} { ipfs.local.{{ proxy_vars[env].app01.apps_base_domain }} {
tls {{ tls_email }} { tls {{ tls_email }} {
@ -82,4 +78,5 @@ cloud.{{ proxy_vars[env].app01.apps_base_domain }} {
reverse_proxy {{ proxy_vars[env].app01.internal_ipv4 }}:8080 reverse_proxy {{ proxy_vars[env].app01.internal_ipv4 }}:8080
} }
# END Environment: {{ env }}
{% endfor %} {% endfor %}

View file

@ -16,6 +16,12 @@ stop)
restart) restart)
docker compose -f $PROXY_DIR/docker-compose.yml restart docker compose -f $PROXY_DIR/docker-compose.yml restart
;; ;;
reload-proxy)
CADDYFILE="/etc/caddy/Caddyfile"
docker compose -f $PROXY_DIR/docker-compose.yml exec caddy \
sh -c "caddy validate -c $CADDYFILE && caddy reload -c $CADDYFILE" \
2>/dev/null
;;
*) *)
echo "Unrecognized argument" echo "Unrecognized argument"
exit 1 exit 1