# Deploy notes — helm baseline

This baseline ships a Helm chart at `charts/voltro-app/` with
per-env overlays. Deploy is `helm upgrade --install` against the
right cluster + values file.

## Pre-deploy checklist

- [ ] Container images built + pushed to your registry
- [ ] kubeconfig points at the right cluster
- [ ] Namespace exists OR `--create-namespace` is in the command
- [ ] Secrets in place (sealed-secrets / external-secrets / SOPS)
- [ ] Ingress controller installed (nginx / Traefik / istio)
- [ ] cert-manager installed if using `tls:` in values
- [ ] (Prod only) Managed Postgres ready; `postgres.externalUrl` set

## Pushing images

The chart references images by `repository:tag`. Build + push from
the project root:

```sh
docker build -f docker/api.Dockerfile -t ghcr.io/you/{{projectName}}-api:0.1.0 .
docker build -f docker/web.Dockerfile -t ghcr.io/you/{{projectName}}-web:0.1.0 .
docker push ghcr.io/you/{{projectName}}-api:0.1.0
docker push ghcr.io/you/{{projectName}}-web:0.1.0
```

Then set the registry in values:

```yaml
global:
  imageRegistry: ghcr.io/you
api:
  image: { tag: "0.1.0" }
web:
  image: { tag: "0.1.0" }
```

Note: the Dockerfiles ship as part of the `compose` baseline. If
you switched away from compose and need them back without enabling
the full docker-compose pipeline, run `voltro baseline set compose`
once, copy the `docker/` dir, then `voltro baseline set helm` to
restore the helm baseline.

## Per-env install

```sh
# Dev cluster (kind / minikube / k3d)
pnpm helm:install:dev

# Staging
pnpm helm:install:staging

# Production
pnpm helm:install:prod
```

Each wraps `helm upgrade --install ... -f charts/voltro-app/values-<env>.yaml`.

## GitOps

The CLI helpers above are fine for prototyping. For prod, hand the
chart to ArgoCD / Flux:

```yaml
# argocd Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: {{projectName}}-prod
spec:
  source:
    repoURL: https://github.com/you/{{projectName}}
    path: charts/voltro-app
    helm:
      valueFiles: [values.yaml, values-prod.yaml]
  destination:
    server: https://kubernetes.default.svc
    namespace: {{projectName}}-prod
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
```

## Rollback

```sh
helm rollback {{projectName}}-prod --namespace {{projectName}}-prod
```

GitOps does the same automatically when you revert the values
commit. Prefer that path in prod.
