38 lines
773 B
Bash
38 lines
773 B
Bash
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
DOMAIN="${1:-dev.jazari.com.ar}"
|
|
EMAIL="${2:-}"
|
|
|
|
cd "${ROOT_DIR}"
|
|
|
|
mkdir -p infrastructure/nginx/runtime
|
|
|
|
cp infrastructure/nginx/nginx.http.conf infrastructure/nginx/runtime/nginx.conf
|
|
docker compose up -d nginx
|
|
|
|
CERTBOT_ARGS=(
|
|
run --rm
|
|
certbot
|
|
certonly
|
|
--webroot
|
|
-w /var/www/certbot
|
|
-d "${DOMAIN}"
|
|
--agree-tos
|
|
--non-interactive
|
|
)
|
|
|
|
if [[ -n "${EMAIL}" ]]; then
|
|
CERTBOT_ARGS+=(--email "${EMAIL}")
|
|
else
|
|
CERTBOT_ARGS+=(--register-unsafely-without-email)
|
|
fi
|
|
|
|
docker compose "${CERTBOT_ARGS[@]}"
|
|
|
|
cp infrastructure/nginx/nginx.https.conf infrastructure/nginx/runtime/nginx.conf
|
|
docker compose up -d --force-recreate nginx
|
|
|
|
echo "HTTPS listo para ${DOMAIN}"
|