Skip to content
Skip to content

Environments

Doku supports multiple isolated environments per project. Each environment has its own infrastructure, environment variables, and deployment configuration.

Default Environments

Every project starts with two environments:

  • staging — Default target for doku deploy. Used for pre-production testing.
  • production — Live environment serving real users. Accessed with --env production.

Environment Configuration

Override any base configuration per environment in doku.yaml:

yamldoku.yaml
deploy:
  instances:
    min: 2
    max: 10

environments:
  staging:
    region: us-east-1
    deploy:
      instances:
        min: 1
        max: 2

  production:
    region: us-east-1
    deploy:
      instances:
        min: 4
        max: 20

Environment Variables

Manage runtime environment variables with the doku env commands:

bash
# Set a variable
doku env set DATABASE_URL=postgres://db.example.com:5432/app --env production

# List all variables (values masked)
doku env list --env production

# Remove a variable
doku env unset OLD_KEY --env production

Encryption

All environment variables are encrypted with AES-256-GCM at rest. They are decrypted and injected only at container runtime — they never appear in logs, build output, or image layers.

Referencing Secrets in Config

You can reference environment variables in doku.yaml using the secrets syntax:

yaml
environments:
  production:
    env:
      DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}
      REDIS_URL: ${{ secrets.PROD_REDIS_URL }}

Promoting Between Environments

The typical workflow is to deploy to staging first, verify, then deploy the same version to production:

bash
# Deploy to staging
doku deploy

# Verify staging
doku status --env staging

# Promote to production
doku deploy --env production
Environments — Doku Docs — Doku