fix(deploy): mount TLS certs via named volume ff-certs (host /certs did not exist for nginx)

This commit is contained in:
Pepe44DEV
2026-09-06 23:20:51 +00:00
parent 19120b713c
commit cf156c315a
+4 -3
View File
@@ -11,9 +11,9 @@ set -uo pipefail
# Required mounts: # Required mounts:
# /var/run/docker.sock:/var/run/docker.sock # /var/run/docker.sock:/var/run/docker.sock
# <host>/src:/app/src persistent git checkout + state # <host>/src:/app/src persistent git checkout + state
# <host>/certs:/certs TLS certificates (rw, generated on demand) # ff-certs:/certs TLS certificates named volume (rw)
# ff-nginx-conf:/cfg shared nginx config named volume (rw) # ff-nginx-conf:/cfg shared nginx config named volume (rw)
# create: docker volume create ff-nginx-conf # create: docker volume create ff-certs; docker volume create ff-nginx-conf
# ============================================================================ # ============================================================================
log() { echo "[deployer] $(date '+%F %T') $*"; } log() { echo "[deployer] $(date '+%F %T') $*"; }
@@ -69,6 +69,7 @@ ensure_network() {
} }
ensure_certs() { ensure_certs() {
docker volume create ff-certs >/dev/null 2>&1 || true
if [ ! -f "$CERT_DIR/fleetforge.pem" ] || [ ! -f "$CERT_DIR/fleetforge-key.pem" ]; then if [ ! -f "$CERT_DIR/fleetforge.pem" ] || [ ! -f "$CERT_DIR/fleetforge-key.pem" ]; then
log "generating self-signed certificate for $HOST_IP" log "generating self-signed certificate for $HOST_IP"
mkdir -p "$CERT_DIR" mkdir -p "$CERT_DIR"
@@ -148,7 +149,7 @@ run_containers() {
docker run -d --name ff-nginx --restart unless-stopped --network "$NETWORK" \ docker run -d --name ff-nginx --restart unless-stopped --network "$NETWORK" \
-p "$HTTPS_PORT:443" \ -p "$HTTPS_PORT:443" \
-p "$HTTP_PORT:80" \ -p "$HTTP_PORT:80" \
-v "$CERT_DIR:/etc/nginx/certs:ro" \ -v "ff-certs:/etc/nginx/certs:ro" \
-v "ff-nginx-conf:/etc/nginx/conf.d:ro" \ -v "ff-nginx-conf:/etc/nginx/conf.d:ro" \
nginx:1.27-alpine nginx:1.27-alpine
} }