From 774db7ba53691d97444707a65695646f67d0976d Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Tue, 7 Apr 2026 00:07:17 +0200 Subject: [PATCH] revert: restore to last working state (b3ac8a6) Revert all Traefik port 3002 and ADMIN_ENDPOINT changes that broke bootstrap. Admin console HTTPS access needs a different approach. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker-compose.dev.yml | 1 + docker-compose.yml | 8 +------- docker/logto-bootstrap.sh | 10 ++++++---- traefik.yml | 2 -- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index feb22f6..580577f 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -8,6 +8,7 @@ services: logto: ports: - "3001:3001" + - "3002:3002" cameleer-saas: ports: diff --git a/docker-compose.yml b/docker-compose.yml index 57df218..94995e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,6 @@ services: ports: - "80:80" - "443:443" - - "3002:3002" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./traefik.yml:/etc/traefik/traefik.yml:ro @@ -67,7 +66,7 @@ services: environment: DB_URL: postgres://${POSTGRES_USER:-cameleer}:${POSTGRES_PASSWORD:-cameleer_dev}@postgres:5432/logto ENDPOINT: ${PUBLIC_PROTOCOL:-https}://${PUBLIC_HOST:-localhost} - ADMIN_ENDPOINT: http://localhost:3002 + ADMIN_ENDPOINT: http://${PUBLIC_HOST:-localhost}:3002 TRUST_PROXY_HEADER: 1 healthcheck: test: ["CMD-SHELL", "node -e \"require('http').get('http://localhost:3001/oidc/.well-known/openid-configuration', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))\""] @@ -82,11 +81,6 @@ services: - traefik.http.routers.logto.entrypoints=websecure - traefik.http.routers.logto.tls=true - traefik.http.services.logto.loadbalancer.server.port=3001 - - traefik.http.routers.logto-console.rule=PathPrefix(`/`) - - traefik.http.routers.logto-console.entrypoints=admin-console - - traefik.http.routers.logto-console.tls=true - - traefik.http.routers.logto-console.service=logto-console - - traefik.http.services.logto-console.loadbalancer.server.port=3002 networks: - cameleer diff --git a/docker/logto-bootstrap.sh b/docker/logto-bootstrap.sh index 10a68e7..6cd4e54 100644 --- a/docker/logto-bootstrap.sh +++ b/docker/logto-bootstrap.sh @@ -98,6 +98,7 @@ M_DEFAULT_SECRET=$(psql -h "$PG_HOST" -U "$PG_USER" -d "$PG_DB_LOGTO" -t -A -c \ get_admin_token() { curl -s -X POST "${LOGTO_ADMIN_ENDPOINT}/oidc/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ + -H "Host: ${HOST}:3002" \ -d "grant_type=client_credentials&client_id=${1}&client_secret=${2}&resource=${MGMT_API_RESOURCE}&scope=all" } @@ -114,7 +115,7 @@ TOKEN=$(echo "$TOKEN_RESPONSE" | jq -r '.access_token' 2>/dev/null) [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ] && { log "ERROR: Failed to get token"; exit 1; } log "Got Management API token." -# --- Helper: Logto API calls (default tenant, port 3001) --- +# --- Helper: Logto API calls --- api_get() { curl -s -H "Authorization: Bearer $TOKEN" -H "Host: ${HOST}" "${LOGTO_ENDPOINT}${1}" 2>/dev/null || echo "[]" } @@ -389,6 +390,7 @@ if [ -z "$M_ADMIN_SECRET" ]; then else ADMIN_TOKEN_RESPONSE=$(curl -s -X POST "${LOGTO_ADMIN_ENDPOINT}/oidc/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ + -H "Host: ${HOST}:3002" \ -d "grant_type=client_credentials&client_id=m-admin&client_secret=${M_ADMIN_SECRET}&resource=${ADMIN_MGMT_RESOURCE}&scope=all") ADMIN_TOKEN=$(echo "$ADMIN_TOKEN_RESPONSE" | jq -r '.access_token' 2>/dev/null) @@ -400,14 +402,14 @@ else # Admin-tenant API helpers (port 3002, admin token) admin_api_get() { - curl -s -H "Authorization: Bearer $ADMIN_TOKEN" "${LOGTO_ADMIN_ENDPOINT}${1}" 2>/dev/null || echo "[]" + curl -s -H "Authorization: Bearer $ADMIN_TOKEN" -H "Host: ${HOST}:3002" "${LOGTO_ADMIN_ENDPOINT}${1}" 2>/dev/null || echo "[]" } admin_api_post() { - curl -s -X POST -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \ + curl -s -X POST -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" -H "Host: ${HOST}:3002" \ -d "$2" "${LOGTO_ADMIN_ENDPOINT}${1}" 2>/dev/null || true } admin_api_patch() { - curl -s -X PATCH -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \ + curl -s -X PATCH -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" -H "Host: ${HOST}:3002" \ -d "$2" "${LOGTO_ADMIN_ENDPOINT}${1}" 2>/dev/null || true } diff --git a/traefik.yml b/traefik.yml index 27df844..7ea7535 100644 --- a/traefik.yml +++ b/traefik.yml @@ -11,8 +11,6 @@ entryPoints: scheme: https websecure: address: ":443" - admin-console: - address: ":3002" providers: docker: