Skip to content

Commit 46f7caf

Browse files
Production CI: workflows only, remove VM and shell deploy scripts
Replace deploy-aks-prod and VM deploy with deploy-production.yml (inline ACR build, Key Vault sync, Helm). Add bootstrap-aks-platform.yml for rare cluster setup. Delete one-off shell scripts, docker-compose.prod, and legacy k8s manifests superseded by Helm. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1e79378 commit 46f7caf

28 files changed

Lines changed: 302 additions & 1483 deletions
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Bootstrap AKS Platform
2+
3+
# Run once per new cluster, or after disaster recovery. Not part of normal deploys.
4+
on:
5+
workflow_dispatch:
6+
7+
env:
8+
AZURE_RESOURCE_GROUP: rg-vcr-protocol-prod-in
9+
AKS_NAME: vcr-aks-prod
10+
KEY_VAULT_NAME: vcr-kv-prod-in
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
bootstrap:
17+
name: Install ingress, cert-manager, external-secrets
18+
runs-on: ubuntu-latest
19+
environment: production
20+
timeout-minutes: 45
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Azure login (JSON)
26+
if: ${{ secrets.AZURE_CREDENTIALS != '' }}
27+
uses: azure/login@v2
28+
with:
29+
creds: ${{ secrets.AZURE_CREDENTIALS }}
30+
31+
- name: Azure login (individual secrets)
32+
if: ${{ secrets.AZURE_CREDENTIALS == '' }}
33+
uses: azure/login@v2
34+
with:
35+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
36+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
37+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
38+
client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
39+
40+
- uses: azure/setup-kubectl@v4
41+
- uses: azure/setup-helm@v4
42+
43+
- name: Configure kubectl
44+
run: |
45+
az aks get-credentials \
46+
--resource-group "${{ env.AZURE_RESOURCE_GROUP }}" \
47+
--name "${{ env.AKS_NAME }}" \
48+
--overwrite-existing
49+
50+
- name: Install ingress-nginx
51+
run: |
52+
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
53+
helm repo update ingress-nginx
54+
helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx \
55+
--namespace ingress-nginx \
56+
--create-namespace \
57+
-f infra/platform/ingress-nginx-values-prod.yaml \
58+
--wait --timeout 15m
59+
60+
- name: Install cert-manager
61+
run: |
62+
if kubectl get deployment cert-manager -n cert-manager &>/dev/null; then
63+
echo "cert-manager already installed"
64+
else
65+
helm repo add jetstack https://charts.jetstack.io
66+
helm repo update jetstack
67+
helm upgrade --install cert-manager jetstack/cert-manager \
68+
--namespace cert-manager \
69+
--create-namespace \
70+
--set crds.enabled=true \
71+
--wait --timeout 15m
72+
fi
73+
kubectl apply -f infra/platform/cluster-issuer.yaml
74+
75+
- name: Install external-secrets
76+
env:
77+
ESO_CLIENT_ID: ${{ secrets.ESO_CLIENT_ID }}
78+
run: |
79+
helm repo add external-secrets https://charts.external-secrets.io
80+
helm repo update external-secrets
81+
EXTRA=()
82+
if [[ -n "${ESO_CLIENT_ID}" ]]; then
83+
EXTRA+=(--set "serviceAccount.annotations.azure\.workload\.identity/client-id=${ESO_CLIENT_ID}")
84+
else
85+
ESO_ID="$(az identity show -g "${{ env.AZURE_RESOURCE_GROUP }}" -n vcr-eso-prod --query clientId -o tsv 2>/dev/null || true)"
86+
[[ -n "${ESO_ID}" ]] && EXTRA+=(--set "serviceAccount.annotations.azure\.workload\.identity/client-id=${ESO_ID}")
87+
fi
88+
helm upgrade --install external-secrets external-secrets/external-secrets \
89+
--namespace external-secrets \
90+
--create-namespace \
91+
-f infra/platform/external-secrets-values-prod.yaml \
92+
"${EXTRA[@]}" \
93+
--wait --timeout 10m
94+
95+
- name: Apply ClusterSecretStore
96+
run: |
97+
KV_URI="$(az keyvault show -g "${{ env.AZURE_RESOURCE_GROUP }}" -n "${{ env.KEY_VAULT_NAME }}" --query properties.vaultUri -o tsv)"
98+
sed "s|\${KEY_VAULT_URI}|${KV_URI}|g" infra/platform/cluster-secret-store.yaml.tpl | kubectl apply -f -
99+
100+
- name: Label application namespace
101+
run: |
102+
kubectl create namespace vcr-protocol --dry-run=client -o yaml | kubectl apply -f -
103+
kubectl label namespace vcr-protocol \
104+
pod-security.kubernetes.io/enforce=restricted \
105+
pod-security.kubernetes.io/enforce-version=latest \
106+
pod-security.kubernetes.io/warn=restricted \
107+
pod-security.kubernetes.io/warn-version=latest \
108+
--overwrite
109+
110+
- name: Ingress IP
111+
run: |
112+
kubectl get svc -n ingress-nginx ingress-nginx-controller -o wide
113+
echo "Point api.vcrprotocol.xyz A record to the EXTERNAL-IP above."

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ jobs:
8585
npm ci --no-audit --no-fund
8686
npm run build
8787
env:
88-
VITE_API_URL: http://20.219.105.217:3001
88+
VITE_API_URL: https://api.vcrprotocol.xyz
8989

9090
docker:
9191
name: API image build
9292
runs-on: ubuntu-latest
93+
permissions:
94+
contents: read
9395
steps:
9496
- uses: actions/checkout@v4
9597

.github/workflows/deploy-backend.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)