Skip to content

Environment variables and secrets

Three places env vars can come from for an app:

SourceWhere it livesWhen to use
Inline environment: in composedocker-compose.ymlNon-sensitive defaults, public config
.env file beside the composeapps/myapp/.env, written by SimpleDeploySecrets, per-environment overrides
Encrypted registry credsSQLite, AES-256-GCMImage pull credentials only, see Registries

Compose interpolates ${VAR} from the sibling .env file at deploy time. Keep secrets out of the compose, reference them from .env.

services:
web:
image: myapp:latest
environment:
DATABASE_URL: ${DATABASE_URL}
LOG_LEVEL: info
labels:
simpledeploy.endpoints.0.domain: "myapp.example.com"
simpledeploy.endpoints.0.port: "3000"

The compose file is safe to commit. .env stays on the server.

App page, Config tab, Environment sub-tab. Add key/value rows, save. Triggers a redeploy automatically.

The PUT writes apps/myapp/.env with 0600 permissions.

  • Don’t put secrets directly in environment: in the compose if you commit it to Git.
  • Don’t bake secrets into the image at build time.
  • Don’t share the same .env across staging and prod, scope each context.

See also: Registries for image pull creds, REST API.