From 38fb5b69b54f42ac80d26fb77fc965b93ccac99c Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Tue, 1 Dec 2026 19:53:07 +0000 Subject: [PATCH] ci: remove the legacy hosted-service deployment Production runs on prd-apps-us-central1, delivered by Kargo from the vX.Y.Z image tags that release.yml gives a commit's image (graphprotocol/graph-infra, templates/apps/docs). CI now only builds: - Remove ci-cd-production.yml, which on v* tags built the environment-baked graph-docs-production image and applied it to the hosted-service cluster with the GCP_THE_GRAPH_PRODUCTION key, and the scripts only it ran (kustomize-apply.sh, kubectl-wait-ready.sh, npx-wait-on/). - Remove the .k8s overlays for hosted-service and .terraform, which defined the graph-docs-ci-cd service accounts whose keys CI used to deploy there. - The image and release workflows' comments describe the delivery. Co-Authored-By: Claude Opus 5.5 --- .dockerignore | 2 - .github/scripts/kubectl-wait-ready.sh | 9 ---- .github/scripts/kustomize-apply.sh | 10 ---- .github/scripts/npx-wait-on/config.js | 5 -- .github/scripts/npx-wait-on/run.sh | 11 ---- .github/workflows/ci-cd-production.yml | 73 -------------------------- .github/workflows/image.yml | 6 +-- .github/workflows/release.yml | 4 +- .k8s/base/deployment.yaml | 26 --------- .k8s/base/kustomization.yaml | 3 -- .k8s/base/service.yaml | 12 ----- .k8s/production/auth.sh | 1 - .k8s/production/deployment.yaml | 13 ----- .k8s/production/ingress.yaml | 25 --------- .k8s/production/kustomization.yaml | 8 --- .k8s/staging/auth.sh | 1 - .k8s/staging/deployment.yaml | 12 ----- .k8s/staging/ingress.yaml | 25 --------- .k8s/staging/kustomization.yaml | 8 --- .terraform/.gitignore | 1 - .terraform/README.md | 24 --------- .terraform/config.tf | 15 ------ .terraform/main.tf | 9 ---- .terraform/module/config.tf | 11 ---- .terraform/module/service-accounts.tf | 19 ------- .terraform/versions.tf | 3 -- 26 files changed, 5 insertions(+), 331 deletions(-) delete mode 100755 .github/scripts/kubectl-wait-ready.sh delete mode 100755 .github/scripts/kustomize-apply.sh delete mode 100644 .github/scripts/npx-wait-on/config.js delete mode 100755 .github/scripts/npx-wait-on/run.sh delete mode 100644 .github/workflows/ci-cd-production.yml delete mode 100644 .k8s/base/deployment.yaml delete mode 100644 .k8s/base/kustomization.yaml delete mode 100644 .k8s/base/service.yaml delete mode 100755 .k8s/production/auth.sh delete mode 100644 .k8s/production/deployment.yaml delete mode 100644 .k8s/production/ingress.yaml delete mode 100644 .k8s/production/kustomization.yaml delete mode 100755 .k8s/staging/auth.sh delete mode 100644 .k8s/staging/deployment.yaml delete mode 100644 .k8s/staging/ingress.yaml delete mode 100644 .k8s/staging/kustomization.yaml delete mode 100644 .terraform/.gitignore delete mode 100644 .terraform/README.md delete mode 100644 .terraform/config.tf delete mode 100644 .terraform/main.tf delete mode 100644 .terraform/module/config.tf delete mode 100644 .terraform/module/service-accounts.tf delete mode 100644 .terraform/versions.tf diff --git a/.dockerignore b/.dockerignore index fc086ac60116..baec020f5799 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,7 +10,5 @@ build .next .git .github -.k8s -.terraform .npmrc key.json diff --git a/.github/scripts/kubectl-wait-ready.sh b/.github/scripts/kubectl-wait-ready.sh deleted file mode 100755 index 49742ef67bb0..000000000000 --- a/.github/scripts/kubectl-wait-ready.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e # immediately fail the script on any command error - -# wait 5 min for the new pod to be ready. If the pod is not ready there is a problem with the new container -for APP_NAME in "$@" -do - kubectl wait pod --for condition=Ready --timeout=300s \ - $(kubectl get pods -l app=$APP_NAME --sort-by {.metadata.creationTimestamp} -o jsonpath={.items[-1].metadata.name}) -done diff --git a/.github/scripts/kustomize-apply.sh b/.github/scripts/kustomize-apply.sh deleted file mode 100755 index 8fbed4171c0b..000000000000 --- a/.github/scripts/kustomize-apply.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e # immediately fail the script on any command error - -ENVIRONMENT="$1" -IMAGE="$2" -DIR=$(dirname "$0") -cd $DIR/../../.k8s/$ENVIRONMENT - -kustomize edit set image $IMAGE -kustomize build | kubectl apply -f - diff --git a/.github/scripts/npx-wait-on/config.js b/.github/scripts/npx-wait-on/config.js deleted file mode 100644 index 5ab9a26a885a..000000000000 --- a/.github/scripts/npx-wait-on/config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - headers: { - accept: 'text/html', // this avoids graphql endpoint error by returning the playground html - }, -} diff --git a/.github/scripts/npx-wait-on/run.sh b/.github/scripts/npx-wait-on/run.sh deleted file mode 100755 index 2dd2e87c62d8..000000000000 --- a/.github/scripts/npx-wait-on/run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -e # immediately fail the script on any command error - -DIR=$(dirname "$0") -TIMEOUT_MS=10000 - -npx wait-on \ - --verbose \ - --config $DIR/config.js \ - --timeout=$TIMEOUT_MS \ - "$@" diff --git a/.github/workflows/ci-cd-production.yml b/.github/workflows/ci-cd-production.yml deleted file mode 100644 index 3d6d99911d61..000000000000 --- a/.github/workflows/ci-cd-production.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Production CI/CD - -on: - push: - tags: - - v* - -env: - BASE_IMAGE: ghcr.io/graphprotocol/graph-docs-production - HEALTH_CHECK_URL: https://thegraph.com/docs - APP_NAME: graph-docs - -# The build runs on the Foundation's public runner pool gf-public-8 on forge. The deploy runs on a -# GitHub-hosted runner: it holds the production GCP credentials, which never go to forge's pools. -jobs: - build: - runs-on: gf-public-8 - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . # required to respect .dockerignore - cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest - cache-to: type=inline - build-args: | - ENVIRONMENT=production - ORIGIN=https://thegraph.com - tags: | - ${{ env.BASE_IMAGE }}:${{ github.sha }} - ${{ env.BASE_IMAGE }}:latest - push: true - - deploy: - runs-on: ubuntu-latest - needs: build - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Authenticate to GCP - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_THE_GRAPH_PRODUCTION }} - - - name: Set up kubectl - uses: google-github-actions/get-gke-credentials@v2 - with: - cluster_name: hosted-service - location: us-central1-a - - - name: Set a new k8s image and apply the manifests - run: .github/scripts/kustomize-apply.sh production $APP_NAME=$BASE_IMAGE:$GITHUB_SHA - - - name: Wait for pods to be ready - run: .github/scripts/kubectl-wait-ready.sh $APP_NAME - - - name: Check the endpoints - run: .github/scripts/npx-wait-on/run.sh $HEALTH_CHECK_URL diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 8f643247a26b..a1e7f8c5ec86 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -10,9 +10,9 @@ on: # nothing. The image is the same for every environment: the build takes no environment's values, # and each deployment sets the container's ENVIRONMENT (docker-entrypoint.sh). Every run pushes # ; only builds of the default branch move latest. -# Staging runs on stg-apps-us-central1, delivered by Argo CD and Kargo from -# graphprotocol/graph-infra: Kargo follows latest. A v* tag releases a commit's image under the -# tag's name (release.yml). +# Argo CD and Kargo deliver it from graphprotocol/graph-infra (templates/apps/docs): staging, on +# stg-apps-us-central1, follows latest; production, on prd-apps-us-central1, follows the vX.Y.Z +# tags that a release gives a commit's image (release.yml). # The build runs on the Foundation's public runner pool gf-public-8 on forge (8 vCPUs, a fresh VM # per job). diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e4f484ccbdb..be74f2ad90cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,8 +8,8 @@ on: # A v* tag of a commit on the default branch, once the checks pass, gets an image tag of the same # name: ghcr.io/graphprotocol/graph-docs: is the digest the default branch's build pushed as # (image.yml), nothing rebuilt. A version tag never moves to another image, and tags never -# move latest. Production Kargo follows these version tags (graphprotocol/graph-infra). -# ci-cd-production.yml still builds and deploys production from the same tags, separately. +# move latest. Production follows the vX.Y.Z tags through Kargo (graphprotocol/graph-infra, +# templates/apps/docs). # Both jobs run on the Foundation's public runner pool gf-public-4 on forge. diff --git a/.k8s/base/deployment.yaml b/.k8s/base/deployment.yaml deleted file mode 100644 index d8d89ce17cd1..000000000000 --- a/.k8s/base/deployment.yaml +++ /dev/null @@ -1,26 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: graph-docs -spec: - replicas: 1 - selector: - matchLabels: - app: graph-docs - template: - metadata: - labels: - app: graph-docs - spec: - imagePullSecrets: - - name: docker-registry - containers: - - name: app - image: graph-docs - ports: - - name: http - containerPort: 80 - protocol: TCP - readinessProbe: - httpGet: - port: http diff --git a/.k8s/base/kustomization.yaml b/.k8s/base/kustomization.yaml deleted file mode 100644 index 6d1374a18e3e..000000000000 --- a/.k8s/base/kustomization.yaml +++ /dev/null @@ -1,3 +0,0 @@ -resources: - - deployment.yaml - - service.yaml diff --git a/.k8s/base/service.yaml b/.k8s/base/service.yaml deleted file mode 100644 index 3fdf51763151..000000000000 --- a/.k8s/base/service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: graph-docs -spec: - type: ClusterIP - selector: - app: graph-docs - ports: - - name: http - port: 80 - protocol: TCP diff --git a/.k8s/production/auth.sh b/.k8s/production/auth.sh deleted file mode 100755 index 0a91fe7eb86d..000000000000 --- a/.k8s/production/auth.sh +++ /dev/null @@ -1 +0,0 @@ -gcloud container clusters get-credentials hosted-service --project the-graph-production --zone us-central1-a diff --git a/.k8s/production/deployment.yaml b/.k8s/production/deployment.yaml deleted file mode 100644 index 38872cbfb5b5..000000000000 --- a/.k8s/production/deployment.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: graph-docs -spec: - replicas: 5 - template: - spec: - containers: - - name: app - env: - - name: ENVIRONMENT - value: production diff --git a/.k8s/production/ingress.yaml b/.k8s/production/ingress.yaml deleted file mode 100644 index a4df9af5a6d6..000000000000 --- a/.k8s/production/ingress.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: graph-docs - annotations: - cert-manager.io/issuer: 'prod-cluster-origin-issuer' - cert-manager.io/issuer-kind: 'ClusterOriginIssuer' - cert-manager.io/issuer-group: 'cert-manager.k8s.cloudflare.com' -spec: - ingressClassName: nginx - tls: - - hosts: - - thegraph.com - secretName: thegraph-com-tls - rules: - - host: thegraph.com - http: - paths: - - backend: - service: - name: graph-docs - port: - name: http - path: /docs - pathType: Prefix diff --git a/.k8s/production/kustomization.yaml b/.k8s/production/kustomization.yaml deleted file mode 100644 index f3834146d109..000000000000 --- a/.k8s/production/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -bases: - - ../base -resources: - - ingress.yaml -patchesStrategicMerge: - - deployment.yaml diff --git a/.k8s/staging/auth.sh b/.k8s/staging/auth.sh deleted file mode 100755 index a7b3de91478e..000000000000 --- a/.k8s/staging/auth.sh +++ /dev/null @@ -1 +0,0 @@ -gcloud container clusters get-credentials hosted-service --project the-graph-staging --zone us-central1-a diff --git a/.k8s/staging/deployment.yaml b/.k8s/staging/deployment.yaml deleted file mode 100644 index e11e8ce64cb3..000000000000 --- a/.k8s/staging/deployment.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: graph-docs -spec: - template: - spec: - containers: - - name: app - env: - - name: ENVIRONMENT - value: staging diff --git a/.k8s/staging/ingress.yaml b/.k8s/staging/ingress.yaml deleted file mode 100644 index 2bcb20f7b1ab..000000000000 --- a/.k8s/staging/ingress.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: graph-docs - annotations: - cert-manager.io/issuer: 'staging-cluster-origin-issuer' - cert-manager.io/issuer-kind: 'ClusterOriginIssuer' - cert-manager.io/issuer-group: 'cert-manager.k8s.cloudflare.com' -spec: - ingressClassName: nginx - tls: - - hosts: - - staging.thegraph.com - secretName: staging-thegraph-com-tls - rules: - - host: staging.thegraph.com - http: - paths: - - backend: - service: - name: graph-docs - port: - name: http - path: /docs - pathType: Prefix diff --git a/.k8s/staging/kustomization.yaml b/.k8s/staging/kustomization.yaml deleted file mode 100644 index f3834146d109..000000000000 --- a/.k8s/staging/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -bases: - - ../base -resources: - - ingress.yaml -patchesStrategicMerge: - - deployment.yaml diff --git a/.terraform/.gitignore b/.terraform/.gitignore deleted file mode 100644 index e79eb2310521..000000000000 --- a/.terraform/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.terraform* diff --git a/.terraform/README.md b/.terraform/README.md deleted file mode 100644 index bdbdcfbf724a..000000000000 --- a/.terraform/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Graph Docs Terraform configs - -## Setup - -Initialize terraform and apply: - -``` -terraform init -terraform apply -``` - -Get service account JSON keys and add as github repo secrets: - -1. `GCP_SA_KEY_STAGING` - -``` -terraform show -json | jq -r '.values.root_module.child_modules[] | select(.address=="module.staging") | .resources[] | select(.address=="module.staging.google_service_account_key.graph-docs-ci-cd") | .values.private_key' | base64 -d -``` - -2. `GCP_SA_KEY_PRODUCTION` - -``` -terraform show -json | jq -r '.values.root_module.child_modules[] | select(.address=="module.production") | .resources[] | select(.address=="module.production.google_service_account_key.graph-docs-ci-cd") | .values.private_key' | base64 -d -``` diff --git a/.terraform/config.tf b/.terraform/config.tf deleted file mode 100644 index f71b68e7a02d..000000000000 --- a/.terraform/config.tf +++ /dev/null @@ -1,15 +0,0 @@ -terraform { - - required_providers { - tfe = { - version = "~> 0.44.0" - } - } - cloud { - organization = "edgeandnode" - - workspaces { - name = "tf-state-graph-docs" - } - } -} diff --git a/.terraform/main.tf b/.terraform/main.tf deleted file mode 100644 index 783cf76743e4..000000000000 --- a/.terraform/main.tf +++ /dev/null @@ -1,9 +0,0 @@ -module staging { - source = "./module" - project = "the-graph-staging" -} - -module production { - source = "./module" - project = "the-graph-production" -} diff --git a/.terraform/module/config.tf b/.terraform/module/config.tf deleted file mode 100644 index 0973cc7e5237..000000000000 --- a/.terraform/module/config.tf +++ /dev/null @@ -1,11 +0,0 @@ - -variable project { -} -variable zone { - default = "us-central1-a" -} - -provider "google" { - project = var.project - zone = var.zone -} diff --git a/.terraform/module/service-accounts.tf b/.terraform/module/service-accounts.tf deleted file mode 100644 index 642aec548c65..000000000000 --- a/.terraform/module/service-accounts.tf +++ /dev/null @@ -1,19 +0,0 @@ -# -# CI/CD -# -resource "google_service_account" "graph-docs-ci-cd" { - account_id = "graph-docs-ci-cd" - description = "For building containers and updating k8s resources in CI/CD" -} - -# role for interacting with k8s cluster -resource "google_project_iam_member" "graph-docs-ci-cd-container-developer" { - project = var.project - role = "roles/container.developer" - member = "serviceAccount:${google_service_account.graph-docs-ci-cd.email}" -} - -# Key to be put in github repo secrets -resource "google_service_account_key" "graph-docs-ci-cd" { - service_account_id = google_service_account.graph-docs-ci-cd.name -} diff --git a/.terraform/versions.tf b/.terraform/versions.tf deleted file mode 100644 index b61e9c1162cd..000000000000 --- a/.terraform/versions.tf +++ /dev/null @@ -1,3 +0,0 @@ -terraform { - required_version = "1.4.6" -}