Skip to Content
TimeWren Docs
Install

Kubernetes

Install TimeWren on Kubernetes with the Helm chart: optional bundled PostgreSQL and Valkey, a persistent volume, Ingress and one CronJob per scheduled endpoint.

Choose this method if you already run a Kubernetes cluster. The chart charts/timewren has no third-party chart dependencies. It deploys the app, optionally a single-node PostgreSQL and Valkey, a PVC for uploads and one CronJob per scheduled job.

Requirements

  • Helm 3 and Kubernetes 1.27 or newer (CronJob time zones).
  • A default StorageClass, or storage classes you configure explicitly.
  • An ingress controller if you want to publish the app. The chart does not configure DNS or issue certificates.

Install

  1. Clone the repository. The chart is installed from the checkout.

    git clone https://github.com/timewren/timewren.git
  2. Install the release. Replace 1.2.3 with the release you want and the host with your own.

    helm upgrade --install timewren ./timewren/charts/timewren \
      --namespace timewren --create-namespace \
      --set image.tag=1.2.3 \
      --set appUrl=https://timewren.example.com \
      --set ingress.enabled=true \
      --set ingress.className=nginx \
      --set ingress.host=timewren.example.com
  3. Add TLS through ingress.tls and the annotations your TLS controller needs (see below).

  4. Open the URL and create your account. The first account becomes admin unless extraEnv.ADMIN_EMAIL is set.

Without an Ingress, use a port forward and set appUrl=http://localhost:3000:

kubectl port-forward -n timewren service/timewren-timewren 3000:3000

The app waits for PostgreSQL in an init container and runs with MIGRATE_ON_START=1, so migrations run when it starts. The chart sets REQUIRE_EMAIL_VERIFICATION to false by default; mail is optional, and verification becomes required when a mail transport is configured.

Key values

KeyDefaultPurpose
image.repository, image.tag, image.pullPolicyghcr.io/timewren/timewren, latest, IfNotPresentImage to run. Pin image.tag.
appUrlhttp://localhost:3000Public origin used by authentication and links (NEXT_PUBLIC_APP_URL). Set it before installing.
existingSecretemptyName of a Secret you manage (see below).
secrets.*emptyDATABASE_URL, POSTGRES_PASSWORD, BETTER_AUTH_SECRET, ENCRYPTION_KEY, CRON_SECRET. Empty keys are generated.
extraEnv{}Additional variables from .env.example, such as SMTP_HOST or ADMIN_EMAIL.
service.port3000Service port.
resources{}Resource requests and limits of the app.
persistence.enabled, .existingClaim, .size, .storageClasstrue, empty, 5Gi, emptyStorage for uploads at /app/data/storage.
ingress.enabled, .className, .host, .annotations, .tlsfalse, empty, timewren.example.com, {}, []Ingress.
postgresql.enabled, .image, .size, .storageClass, .resourcestrue, postgres:18-alpine, 10Gi, empty, {}Bundled single-node PostgreSQL.
valkey.enabled, .image, .size, .storageClass, .resourcesfalse, valkey/valkey:8-alpine, 1Gi, empty, {}Optional Valkey.
cron.enabled, .image, .timeZone, .resources, .jobstrue, curlimages/curl:8.12.1, Europe/Copenhagen, {}, see values.yamlScheduled jobs.

Variables for mail, S3 and integrations use the names in Environment variables. For example, a values file with SMTP:

extraEnv:
  SMTP_HOST: smtp.example.com
  SMTP_PORT: "587"
  SMTP_FROM: "TimeWren <mail@example.com>"
  ADMIN_EMAIL: jane@example.com

Put credentials in existingSecret, not in extraEnv or values files.

Secrets

By default the chart generates POSTGRES_PASSWORD, BETTER_AUTH_SECRET, ENCRYPTION_KEY (64 hex characters) and CRON_SECRET on first install and keeps them on upgrades by looking them up with Helm lookup. Values you set under secrets override the generated ones. Do not pass secrets on the command line or commit them. Helm stores rendered Secrets in the release history, so restrict access accordingly. Back up the Secret, especially ENCRYPTION_KEY.

For GitOps or an external secret manager, create the Secret yourself and point the chart at it. Offline helm template cannot reuse generated secrets. The Secret needs these exact keys:

KeyRequired
DATABASE_URLAlways. With bundled PostgreSQL: host <release>-timewren-postgresql, port 5432, database timewren, user timewren.
BETTER_AUTH_SECRETAlways.
ENCRYPTION_KEYAlways, 64 hexadecimal characters.
CRON_SECRETAlways. Used by the app and the CronJobs.
POSTGRES_PASSWORDWith bundled PostgreSQL, matching the password in DATABASE_URL.
VALKEY_URLWith bundled or external Valkey.

An installation with an external database and Valkey then looks like this:

postgresql:
  enabled: false
valkey:
  enabled: false
existingSecret: timewren-secrets
extraEnv:
  RATE_LIMIT_BACKEND: valkey # only when using external Valkey

Alternatively set secrets.DATABASE_URL with postgresql.enabled=false. Restart the app after you change an external Secret: kubectl rollout restart -n timewren deployment/timewren-timewren.

With valkey.enabled=true the chart sets VALKEY_URL and RATE_LIMIT_BACKEND=valkey. The bundled PostgreSQL and Valkey are single-node services for small installations, without automatic backups or failover. Use managed services when you need those.

Ingress and TLS

Set ingress.enabled=true, ingress.className, ingress.host and, for TLS, ingress.tls plus the annotations of your controller, for example in a values file:

appUrl: https://timewren.example.com
ingress:
  enabled: true
  className: nginx
  host: timewren.example.com
  tls:
    - secretName: timewren-tls
      hosts:
        - timewren.example.com

Keep appUrl equal to the public HTTPS URL.

Persistence

The app runs as a single replica with the Recreate strategy and a ReadWriteOnce PVC at /app/data/storage; the pod uses UID and GID 1001. Reuse a prepared claim with persistence.existingClaim, or set persistence.storageClass and persistence.size. To use S3-compatible storage instead, set persistence.enabled=false and provide STORAGE_DRIVER=s3, S3_ENDPOINT, S3_REGION, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY and S3_BUCKET through extraEnv and existingSecret. Disabling persistence without an external storage driver is not durable. See Storage.

The app PVC is kept on helm uninstall. PVCs are not backups: schedule database dumps and storage snapshots separately.

Scheduled jobs

With cron.enabled=true the chart creates one CronJob per entry in cron.jobs, keyed by endpoint name with a cron schedule as value, in the time zone cron.timeZone (default Europe/Copenhagen). Each job calls /api/cron/<endpoint> on the app Service with the CRON_SECRET as bearer token, using concurrencyPolicy: Forbid. Override schedules by changing cron.jobs. Set cron.enabled=false only if something else already calls the endpoints.

Upgrade

Take a database and file backup first: rolling back the image does not roll back schema changes. Then run the same command with the new tag:

helm upgrade --install timewren ./timewren/charts/timewren \
  --namespace timewren \
  --reuse-values \
  --set image.tag=1.2.4

Pull the matching chart version first (git -C timewren pull or check out the release tag). If you used a values file, pass it with -f instead of --reuse-values. Migrations run at app start; check the app logs after the upgrade. See Upgrading.

Next steps

On this page