forgejo
by QuenchWorks
Self-hosted Git forge (Forgejo, a community Gitea fork; Go + embedded web UI). Hardened by QuenchWorks as a minimal, nonroot, CVE-gated image, cosign-signed and pinned by digest.
About this chart
Quenchworks forgejo
Hardened Forgejo, a self-hosted Git forge and community Gitea fork, on a minimal, nonroot, CVE-gated image pinned by digest and cosign-signed (keyless / Sigstore). Single node; it persists its repositories, SQLite database and generated config to a PVC, and boots install-locked so the web installer is never served.
Install
helm install my-forgejo oci://ghcr.io/quenchworks/charts/forgejo
Then port-forward and open the web UI:
kubectl port-forward svc/my-forgejo-forgejo 3000:80
# http://127.0.0.1:3000
Set the external URL (behind an ingress) and open ingress to clients outside the release namespace:
helm install my-forgejo oci://ghcr.io/quenchworks/charts/forgejo \
--set config.rootUrl=https://git.example.com/ \
--set networkPolicy.allowExternal=true
Verify the image
cosign verify ghcr.io/quenchworks/images/forgejo \
--certificate-identity-regexp 'https://github.com/quenchworks/.+' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
Each build also ships an SPDX SBOM and SLSA provenance attestation. Verify them
with gh attestation verify oci://ghcr.io/quenchworks/images/forgejo --owner quenchworks.
Values
| Key | Default | Notes |
|---|---|---|
image.repository | ghcr.io/quenchworks/images/forgejo | |
image.digest | (CI-written) | Required. Charts pin by digest, never a tag. |
image.pullPolicy | IfNotPresent | Always, IfNotPresent, or Never. |
nameOverride | "" | Override the chart name in resource names. |
replicaCount | 1 | Stateful single node (SQLite); do not scale out. |
containerPort | 3000 | HTTP port Forgejo binds (nonroot). Wired to server.HTTP_PORT. |
config.appName | Forgejo | Instance name. |
config.rootUrl | "" | External base URL (set behind an ingress). Defaults to http://localhost:<containerPort>/. |
config.logLevel | info | Console log level. |
config.ssh.enabled | false | Built-in git-over-SSH server; exposes an ssh service port when on. |
config.ssh.port | 22 | |
service.type | ClusterIP | ClusterIP, NodePort, or LoadBalancer. |
service.port | 80 | Service port, forwards to the container's http port. |
service.httpsPort | 443 | Service port for the TLS listener (container 8443) when tls.enabled. |
tls.enabled | false | Serve the web UI and API over HTTPS on the app's own listener; the certificate is mounted at /tls. |
tls.existingSecret | "" | Use this kubernetes.io/tls Secret (1st choice). |
tls.certManager.enabled | false | Request a cert-manager Certificate from tls.certManager.issuerRef (2nd choice). |
tls.selfSigned.validityDays | 365 | Otherwise Helm generates a CA + certificate, kept across upgrades. |
persistence.enabled | true | PVC mounted at mountPath (repos + DB + config). |
persistence.mountPath | /data | Forgejo work/data dir. |
persistence.size | 8Gi | Requested volume size. |
persistence.storageClass | "" | Default class if unset. |
persistence.accessModes | ["ReadWriteOnce"] | PVC access modes. |
persistence.existingClaim | "" | Bind an existing PVC instead of provisioning one. |
resources.requests | 100m / 128Mi | CPU / memory requests. |
resources.limits | 1 / 512Mi | CPU / memory limits. |
serviceAccount.create | true | Token automount is off. |
serviceAccount.name | "" | Use an existing ServiceAccount if set. |
rbac.create | false | Minimal empty Role/RoleBinding when enabled. |
networkPolicy.enabled | true | Restricts client ingress to the release namespace. |
networkPolicy.allowExternal | false | Set true to allow ingress from any source. |
podDisruptionBudget.enabled | true | minAvailable: 1. |
ingress.enabled | false | Create an Ingress. With tls.enabled it routes to 443: set the backend protocol to HTTPS. |
ingress.className | "" | IngressClass to claim it. Empty leaves it unset, so the cluster default applies. |
ingress.annotations | {} | Controller annotations (rewrite targets, body size, cert-manager issuer, ...). |
ingress.servicePort | null | Backend port. Unset: service.httpsPort with tls.enabled, else service.port. |
ingress.hosts | [] | e.g. [{host: app.example.com}]. A host with no paths gets a single / Prefix path. |
ingress.tls | [] | Standard Ingress TLS list, e.g. [{hosts: [app.example.com], secretName: app-tls}]. |
Plus the shared quench-common knobs: podLabels, podAnnotations,
nodeSelector, affinity, tolerations, topologySpreadConstraints,
priorityClassName, schedulerName, terminationGracePeriodSeconds,
updateStrategy, extraEnvVars, extraEnvVarsCM, extraEnvVarsSecret,
extraVolumes, extraVolumeMounts, initContainers, sidecars,
lifecycleHooks, command, args, podSecurityContext,
containerSecurityContext, and the probe overrides (livenessProbe,
readinessProbe, startupProbe, and their
customLivenessProbe/customReadinessProbe/customStartupProbe
replacements).
PostgreSQL, Valkey and the first administrator
By default Forgejo keeps SQLite on the data volume. For an existing PostgreSQL and a Valkey (or Redis) for cache, sessions and queues:
database:
type: postgres
postgres: { host: pg-postgresql:5432, name: forgejo, user: forgejo, existingSecret: forgejo-db, passwordKey: password }
redis:
enabled: true
host: valkey:6379
existingSecret: forgejo-valkey
passwordKey: password
admin:
username: root
email: [email protected]
existingSecret: forgejo-admin # key: password
These are written into app.ini on the first boot only, like the rest of the seeded config. The
administrator is created with forgejo admin user create after migrating the database, and the
init container retries it on every boot until it exists (for a database that was not ready on the
first one).
Architecture
Forgejo runs as a single-replica StatefulSet. Everything lives locally: a SQLite
database, a repository tree, and the generated app.ini, all on one PVC mounted
at persistence.mountPath (/data) via a volumeClaimTemplate. Because state is
local it cannot be horizontally scaled, so replicaCount is capped at 1.
The container runs nonroot (uid 1001) on a read-only root filesystem with all
capabilities dropped; only the /data PVC and an emptyDir /tmp are writable.
Forgejo serves /api/healthz (returns {"status":"pass",...}), which backs the
startup, liveness and readiness probes.
The hardened image runs forgejo web directly and has no environment-to-ini
step, so FORGEJO__* env vars are not honored. Instead an init container
generates an app.ini on the PVC on first boot, containing:
INSTALL_LOCK = true, which skips the web installerSECRET_KEY,INTERNAL_TOKENandoauth2.JWT_SECRET, generated by the forgejo binary itself (real, valid values) and persisted on the PVC, so they never touch the read-only root filesystem and never rotate on restart- a SQLite DB at
<mountPath>/forgejo.db, repos under<mountPath>/git/repositories
The file is written only if absent, so restarts and upgrades keep your data and
secrets. To change non-secret settings, edit config.* in values.
Configuration examples
Registration is open by default. Create the first admin non-interactively:
kubectl exec -it my-forgejo-forgejo-0 -- \
forgejo --config /data/app.ini admin user create \
--admin --username admin --password 'change-me' --email [email protected]
Serve behind an ingress on a larger volume, with git-over-SSH enabled:
config:
rootUrl: https://git.example.com/
ssh:
enabled: true
port: 22
persistence:
size: 20Gi
storageClass: fast-ssd
When SSH is enabled you must also expose the SSH port through the service/ingress yourself.
Uninstall
helm uninstall my-forgejo
The PVC provisioned by the StatefulSet's volumeClaimTemplate is retained on
uninstall. Delete it explicitly to remove the repositories, database and secrets:
kubectl delete pvc -l app.kubernetes.io/instance=my-forgejo
Notes
Single node only: Forgejo stores everything in a local SQLite database plus a
repository tree on the PVC, so it cannot be horizontally scaled. For HA you would
move to an external database and shared storage, tracked as a follow-up. The chart
depends on the quench-common library chart, pulled from
oci://ghcr.io/quenchworks/charts/quench-common.
Deploy forgejo with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has forgejo on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartforgejo is pinned at v0.0.26 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply