#!/usr/bin/env sh set -eu # Renew certificates when needed, then reload OpenResty. ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)" cd "$ROOT_DIR" . "$ROOT_DIR/scripts/lib-compose.sh" echo "Renewing certificates if needed..." compose run --rm --entrypoint certbot certbot \ renew --webroot -w /var/www echo "Reloading OpenResty..." if compose exec -T openresty openresty -s reload; then echo "OpenResty reloaded." else echo "Reload failed; restarting OpenResty..." compose restart openresty fi echo "Done."