Make embed proxy ports configurable via env vars for multi-instance deployments
All 13 nginx embed proxy ports (8881-8895) are now driven by environment variables instead of being hardcoded. This prevents port conflicts when running multiple Changemaker instances on the same host. Chain: .env → docker-compose port mappings → nginx container env → entrypoint.sh envsubst → services.conf.template listen directives → API /services/config endpoint → frontend buildServiceUrl(). Existing deployments are unaffected (all vars default to current values). Bunker Admin
This commit is contained in:
@@ -267,9 +267,10 @@ server {
|
||||
# --- Embed proxy ports (for iframe embedding without DNS/subdomain) ---
|
||||
# These listen on dedicated ports so the admin GUI can iframe services via
|
||||
# localhost:PORT, bypassing X-Frame-Options without needing *.localhost DNS.
|
||||
# Ports are configurable via env vars to avoid conflicts in multi-instance deployments.
|
||||
|
||||
server {
|
||||
listen 8881;
|
||||
listen ${NOCODB_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_nocodb http://changemaker-v2-nocodb:8080;
|
||||
proxy_pass $upstream_nocodb;
|
||||
@@ -283,7 +284,7 @@ server {
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8882;
|
||||
listen ${N8N_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_n8n http://n8n-changemaker:5678;
|
||||
proxy_pass $upstream_n8n;
|
||||
@@ -299,7 +300,7 @@ server {
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8883;
|
||||
listen ${GITEA_EMBED_PORT};
|
||||
# Increase max body size for large git pushes (2GB)
|
||||
client_max_body_size 2048M;
|
||||
location / {
|
||||
@@ -315,7 +316,7 @@ server {
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8884;
|
||||
listen ${MAILHOG_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_mailhog http://mailhog-changemaker:8025;
|
||||
proxy_pass $upstream_mailhog;
|
||||
@@ -331,7 +332,7 @@ server {
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8885;
|
||||
listen ${MINI_QR_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_miniqr http://mini-qr:8080;
|
||||
proxy_pass $upstream_miniqr;
|
||||
@@ -344,9 +345,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Excalidraw embed proxy (port 8886)
|
||||
# Excalidraw embed proxy
|
||||
server {
|
||||
listen 8886;
|
||||
listen ${EXCALIDRAW_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_excalidraw http://excalidraw-changemaker:80;
|
||||
proxy_pass $upstream_excalidraw;
|
||||
@@ -542,9 +543,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Homepage embed proxy (port 8887)
|
||||
# Homepage embed proxy
|
||||
server {
|
||||
listen 8887;
|
||||
listen ${HOMEPAGE_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_homepage http://homepage-changemaker:3000;
|
||||
proxy_pass $upstream_homepage;
|
||||
@@ -557,9 +558,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Vaultwarden embed proxy (port 8890)
|
||||
# Vaultwarden embed proxy
|
||||
server {
|
||||
listen 8890;
|
||||
listen ${VAULTWARDEN_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_vaultwarden http://vaultwarden-changemaker:80;
|
||||
proxy_pass $upstream_vaultwarden;
|
||||
@@ -575,9 +576,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Rocket.Chat embed proxy (port 8891)
|
||||
# Rocket.Chat embed proxy
|
||||
server {
|
||||
listen 8891;
|
||||
listen ${ROCKETCHAT_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_rocketchat http://rocketchat-changemaker:3000;
|
||||
proxy_pass $upstream_rocketchat;
|
||||
@@ -594,9 +595,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Gancio embed proxy (port 8892)
|
||||
# Gancio embed proxy
|
||||
server {
|
||||
listen 8892;
|
||||
listen ${GANCIO_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_gancio http://gancio-changemaker:13120;
|
||||
proxy_pass $upstream_gancio;
|
||||
@@ -609,9 +610,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Jitsi Meet embed proxy (port 8893)
|
||||
# Jitsi Meet embed proxy
|
||||
server {
|
||||
listen 8893;
|
||||
listen ${JITSI_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_jitsi http://jitsi-web-changemaker:80;
|
||||
proxy_pass $upstream_jitsi;
|
||||
@@ -627,9 +628,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Grafana embed proxy (port 8894)
|
||||
# Grafana embed proxy
|
||||
server {
|
||||
listen 8894;
|
||||
listen ${GRAFANA_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_grafana http://grafana-changemaker:3000;
|
||||
proxy_pass $upstream_grafana;
|
||||
@@ -644,9 +645,9 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# Alertmanager embed proxy (port 8895)
|
||||
# Alertmanager embed proxy
|
||||
server {
|
||||
listen 8895;
|
||||
listen ${ALERTMANAGER_EMBED_PORT};
|
||||
location / {
|
||||
set $upstream_alertmanager http://alertmanager-changemaker:9093;
|
||||
proxy_pass $upstream_alertmanager;
|
||||
|
||||
@@ -4,12 +4,36 @@ set -e
|
||||
# Default domain if not set
|
||||
export DOMAIN=${DOMAIN:-cmlite.org}
|
||||
|
||||
# Default embed proxy ports (configurable via .env for multi-instance deployments)
|
||||
export NOCODB_EMBED_PORT=${NOCODB_EMBED_PORT:-8881}
|
||||
export N8N_EMBED_PORT=${N8N_EMBED_PORT:-8882}
|
||||
export GITEA_EMBED_PORT=${GITEA_EMBED_PORT:-8883}
|
||||
export MAILHOG_EMBED_PORT=${MAILHOG_EMBED_PORT:-8884}
|
||||
export MINI_QR_EMBED_PORT=${MINI_QR_EMBED_PORT:-8885}
|
||||
export EXCALIDRAW_EMBED_PORT=${EXCALIDRAW_EMBED_PORT:-8886}
|
||||
export HOMEPAGE_EMBED_PORT=${HOMEPAGE_EMBED_PORT:-8887}
|
||||
export VAULTWARDEN_EMBED_PORT=${VAULTWARDEN_EMBED_PORT:-8890}
|
||||
export ROCKETCHAT_EMBED_PORT=${ROCKETCHAT_EMBED_PORT:-8891}
|
||||
export GANCIO_EMBED_PORT=${GANCIO_EMBED_PORT:-8892}
|
||||
export JITSI_EMBED_PORT=${JITSI_EMBED_PORT:-8893}
|
||||
export GRAFANA_EMBED_PORT=${GRAFANA_EMBED_PORT:-8894}
|
||||
export ALERTMANAGER_EMBED_PORT=${ALERTMANAGER_EMBED_PORT:-8895}
|
||||
|
||||
echo "Configuring nginx for domain: $DOMAIN"
|
||||
|
||||
# List of environment variables to substitute in templates
|
||||
# IMPORTANT: must be explicit to avoid replacing nginx variables like $host, $remote_addr
|
||||
VARS='${DOMAIN}'
|
||||
VARS="${VARS} \${NOCODB_EMBED_PORT} \${N8N_EMBED_PORT} \${GITEA_EMBED_PORT}"
|
||||
VARS="${VARS} \${MAILHOG_EMBED_PORT} \${MINI_QR_EMBED_PORT} \${EXCALIDRAW_EMBED_PORT}"
|
||||
VARS="${VARS} \${HOMEPAGE_EMBED_PORT} \${VAULTWARDEN_EMBED_PORT} \${ROCKETCHAT_EMBED_PORT}"
|
||||
VARS="${VARS} \${GANCIO_EMBED_PORT} \${JITSI_EMBED_PORT} \${GRAFANA_EMBED_PORT}"
|
||||
VARS="${VARS} \${ALERTMANAGER_EMBED_PORT}"
|
||||
|
||||
# Template nginx configuration files with environment variables
|
||||
envsubst '${DOMAIN}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
envsubst '${DOMAIN}' < /etc/nginx/conf.d/api.conf.template > /etc/nginx/conf.d/api.conf
|
||||
envsubst '${DOMAIN}' < /etc/nginx/conf.d/services.conf.template > /etc/nginx/conf.d/services.conf
|
||||
envsubst "$VARS" < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
envsubst "$VARS" < /etc/nginx/conf.d/api.conf.template > /etc/nginx/conf.d/api.conf
|
||||
envsubst "$VARS" < /etc/nginx/conf.d/services.conf.template > /etc/nginx/conf.d/services.conf
|
||||
|
||||
echo "Nginx configuration templated successfully"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user