Skip to content

Platform Console staging deployment

Overview

Platform Console is deployed to the staging cluster hosted on the NUC node, and exposed to the internet via an Apisix gateway running in DigitalOcean (public edge). Kubernetes manifests are managed with Kustomize and rolled out via ArgoCD.

Deploying a new version has two parts with different levels of automation:

Layer Path Auto-deployed on push?
App workload (Deployment/Service) services/application/platformconsole/ Yes — ArgoCD auto-sync
Apisix networking (route/cert/tls/upstream) apisix/staging/ No — must be applied manually

1. Application manifests — services/application/platformconsole/

Follows the same base + overlay Kustomize convention as every other service under services/application/* (coreapi, orgconsole, playoutadmin, etc.).

services/application/platformconsole/
├── base/
│   ├── deployment.yml       # Deployment "platformconsole"
│   ├── service.yml          # Service "platformconsole-service", port 80
│   └── kustomization.yaml   # resources: deployment.yml, service.yml
└── overlays/
    ├── staging/
    │   └── kustomization.yaml   # namespace: staging, image tag override
    └── prod/
        ├── hpa.yml
        ├── pdb.yaml
        └── kustomization.yaml   # namespace: production, replicas: 2
  • Staging overlay is intentionally minimal — namespace + image tag only (no HPA/PDB, unlike prod).
  • Image: registry.nexus.castis.io/playtelly/platformconsole, tag bumped by the app repo's own CI pipeline.

ArgoCD wiring (auto-deploy)

  • argocd/apps/staging/platformconsole-stag.yml
  • Application → source path services/application/platformconsole/overlays/staging
  • destination namespace: staging
  • syncPolicy.automated: { prune: true, selfHeal: true }
  • Watched automatically by the staging root app (argocd/root-app-stag.yml, which recurses over argocd/apps/staging).

Result: any push to main in this IaC repo that touches services/application/platformconsole/overlays/staging (or base/) is picked up and deployed by ArgoCD with no manual step.


2. Apisix networking — apisix/staging/ (manual)

No ArgoCD Application tracks the apisix/ directory — these resources are not GitOps-managed and must be applied manually (e.g. kubectl apply -f ...) after pushing.

Note: naming is inconsistent in-repo — private route uses platformconsole-route, public route/cert/tls use the shorter platform-* naming. Both refer to the same host stg.platform.castis.io.

Private (NUC node) — Gateway API HTTPRoute

apisix/staging/private/platform-route.yaml

  • Kind: HTTPRoute (gateway.networking.k8s.io/v1)
  • parentRefs: apisix-gateway (namespace apisix)
  • Hostname: stg.platform.castis.io
  • Backend: platformconsole-service:80 (the Service defined in base/service.yml)

This is the internal route inside the NUC k3s cluster that connects the gateway to the app's Kubernetes Service.

Public (DigitalOcean) — edge exposure

Resource Path Purpose
ApisixRoute apisix/staging/public/route/platform-route.yaml Host stg.platform.castis.io → upstream upstream; includes redirect (http→https) and proxy-rewrite (X-Forwarded-Proto/X-Forwarded-Host) plugins
Certificate (cert-manager) apisix/staging/public/certificate/platform-cert.yaml Issues TLS cert via letsencrypt-prod ClusterIssuer, secretName: platform-tls-secret, dnsNames stg.platform.castis.io
ApisixTls apisix/staging/public/tls/platform-tls.yaml Binds platform-tls-secret to host stg.platform.castis.io

Upstream (apisix/staging/public/upstream/staging-upstream.yaml) is shared across all staging services — not platformconsole-specific. It points at the NUC node's private address (<NUC_TAILSCALE_IP>), and the public DO-side gateway relays all stg.*.castis.io traffic through this single upstream to the private cluster. No new upstream is needed per service — only route/cert/tls are platformconsole-specific.


3. Deployment checklist for platformconsole (staging)

  1. Push app code to the staging branch of the PlatformConsole app repo → triggers the CI pipeline (build, push image, update image tag in this IaC repo).
  2. ArgoCD (platformconsole-stag Application) picks up the tag bump on main in this IaC repo and auto-syncs — Deployment/Service roll out automatically. No manual step.
  3. Only required if the route/host is new or changed: manually apply the Apisix resources, since nothing auto-syncs apisix/:
    kubectl apply -f apisix/staging/private/platform-route.yaml
    kubectl apply -f apisix/staging/public/route/platform-route.yaml
    kubectl apply -f apisix/staging/public/certificate/platform-cert.yaml
    kubectl apply -f apisix/staging/public/tls/platform-tls.yaml
    
    (The shared staging-upstream.yaml upstream does not need to be touched — it already covers new services on the same NUC node.)

4. Key file reference (IaC repo)

Concern File
Deployment/Service (base) services/application/platformconsole/base/deployment.yml, service.yml
Staging overlay services/application/platformconsole/overlays/staging/kustomization.yaml
Prod overlay services/application/platformconsole/overlays/prod/
ArgoCD app (staging) argocd/apps/staging/platformconsole-stag.yml
ArgoCD app (prod, nuc) argocd/apps/prod/nuc/platformconsole-prod.yml
Private route (NUC) apisix/staging/private/platform-route.yaml
Public route (DO) apisix/staging/public/route/platform-route.yaml
Public cert (DO) apisix/staging/public/certificate/platform-cert.yaml
Public TLS (DO) apisix/staging/public/tls/platform-tls.yaml
Shared upstream (DO) apisix/staging/public/upstream/staging-upstream.yaml

5. CI/CD — PlatformConsole app repo

Repo layout:

PlatformConsole/
├── .gitlab-ci/
│   ├── .gitlab-ci-build.yml
│   └── .gitlab-ci-update-image-tag.yml
├── public/
├── scripts/
├── src/
├── .gitignore
├── Dockerfile
└── .gitlab-ci.yml
  • .gitlab-ci.yml — root pipeline definition; includes the two files below.
  • .gitlab-ci-build.yml — builds the Docker image and pushes it to the Nexus registry.
  • .gitlab-ci-update-image-tag.yml — after the image is built, updates the image tag in this IaC repo's staging overlay so ArgoCD picks up the new version.
  • Trigger branch: pushing to the staging branch runs this pipeline (build → push image → update IaC tag → ArgoCD auto-deploy).
  • Dockerfile — multi-stage build (Node builder → Nginx serve), using a BuildKit cache mount (# syntax=docker/dockerfile:1.7) on /root/.npm so npm install doesn't re-download packages on every pipeline run. Vite env vars are passed as build args and baked into the build at build time.