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:
2026-03-25 15:25:00 -06:00
parent 63e05adcee
commit abdfd50cb8
24 changed files with 1679 additions and 95 deletions

View File

@@ -0,0 +1,67 @@
-- CreateEnum
CREATE TYPE "UpgradeStatus" AS ENUM ('PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED', 'ROLLED_BACK');
-- CreateEnum
CREATE TYPE "EventSeverity" AS ENUM ('ERROR', 'WARNING', 'INFO');
-- CreateTable
CREATE TABLE "instance_upgrades" (
"id" TEXT NOT NULL,
"instance_id" TEXT NOT NULL,
"status" "UpgradeStatus" NOT NULL DEFAULT 'PENDING',
"previous_commit" TEXT,
"new_commit" TEXT,
"commit_count" INTEGER NOT NULL DEFAULT 0,
"branch" TEXT NOT NULL DEFAULT 'v2',
"current_phase" INTEGER NOT NULL DEFAULT 0,
"phase_name" TEXT,
"percentage" INTEGER NOT NULL DEFAULT 0,
"progress_message" TEXT,
"duration_seconds" INTEGER,
"error_message" TEXT,
"warnings" JSONB,
"log" TEXT,
"triggered_by_id" TEXT,
"started_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"completed_at" TIMESTAMP(3),
CONSTRAINT "instance_upgrades_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "instance_events" (
"id" TEXT NOT NULL,
"instance_id" TEXT NOT NULL,
"severity" "EventSeverity" NOT NULL,
"source" TEXT NOT NULL,
"title" TEXT NOT NULL,
"message" TEXT NOT NULL,
"metadata" JSONB,
"acknowledged" BOOLEAN NOT NULL DEFAULT false,
"acknowledged_at" TIMESTAMP(3),
"acknowledged_by_id" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "instance_events_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "instance_upgrades_instance_id_started_at_idx" ON "instance_upgrades"("instance_id", "started_at");
-- CreateIndex
CREATE INDEX "instance_events_instance_id_created_at_idx" ON "instance_events"("instance_id", "created_at");
-- CreateIndex
CREATE INDEX "instance_events_severity_acknowledged_idx" ON "instance_events"("severity", "acknowledged");
-- AddForeignKey
ALTER TABLE "instance_upgrades" ADD CONSTRAINT "instance_upgrades_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "instance_upgrades" ADD CONSTRAINT "instance_upgrades_triggered_by_id_fkey" FOREIGN KEY ("triggered_by_id") REFERENCES "ccp_users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "instance_events" ADD CONSTRAINT "instance_events_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "instance_events" ADD CONSTRAINT "instance_events_acknowledged_by_id_fkey" FOREIGN KEY ("acknowledged_by_id") REFERENCES "ccp_users"("id") ON DELETE SET NULL ON UPDATE CASCADE;