From adbbbbee8ab46f86d17cdbbe582d553fb4376e04 Mon Sep 17 00:00:00 2001 From: Seasons Change <1204992313@qq.com> Date: Wed, 11 Nov 2026 11:56:34 +0800 Subject: [PATCH] ci: deploy releases to the K3s cluster instead of the Docker host Plane moved from docker compose on 207.57.124.102 to the K3s cluster (namespace plane, database "plane" in the shared CloudNativePG cluster pg-main). The deploy job no longer uses sshpass and deploy.sh: - add deployments/k3s/plane.yaml (the manifests running in the cluster, with __DOCKER_USERNAME__/__VERSION__ placeholders), migrator-job.yaml and backup-job.yaml - deploy job: pg_dump into PVC plane-predeploy-backups, run the migrator Job, apply the manifests, wait for every Deployment and roll the application Deployments back if any of them fails, then check the public URL - prepare job validates KUBE_CONFIG instead of SERVER_IP/USER/PWD - needs repository secret KUBE_CONFIG (ServiceAccount plane/ci-deployer) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-deploy.yml | 131 ++++----- deployments/k3s/backup-job.yaml | 34 +++ deployments/k3s/migrator-job.yaml | 20 ++ deployments/k3s/plane.yaml | 395 +++++++++++++++++++++++++++ deployments/production/README.md | 17 ++ 5 files changed, 524 insertions(+), 73 deletions(-) create mode 100644 deployments/k3s/backup-job.yaml create mode 100644 deployments/k3s/migrator-job.yaml create mode 100644 deployments/k3s/plane.yaml diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml index 6477a0f03d9a..f12f2b689e32 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/release-deploy.yml @@ -20,7 +20,6 @@ concurrency: env: PUBLIC_URL: https://plane.tmlab.top - PLANE_HTTP_PORT: "6767" jobs: prepare: @@ -32,29 +31,19 @@ jobs: - name: Validate deployment configuration shell: bash env: - SERVER_IP: ${{ secrets.SERVER_IP }} - SERVER_USER: ${{ secrets.SERVER_USER }} - SERVER_PWD: ${{ secrets.SERVER_PWD }} + KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} run: | set -euo pipefail - for secret_name in SERVER_IP SERVER_USER SERVER_PWD DOCKER_USERNAME DOCKER_PASSWORD; do + for secret_name in KUBE_CONFIG DOCKER_USERNAME DOCKER_PASSWORD; do if [[ -z "${!secret_name:-}" ]]; then echo "::error::Required GitHub Secret ${secret_name} is not configured." exit 1 fi done - [[ "$SERVER_IP" =~ ^[A-Za-z0-9][A-Za-z0-9.:-]*$ ]] || { - echo "::error::SERVER_IP contains unsupported characters." - exit 1 - } - [[ "$SERVER_USER" =~ ^[A-Za-z0-9._-]+$ ]] || { - echo "::error::SERVER_USER contains unsupported characters." - exit 1 - } [[ "$DOCKER_USERNAME" =~ ^[a-z0-9]+([._-][a-z0-9]+)*$ ]] || { echo "::error::DOCKER_USERNAME is not a valid Docker Hub namespace." exit 1 @@ -146,90 +135,84 @@ jobs: runs-on: ubuntu-24.04 environment: production env: + # Production runs on the K3s cluster (k3s.seasonschange.cn), namespace plane. + # KUBE_CONFIG is a kubeconfig for the namespace-scoped ServiceAccount plane/ci-deployer. + NAMESPACE: plane VERSION: ${{ needs.prepare.outputs.version }} - SERVER_IP: ${{ secrets.SERVER_IP }} - SERVER_USER: ${{ secrets.SERVER_USER }} - SSHPASS: ${{ secrets.SERVER_PWD }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + APP_DEPLOYMENTS: api worker beat-worker web admin space live mcp proxy steps: - name: Check out repository uses: actions/checkout@v6 - - name: Install SSH client dependencies - run: | - sudo apt-get update - sudo apt-get install --yes sshpass - - - name: Trust production SSH host key + - name: Configure cluster access shell: bash + env: + KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} run: | set -euo pipefail - expected_fingerprint="SHA256:jmzl6o5sZWlfwF2Ncg6hrEf7lluI0iDfp7t1W2MJwRk" - scanned_key_file="$RUNNER_TEMP/production-ed25519-host-key" - known_hosts_file="$HOME/.ssh/known_hosts" - - install -d -m 700 "$HOME/.ssh" - if ! ssh-keyscan -p 22 -T 10 -t ed25519 -H "$SERVER_IP" > "$scanned_key_file" 2>/dev/null; then - echo "::error::Could not retrieve the production ED25519 SSH host key." - exit 1 - fi - if [[ ! -s "$scanned_key_file" ]]; then - echo "::error::The production server returned no ED25519 SSH host key." - exit 1 - fi - - mapfile -t fingerprints < <( - ssh-keygen -lf "$scanned_key_file" -E sha256 \ - | awk '$NF == "(ED25519)" {print $2}' \ - | sort -u - ) - if [[ "${#fingerprints[@]}" -ne 1 || "${fingerprints[0]:-}" != "$expected_fingerprint" ]]; then - echo "::error::Production ED25519 SSH host key fingerprint does not match the manually verified fingerprint." - exit 1 - fi + install -m 700 -d "$HOME/.kube" + printf '%s\n' "$KUBE_CONFIG" > "$HOME/.kube/config" + chmod 600 "$HOME/.kube/config" + kubectl -n "$NAMESPACE" get deployment api - install -m 600 "$scanned_key_file" "$known_hosts_file" - - - name: Prepare deployment directory + - name: Render manifests shell: bash run: | set -euo pipefail - sshpass -e ssh -p 22 -o StrictHostKeyChecking=yes \ - "$SERVER_USER@$SERVER_IP" 'install -d -m 700 "$HOME/plane"' + mkdir -p "$RUNNER_TEMP/k3s" + for f in deployments/k3s/*.yaml; do + sed -e "s|__DOCKER_USERNAME__|$DOCKER_USERNAME|g" -e "s|__VERSION__|$VERSION|g" "$f" \ + > "$RUNNER_TEMP/k3s/$(basename "$f")" + done + ! grep -n "__[A-Z_]*__" "$RUNNER_TEMP"/k3s/*.yaml + echo "Previous release: $(kubectl -n "$NAMESPACE" get deployment api -o jsonpath='{.spec.template.spec.containers[0].image}')" - - name: Log in to Docker Hub on server + # Django migrations are not reversible, so dump the database before running them. + - name: Back up database shell: bash run: | set -euo pipefail - remote_docker_username=$(printf '%q' "$DOCKER_USERNAME") - printf '%s' "$DOCKER_PASSWORD" | \ - sshpass -e ssh -p 22 -o StrictHostKeyChecking=yes \ - "$SERVER_USER@$SERVER_IP" \ - "docker login --username $remote_docker_username --password-stdin" + kubectl -n "$NAMESPACE" delete job plane-predeploy-backup --ignore-not-found --wait=true + kubectl -n "$NAMESPACE" apply -f "$RUNNER_TEMP/k3s/backup-job.yaml" + if ! kubectl -n "$NAMESPACE" wait --for=condition=complete job/plane-predeploy-backup --timeout=10m; then + kubectl -n "$NAMESPACE" logs job/plane-predeploy-backup --tail=50 || true + echo "::error::Pre-release database backup failed; nothing was changed." + exit 1 + fi + kubectl -n "$NAMESPACE" logs job/plane-predeploy-backup - - name: Copy deployment assets + - name: Run database migrations shell: bash run: | set -euo pipefail - sshpass -e scp -P 22 -o StrictHostKeyChecking=yes \ - deployments/cli/community/docker-compose.yml \ - deployments/production/docker-compose.override.yml \ - deployments/production/deploy.sh \ - "$SERVER_USER@$SERVER_IP:~/plane/" + kubectl -n "$NAMESPACE" delete job plane-migrator --ignore-not-found --wait=true + kubectl -n "$NAMESPACE" apply -f "$RUNNER_TEMP/k3s/migrator-job.yaml" + if ! kubectl -n "$NAMESPACE" wait --for=condition=complete job/plane-migrator --timeout=15m; then + kubectl -n "$NAMESPACE" logs job/plane-migrator --tail=100 || true + echo "::error::Migrations failed. The running release was not changed; the pre-release dump is in PVC plane-predeploy-backups." + exit 1 + fi + kubectl -n "$NAMESPACE" logs job/plane-migrator --tail=20 - - name: Run production deployment + - name: Roll out release shell: bash run: | set -euo pipefail - remote_version=$(printf '%q' "$VERSION") - remote_docker_username=$(printf '%q' "$DOCKER_USERNAME") - remote_public_url=$(printf '%q' "$PUBLIC_URL") - remote_http_port=$(printf '%q' "$PLANE_HTTP_PORT") - - sshpass -e ssh -p 22 -o StrictHostKeyChecking=yes \ - "$SERVER_USER@$SERVER_IP" \ - "cd \"\$HOME/plane\" && chmod 700 deploy.sh && ./deploy.sh $remote_version $remote_docker_username $remote_public_url $remote_http_port" + kubectl -n "$NAMESPACE" apply -f "$RUNNER_TEMP/k3s/plane.yaml" + failed="" + for d in $APP_DEPLOYMENTS; do + kubectl -n "$NAMESPACE" rollout status "deployment/$d" --timeout=10m || failed="$failed $d" + done + if [[ -n "$failed" ]]; then + kubectl -n "$NAMESPACE" get pods -o wide || true + for d in $failed; do kubectl -n "$NAMESPACE" logs "deployment/$d" --tail=60 || true; done + echo "::warning::Rolling back application deployments" + for d in $APP_DEPLOYMENTS; do kubectl -n "$NAMESPACE" rollout undo "deployment/$d" || true; done + for d in $APP_DEPLOYMENTS; do kubectl -n "$NAMESPACE" rollout status "deployment/$d" --timeout=10m || true; done + echo "::error::Release $VERSION failed to become ready on:$failed (application images rolled back; migrations were not reversed)." + exit 1 + fi - name: Verify production externally shell: bash @@ -237,8 +220,10 @@ jobs: set -euo pipefail curl --fail --show-error --silent \ --retry 30 --retry-delay 10 --retry-all-errors \ - --resolve "plane.tmlab.top:443:$SERVER_IP" \ "$PUBLIC_URL/" > /dev/null + curl --fail --show-error --silent \ + --retry 10 --retry-delay 5 --retry-all-errors \ + "$PUBLIC_URL/api/instances/" > /dev/null promote: name: Promote ${{ matrix.image }} to latest diff --git a/deployments/k3s/backup-job.yaml b/deployments/k3s/backup-job.yaml new file mode 100644 index 000000000000..c98bd9b9d0d2 --- /dev/null +++ b/deployments/k3s/backup-job.yaml @@ -0,0 +1,34 @@ +# Pre-release pg_dump of the `plane` database into PVC plane-predeploy-backups (last 5 kept). +# Migrations are not reversible, so CI runs this before the migrator. The cluster also takes a +# daily dump of every pg-main database (database/pg-main-dump CronJob). +apiVersion: batch/v1 +kind: Job +metadata: {name: plane-predeploy-backup, namespace: plane} +spec: + backoffLimit: 0 + template: + spec: + restartPolicy: Never + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + securityContext: {fsGroup: 26} + containers: + - name: dump + image: ghcr.io/cloudnative-pg/postgresql:17-standard-trixie + command: ["/bin/bash", "-c"] + args: + - | + set -euo pipefail + f="/backup/plane-$(date -u +%Y%m%dT%H%M%SZ)-before-__VERSION__.dump" + pg_dump "$DATABASE_URL" -Fc -f "$f" + ls -la "$f" + ls -1t /backup/*.dump | tail -n +6 | xargs -r rm -f + env: + - name: DATABASE_URL + valueFrom: {secretKeyRef: {name: plane-app-env, key: DATABASE_URL}} + resources: {requests: {cpu: 50m, memory: 64Mi}, limits: {memory: 512Mi}} + volumeMounts: [{name: backup, mountPath: /backup}] + volumes: + - name: backup + persistentVolumeClaim: {claimName: plane-predeploy-backups} diff --git a/deployments/k3s/migrator-job.yaml b/deployments/k3s/migrator-job.yaml new file mode 100644 index 000000000000..3cea29164a90 --- /dev/null +++ b/deployments/k3s/migrator-job.yaml @@ -0,0 +1,20 @@ +# Runs Django migrations before the new release starts. Recreated by CI on every release. +apiVersion: batch/v1 +kind: Job +metadata: {name: plane-migrator, namespace: plane} +spec: + backoffLimit: 2 + template: + spec: + restartPolicy: Never + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: migrator + image: docker.io/__DOCKER_USERNAME__/plane-api:__VERSION__ + args: ["./bin/docker-entrypoint-migrator.sh"] + envFrom: [{secretRef: {name: plane-app-env}}] + resources: {requests: {cpu: 50m, memory: 128Mi}, limits: {memory: 1Gi}} + volumeMounts: [{name: logs, mountPath: /code/plane/logs}] + volumes: [{name: logs, emptyDir: {}}] diff --git a/deployments/k3s/plane.yaml b/deployments/k3s/plane.yaml new file mode 100644 index 000000000000..16ae30e5abc2 --- /dev/null +++ b/deployments/k3s/plane.yaml @@ -0,0 +1,395 @@ +# Plane on the K3s cluster (k3s.seasonschange.cn), namespace `plane`. +# Applied by .github/workflows/release-deploy.yml with __DOCKER_USERNAME__ and __VERSION__ substituted. +# +# Pre-created in the cluster (not in git): namespace `plane` and the Secrets +# plane-app-env (api/worker/beat-worker/migrator), plane-live-env, plane-mcp-env, +# plane-proxy-env, plane-minio-env, plane-mq-env. +# PostgreSQL is the shared CloudNativePG cluster pg-main (database `plane`); `plane-db` is an +# ExternalName alias so DATABASE_URL/PGHOST keep their compose-era host name. +# Stateful pieces (Valkey, RabbitMQ, MinIO, backend) are pinned to the node labelled role=legacy. +# MinIO uses a locally imported image (imagePullPolicy: Never) because minio/minio no longer +# publishes pullable tags on Docker Hub. +apiVersion: v1 +kind: Service +metadata: {name: plane-db, namespace: plane} +spec: + type: ExternalName + externalName: pg-main-rw.database.svc.cluster.local + ports: [{port: 5432}] +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: {name: plane-minio-data, namespace: plane} +spec: + accessModes: [ReadWriteOnce] + storageClassName: local-path + resources: {requests: {storage: 5Gi}} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: {name: plane-mq-data, namespace: plane} +spec: + accessModes: [ReadWriteOnce] + storageClassName: local-path + resources: {requests: {storage: 1Gi}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: plane-redis, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: plane-redis}} + template: + metadata: {labels: {app: plane-redis}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: plane-redis + image: docker.io/valkey/valkey:7.2.11-alpine + ports: [{containerPort: 6379}] + resources: {requests: {cpu: 20m, memory: 16Mi}, limits: {memory: 256Mi}} + readinessProbe: {tcpSocket: {port: 6379}, initialDelaySeconds: 2, periodSeconds: 10} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: plane-mq, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: plane-mq}} + template: + metadata: {labels: {app: plane-mq}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: plane-mq + image: docker.io/library/rabbitmq:3.13.6-management-alpine + ports: [{containerPort: 5672}] + envFrom: [{secretRef: {name: plane-mq-env}}] + env: + - {name: RABBITMQ_NODENAME, value: rabbit@localhost} + resources: {requests: {cpu: 20m, memory: 128Mi}, limits: {memory: 512Mi}} + readinessProbe: {tcpSocket: {port: 5672}, initialDelaySeconds: 15, periodSeconds: 10} + volumeMounts: + - {name: data, mountPath: /var/lib/rabbitmq} + volumes: + - {name: data, persistentVolumeClaim: {claimName: plane-mq-data}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: plane-minio, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: plane-minio}} + template: + metadata: {labels: {app: plane-minio}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: plane-minio + image: docker.io/minio/minio:RELEASE.2025-09-07T16-13-09Z + imagePullPolicy: Never + args: ["server","/export","--console-address",":9090"] + ports: [{containerPort: 9000}] + envFrom: [{secretRef: {name: plane-minio-env}}] + resources: {requests: {cpu: 20m, memory: 128Mi}, limits: {memory: 512Mi}} + readinessProbe: {tcpSocket: {port: 9000}, initialDelaySeconds: 5, periodSeconds: 10} + volumeMounts: + - {name: data, mountPath: /export} + volumes: + - {name: data, persistentVolumeClaim: {claimName: plane-minio-data}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: api, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: api}} + template: + metadata: {labels: {app: api}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: api + image: docker.io/__DOCKER_USERNAME__/plane-api:__VERSION__ + args: ["./bin/docker-entrypoint-api.sh"] + ports: [{containerPort: 8000}] + envFrom: [{secretRef: {name: plane-app-env}}] + resources: {requests: {cpu: 20m, memory: 256Mi}, limits: {memory: 1536Mi}} + readinessProbe: {tcpSocket: {port: 8000}, initialDelaySeconds: 20, periodSeconds: 10} + volumeMounts: + - {name: logs, mountPath: /code/plane/logs} + volumes: + - {name: logs, emptyDir: {}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: worker, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: worker}} + template: + metadata: {labels: {app: worker}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: worker + image: docker.io/__DOCKER_USERNAME__/plane-api:__VERSION__ + args: ["./bin/docker-entrypoint-worker.sh"] + envFrom: [{secretRef: {name: plane-app-env}}] + resources: {requests: {cpu: 20m, memory: 256Mi}, limits: {memory: 1536Mi}} + volumeMounts: + - {name: logs, mountPath: /code/plane/logs} + volumes: + - {name: logs, emptyDir: {}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: beat-worker, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: beat-worker}} + template: + metadata: {labels: {app: beat-worker}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + nodeSelector: {role: legacy} + containers: + - name: beat-worker + image: docker.io/__DOCKER_USERNAME__/plane-api:__VERSION__ + args: ["./bin/docker-entrypoint-beat.sh"] + envFrom: [{secretRef: {name: plane-app-env}}] + resources: {requests: {cpu: 20m, memory: 96Mi}, limits: {memory: 1536Mi}} + volumeMounts: + - {name: logs, mountPath: /code/plane/logs} + volumes: + - {name: logs, emptyDir: {}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: web, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: web}} + template: + metadata: {labels: {app: web}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + containers: + - name: web + image: docker.io/__DOCKER_USERNAME__/plane-web:__VERSION__ + ports: [{containerPort: 3000}] + resources: {requests: {cpu: 20m, memory: 16Mi}, limits: {memory: 256Mi}} + readinessProbe: {tcpSocket: {port: 3000}, initialDelaySeconds: 3, periodSeconds: 10} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: admin, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: admin}} + template: + metadata: {labels: {app: admin}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + containers: + - name: admin + image: docker.io/__DOCKER_USERNAME__/plane-admin:__VERSION__ + ports: [{containerPort: 3000}] + resources: {requests: {cpu: 20m, memory: 16Mi}, limits: {memory: 256Mi}} + readinessProbe: {tcpSocket: {port: 3000}, initialDelaySeconds: 3, periodSeconds: 10} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: space, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: space}} + template: + metadata: {labels: {app: space}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + containers: + - name: space + image: docker.io/__DOCKER_USERNAME__/plane-space:__VERSION__ + ports: [{containerPort: 3000}] + resources: {requests: {cpu: 20m, memory: 96Mi}, limits: {memory: 512Mi}} + readinessProbe: {tcpSocket: {port: 3000}, initialDelaySeconds: 5, periodSeconds: 10} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: live, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: live}} + template: + metadata: {labels: {app: live}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + containers: + - name: live + image: docker.io/__DOCKER_USERNAME__/plane-live:__VERSION__ + ports: [{containerPort: 3000}] + envFrom: [{secretRef: {name: plane-live-env}}] + resources: {requests: {cpu: 20m, memory: 128Mi}, limits: {memory: 512Mi}} + readinessProbe: {tcpSocket: {port: 3000}, initialDelaySeconds: 5, periodSeconds: 10} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: mcp, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: mcp}} + template: + metadata: {labels: {app: mcp}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + containers: + - name: mcp + image: docker.io/__DOCKER_USERNAME__/plane-mcp:__VERSION__ + ports: [{containerPort: 3100}] + envFrom: [{secretRef: {name: plane-mcp-env}}] + resources: {requests: {cpu: 20m, memory: 48Mi}, limits: {memory: 256Mi}} + readinessProbe: {tcpSocket: {port: 3100}, initialDelaySeconds: 5, periodSeconds: 10} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: {name: proxy, namespace: plane} +spec: + replicas: 1 + strategy: {type: Recreate} + selector: {matchLabels: {app: proxy}} + template: + metadata: {labels: {app: proxy}} + spec: + enableServiceLinks: false + automountServiceAccountToken: false + containers: + - name: proxy + image: docker.io/__DOCKER_USERNAME__/plane-proxy:__VERSION__ + ports: [{containerPort: 80}] + envFrom: [{secretRef: {name: plane-proxy-env}}] + resources: {requests: {cpu: 20m, memory: 32Mi}, limits: {memory: 256Mi}} + readinessProbe: {tcpSocket: {port: 80}, initialDelaySeconds: 3, periodSeconds: 10} + volumeMounts: + - {name: config, mountPath: /config} + - {name: data, mountPath: /data} + volumes: + - {name: config, emptyDir: {}} + - {name: data, emptyDir: {}} +--- +apiVersion: v1 +kind: Service +metadata: {name: plane-redis, namespace: plane} +spec: + selector: {app: plane-redis} + ports: [{port: 6379, targetPort: 6379}] +--- +apiVersion: v1 +kind: Service +metadata: {name: plane-mq, namespace: plane} +spec: + selector: {app: plane-mq} + ports: [{port: 5672, targetPort: 5672}] +--- +apiVersion: v1 +kind: Service +metadata: {name: plane-minio, namespace: plane} +spec: + selector: {app: plane-minio} + ports: [{port: 9000, targetPort: 9000}] +--- +apiVersion: v1 +kind: Service +metadata: {name: api, namespace: plane} +spec: + selector: {app: api} + ports: [{port: 8000, targetPort: 8000}] +--- +apiVersion: v1 +kind: Service +metadata: {name: web, namespace: plane} +spec: + selector: {app: web} + ports: [{port: 3000, targetPort: 3000}] +--- +apiVersion: v1 +kind: Service +metadata: {name: admin, namespace: plane} +spec: + selector: {app: admin} + ports: [{port: 3000, targetPort: 3000}] +--- +apiVersion: v1 +kind: Service +metadata: {name: space, namespace: plane} +spec: + selector: {app: space} + ports: [{port: 3000, targetPort: 3000}] +--- +apiVersion: v1 +kind: Service +metadata: {name: live, namespace: plane} +spec: + selector: {app: live} + ports: [{port: 3000, targetPort: 3000}] +--- +apiVersion: v1 +kind: Service +metadata: {name: mcp, namespace: plane} +spec: + selector: {app: mcp} + ports: [{port: 3100, targetPort: 3100}] +--- +apiVersion: v1 +kind: Service +metadata: {name: proxy, namespace: plane} +spec: + selector: {app: proxy} + ports: [{port: 80, targetPort: 80}] +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: {name: plane, namespace: plane} +spec: + ingressClassName: traefik + rules: + - host: plane.tmlab.top + http: + paths: + - {path: /, pathType: Prefix, backend: {service: {name: proxy, port: {number: 80}}}} + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: {name: plane-predeploy-backups, namespace: plane} +spec: + accessModes: [ReadWriteOnce] + storageClassName: local-path + resources: {requests: {storage: 5Gi}} diff --git a/deployments/production/README.md b/deployments/production/README.md index 639d06a482fa..83c9f7157352 100644 --- a/deployments/production/README.md +++ b/deployments/production/README.md @@ -1,5 +1,22 @@ # Production deployment +> **Since 2026-11-11 production runs on the K3s cluster, not on the Docker host.** +> Manifests: `deployments/k3s/` (namespace `plane`). PostgreSQL is the shared CloudNativePG +> cluster `pg-main` (database `plane`); MinIO data is in PVC `plane-minio-data`. +> On a release tag, `.github/workflows/release-deploy.yml` builds the images, then with the +> repository secret `KUBE_CONFIG` (ServiceAccount `plane/ci-deployer`): +> 1. dumps the database into PVC `plane-predeploy-backups` (last 5 kept), +> 2. runs the migrator Job, +> 3. applies `deployments/k3s/plane.yaml` with the new tag and waits for every Deployment, +> running `kubectl rollout undo` on all application Deployments if any fails, +> 4. checks `https://plane.tmlab.top`. +> +> Nginx on 207.57.124.102 still terminates TLS and proxies to Traefik. The rest of this document, +> `deploy.sh`, `preflight.sh` and the compose override describe the previous Docker setup and are +> kept for reference only; the Deployment Preflight workflow still targets that host. + +## Previous Docker setup + The release workflow deploys Plane behind a host-managed Nginx reverse proxy: ```text