From d4d1e3dd19bfdfec47a417e69ac40bb3717cd010 Mon Sep 17 00:00:00 2001 From: Michael Barrett Date: Thu, 25 Sep 2025 14:59:00 +0100 Subject: [PATCH 1/4] Updated client config controller to reference updated script name ref https://linear.app/ghost/issue/PROD-2455 ref https://github.com/TryGhost/Ghost/pull/24985 The `admin-x-activitypub` script has been renamed to just `activitypub` so the client config endpoint should be updated to reflect this change --- adr/0002-frontend-backend-versioning.md | 4 ++-- src/http/api/client-config.controller.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adr/0002-frontend-backend-versioning.md b/adr/0002-frontend-backend-versioning.md index 9990519f0..c031b9722 100644 --- a/adr/0002-frontend-backend-versioning.md +++ b/adr/0002-frontend-backend-versioning.md @@ -62,9 +62,9 @@ Implement a backend-driven frontend configuration endpoint that tells the JS bun ```json { "client": { - "name": "admin-x-activitypub", + "name": "activitypub", "version": "^1.0.0", - "cdnUrl": "https://cdn.jsdelivr.net/ghost/admin-x-activitypub@1/dist/admin-x-activitypub.js" + "cdnUrl": "https://cdn.jsdelivr.net/ghost/activitypub@1/dist/activitypub.js" } } ``` diff --git a/src/http/api/client-config.controller.ts b/src/http/api/client-config.controller.ts index f29c890bd..fc2e6a421 100644 --- a/src/http/api/client-config.controller.ts +++ b/src/http/api/client-config.controller.ts @@ -5,7 +5,7 @@ export class ClientConfigController { @APIRoute('GET', 'client-config', 'stable') async handleGetClientConfig(_ctx: AppContext) { const major = 1; - const name = 'admin-x-activitypub'; + const name = 'activitypub'; const client = { name, version: `^${major}.0.0`, From b77446ee525d192bc7d05e9e86632966a048baa8 Mon Sep 17 00:00:00 2001 From: Michael Barrett Date: Mon, 13 Oct 2025 10:59:27 +0100 Subject: [PATCH 2/4] Temporary fix for ephemeral PR deployment --- .github/workflows/deploy-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index 6b55a9889..f8ff253e1 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -103,7 +103,7 @@ jobs: - name: Destroy Tests databases if: ${{ steps.check-labels.outputs.is_ephemeral_staging == 'true' }} env: - GCP_PROJECT: ghost-activitypub + GCP_PROJECT: ghost-activitypub-stg run: | TEST_DATABASES=$(gcloud sql databases list --instance=stg-netherlands-activitypub --filter="name~pr_${{ github.event.pull_request.number }}_test*" --format="value(name)" --project ${GCP_PROJECT}) for TEST_DATABASE in ${TEST_DATABASES}; do @@ -114,7 +114,7 @@ jobs: if: ${{ steps.check-labels.outputs.is_ephemeral_staging == 'true' }} env: LABELS: ${{ toJson(github.event.pull_request.labels) }} - GCP_PROJECT: ghost-activitypub + GCP_PROJECT: ghost-activitypub-stg run: | set -euo pipefail # Get current config From 91ec203447dd19022d0a5dcdc31e36cbc53669c8 Mon Sep 17 00:00:00 2001 From: Ricardo Pinto Date: Mon, 13 Oct 2025 11:19:19 +0100 Subject: [PATCH 3/4] Fixed load balancer gcp project --- .github/workflows/deploy-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index f8ff253e1..e85810902 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -122,8 +122,8 @@ jobs: # Delete unnecessary fields yq -i 'del(.fingerprint)' config.yml yq -i 'del(.creationTimestamp)' config.yml - export DEFAULT_SERVICE="https://www.googleapis.com/compute/v1/projects/ghost-activitypub/global/backendServices/stg-netherlands-activitypub-api" - export PR_SERVICE="https://www.googleapis.com/compute/v1/projects/ghost-activitypub/global/backendServices/stg-pr-${{ github.event.pull_request.number }}-api" + export DEFAULT_SERVICE="https://www.googleapis.com/compute/v1/projects/${GCP_PROJECT}/global/backendServices/stg-netherlands-activitypub-api" + export PR_SERVICE="https://www.googleapis.com/compute/v1/projects/${GCP_PROJECT}/global/backendServices/stg-pr-${{ github.event.pull_request.number }}-api" # Add host rules and path matchers if they don't exist yq -i '.hostRules = (.hostRules // [{"hosts": ["activitypub.ghostinfra.net"], "pathMatcher": "all-paths"}])' config.yml yq -i '.pathMatchers = (.pathMatchers // [{"name": "all-paths", "defaultService": "'"$DEFAULT_SERVICE"'", "routeRules": []}])' config.yml From e9fc280b5901baf2a68dfb5f8cfc44bf2cf507a9 Mon Sep 17 00:00:00 2001 From: Ricardo Pinto Date: Mon, 13 Oct 2025 13:26:31 +0100 Subject: [PATCH 4/4] Changed priority on load balancer --- .github/workflows/deploy-pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index e85810902..a1700b781 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -130,12 +130,12 @@ jobs: # Remove existing route rules for the PR service yq -i '.pathMatchers[] |= (.routeRules |= map(select((.routeAction.weightedBackendServices // []) | length == 0 or .routeAction.weightedBackendServices[0].backendService != env(PR_SERVICE))))' config.yml # Add new route rules for the PR service - export MAX_PRIORITY=$(yq '[.pathMatchers[] | select(.name == "all-paths") | .routeRules[]?.priority] | max // 0' config.yml) - export NEXT_PRIORITY=$((MAX_PRIORITY + 1)) + export MIN_PRIORITY=$(yq '[.pathMatchers[] | select(.name == "all-paths") | .routeRules[]?.priority] | min // 0' config.yml) + export NEXT_PRIORITY=$((MIN_PRIORITY - 1)) LABELS_JSON=$(echo "$LABELS" | jq -c '[.[] | select(.name | test("\\.ghost\\.is$")) | .name]') for LABEL in $(echo "$LABELS_JSON" | jq -r '.[]'); do echo "Adding route for label: $LABEL" - yq -i '.pathMatchers[0].routeRules += [{"priority": '$NEXT_PRIORITY', "matchRules": [{"prefixMatch": "/", "headerMatches": [{ "headerName": "X-Forwarded-Host", "exactMatch": "'$LABEL'" }]}], "routeAction": {"weightedBackendServices": [ { "backendService": "'$PR_SERVICE'", "weight": 100 } ] }, "headerAction": { "requestHeadersToAdd": [ { "headerName": "X-ActivityPub-PR", "headerValue": "${{ github.event.pull_request.number }}" }, { "headerName": "X-ActivityPub-Commit", "headerValue": "${{ github.event.pull_request.head.sha }}" } ] } }]' config.yml + yq -i '.pathMatchers[0].routeRules = [{"priority": '${NEXT_PRIORITY}', "matchRules": [{"prefixMatch": "/", "headerMatches": [{"headerName": "X-Forwarded-Host", "exactMatch": "'"${LABEL}"'"}]}], "routeAction": {"weightedBackendServices": [{"backendService": "'"${PR_SERVICE}"'", "weight": 100}]}, "headerAction": {"requestHeadersToAdd": [{"headerName": "X-ActivityPub-PR", "headerValue": "${{ github.event.pull_request.number }}"}, {"headerName": "X-ActivityPub-Commit", "headerValue": "${{ github.event.pull_request.head.sha }}"}]}}] + .pathMatchers[0].routeRules' config.yml export NEXT_PRIORITY=$((NEXT_PRIORITY + 1)) done echo "Updating url map with:"