2a. Install ArgoCD + ingress-nginx (via Terraform/Helm)

terraform apply -target=helm_release.argocd -target=helm_release.ingress_nginx
kubectl get pods -n argocd -n ingress-nginx

image.png

2b. documind-gitops repo structure

apps/                  ← ArgoCD Application objects
manifests/
	backend/
	frontend/
	cluster/
	agent/

Namespace ownership split: Terraform owns platform namespaces (argocd, ingress-nginx, monitoring, etc.); GitOps owns the app namespace (documind), created via manifests/frontend/namespace.yaml.

2c. First ArgoCD Applications

# apps/backend.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: documind-backend
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/qezman/documind-gitops.git
    targetRevision: main
    path: manifests/backend
  destination:
    server: https://kubernetes.default.svc
    namespace: documind
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
git push
kubectl apply -f apps/backend.yaml
kubectl apply -f apps/frontend.yaml
kubectl get application -n argocd
kubectl get pods -n documind

Hold off on apps/cluster.yaml and apps/agent.yaml until Phase 9 and Phase 11 respectively

image.png

image.png

image.png

2d. Database migrations

RDS has no schema on a fresh apply. Run once a documind-backend pod is Running (it already has DATABASE_URL injected) - copy the two SQL files in and run them through the pod's own pg dependency, no local network path to RDS needed (it's private, EKS-node-only):

kubectl cp documind-backend/prisma/000_users.sql documind/<backend-pod>:/tmp/000_users.sql
kubectl cp documind-backend/prisma/001_documind.sql documind/<backend-pod>:/tmp/001_documind.sql

kubectl exec -n documind <backend-pod> -- node -e "
const { Pool } = require('pg');
const fs = require('fs');
const pool = new Pool({ connectionString: process.env.DATABASE_URL, ssl: { rejectUnauthorized: false } });
(async () => {
  const client = await pool.connect();
  for (const f of ['/tmp/000_users.sql', '/tmp/001_documind.sql']) {
    console.log('Running', f);
    await client.query(fs.readFileSync(f, 'utf8'));
  }
  console.log('done');
  client.release();
  process.exit(0);
})().catch(e => { console.error(e); process.exit(1); });
"

image.png

image.png

image.png