diff --git a/docker-compose.yml b/docker-compose.yml index ee3b922..2f8c5e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,6 +36,12 @@ services: # setup.sh sets this from the host, where the submodule resolves # correctly (git -C sso-manager-node rev-parse --short HEAD). GIT_COMMIT: ${SSO_GIT_COMMIT:-} + # Optional upstream HTTP(S) proxy for npm/apt during the build (NOT + # the theta42 "proxy" app). Set CFG_HTTP_PROXY in setup.env; empty by + # default, so this is a no-op unless configured. + HTTP_PROXY: ${CFG_HTTP_PROXY:-} + HTTPS_PROXY: ${CFG_HTTPS_PROXY:-} + NO_PROXY: ${CFG_NO_PROXY:-} container_name: sso-manager restart: unless-stopped networks: [theta-net] @@ -58,6 +64,11 @@ services: - NODE_PORT=3001 - LDAP_SERVER_ID=${LDAP_SERVER_ID:-} - LDAP_REPLICATION_HOSTS=${LDAP_REPLICATION_HOSTS:-} + # Optional upstream HTTP(S) proxy for outbound calls (SMTP, etc.) at + # runtime. See the build args above for the same setting during build. + - HTTP_PROXY=${CFG_HTTP_PROXY:-} + - HTTPS_PROXY=${CFG_HTTPS_PROXY:-} + - NO_PROXY=${CFG_NO_PROXY:-} volumes: # Operator-edited SSO secrets (sso-secrets.js). Read-WRITE so the bootstrap # can write the generated OAuth client creds into proxy-secrets.js. The @@ -91,6 +102,11 @@ services: # setup.sh sets this from the host, where the submodule resolves # correctly (git -C proxy rev-parse --short HEAD). GIT_COMMIT: ${PROXY_GIT_COMMIT:-} + # Optional upstream HTTP(S) proxy for npm/apt during the build. See + # the sso-manager service above for details. + HTTP_PROXY: ${CFG_HTTP_PROXY:-} + HTTPS_PROXY: ${CFG_HTTPS_PROXY:-} + NO_PROXY: ${CFG_NO_PROXY:-} container_name: proxy restart: unless-stopped networks: [theta-net] @@ -110,6 +126,11 @@ services: # not from env. NODE_ENV/NODE_PORT are process env the app reads directly. - NODE_ENV=production - NODE_PORT=3000 + # Optional upstream HTTP(S) proxy for outbound calls (ACME/Let's + # Encrypt, DNS providers) at runtime. + - HTTP_PROXY=${CFG_HTTP_PROXY:-} + - HTTPS_PROXY=${CFG_HTTPS_PROXY:-} + - NO_PROXY=${CFG_NO_PROXY:-} volumes: # Operator-edited proxy secrets (proxy-secrets.js). READ-ONLY — the proxy # only reads it; the sso-manager bootstrap writes the OAuth creds. The @@ -142,6 +163,11 @@ services: dockerfile: Dockerfile args: GIT_COMMIT: ${JUMP_GIT_COMMIT:-} + # Optional upstream HTTP(S) proxy for npm/apt during the build. See + # the sso-manager service above for details. + HTTP_PROXY: ${CFG_HTTP_PROXY:-} + HTTPS_PROXY: ${CFG_HTTPS_PROXY:-} + NO_PROXY: ${CFG_NO_PROXY:-} container_name: jump-host restart: unless-stopped networks: [theta-net] @@ -153,6 +179,11 @@ services: - "${JUMP_WEB_BIND:-0.0.0.0}:${JUMP_WEB_PORT:-3002}:3002" # web UI/API environment: - NODE_ENV=production + # Optional upstream HTTP(S) proxy for outbound calls (the directory API + # client) at runtime. + - HTTP_PROXY=${CFG_HTTP_PROXY:-} + - HTTPS_PROXY=${CFG_HTTPS_PROXY:-} + - NO_PROXY=${CFG_NO_PROXY:-} volumes: - ./config:/config:ro # jump-secrets.js (written by ensure_config/bootstrap) - jump-data:/var/lib/jump-host # generated host keys persist here diff --git a/setup.env.example b/setup.env.example index 2469fbb..5b32ca7 100644 --- a/setup.env.example +++ b/setup.env.example @@ -49,6 +49,19 @@ CFG_DOMAIN=example.com # under an OU-style prefix). Leave unset to use the DN built from CFG_DOMAIN: #CFG_BASE_DN=dc=example,dc=com +# ── Optional outbound HTTP(S) proxy ────────────────────────────────────────── +# For an isolated/offline/corporate-network test host that only reaches the +# internet through an upstream HTTP proxy — NOT the theta42 "proxy" app. +# Wired into every service's docker build (npm/apt) AND its running container +# (SMTP, ACME/Let's Encrypt, DNS provider calls, the jump-host directory API +# client). Leave unset to disable (the default); CFG_HTTPS_PROXY falls back to +# CFG_HTTP_PROXY if unset, and CFG_NO_PROXY defaults to covering the stack's +# own internal service names so container-to-container traffic never goes +# through the proxy. +#CFG_HTTP_PROXY=http://proxy.example.com:3128 +#CFG_HTTPS_PROXY=http://proxy.example.com:3128 +#CFG_NO_PROXY=localhost,127.0.0.1,sso-manager,proxy,jump-host + # Optional — sensible defaults if left blank: #CFG_ORG=SSO Manager # app display name + outbound email org #CFG_ADMIN_UID=admin # initial SSO admin username diff --git a/setup.sh b/setup.sh index f6264b5..37d5a22 100755 --- a/setup.sh +++ b/setup.sh @@ -165,6 +165,22 @@ export CFG_JUMP_HOST_ENABLED CFG_JUMP_HOST # When enabled, activate the compose profile so `up`/`ps` include the service. if [[ "$JUMP_ENABLED" == "1" ]]; then export COMPOSE_PROFILES="jump-host"; fi +# ── Optional outbound HTTP(S) proxy for docker build + the running containers ─ +# CFG_HTTP_PROXY / CFG_HTTPS_PROXY / CFG_NO_PROXY (from ./setup.env or the +# environment) — NOT the theta42 "proxy" app; this is an upstream HTTP proxy +# for reaching the internet (npm/apt during image builds, and SMTP/ACME/DNS +# provider calls at runtime), useful on isolated/offline/corporate-network +# test hosts. Off by default. docker-compose.yml passes these through as both +# build args (Docker also recognizes them as predefined build ARGs) and +# container environment on every service, so one setup.env entry covers the +# whole stack. +export CFG_HTTP_PROXY="${CFG_HTTP_PROXY:-}" +export CFG_HTTPS_PROXY="${CFG_HTTPS_PROXY:-${CFG_HTTP_PROXY:-}}" +export CFG_NO_PROXY="${CFG_NO_PROXY:-localhost,127.0.0.1,sso-manager,proxy,jump-host}" +if [[ -n "$CFG_HTTP_PROXY" ]]; then + info "Using HTTP proxy for docker build + containers: $CFG_HTTP_PROXY" +fi + # ── 1. Update submodules to their latest release tag, verify build contexts ─── # Submodules track release tags (vX.Y.Z), not the tip of master -- so # "update" means "move to the newest tag", not "move to the newest commit".