previewctl up
Usage
previewctl up [flags]Description
Reads .previewctl/preview.yml, resolves service dependencies, and starts the preview stack in Docker.
The up command will:
- Validate the config file
- Detect the current Git branch (used for naming)
- Resolve the service dependency graph (DAG)
- Build services (Dockerfile, Nixpacks, or Railpack)
- Create the Docker network
- Deploy all services in dependency order
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--preview-id | string | generated | Preview ID to deploy |
--secret | string[] | — | Secret in KEY=VALUE format (repeatable) |
--env-file | string | .env | Path to .env file |
Examples
Basic usage:
previewctl upWith secrets:
previewctl up --secret STRIPE_KEY=sk_test_abc --secret DB_PASSWORD=hunter2With a custom env file:
previewctl up --env-file .env.stagingWith a specific preview ID:
previewctl up --preview-id my-feature-previewHow it works
PreviewCtl reads the depends_on fields in your config to build a directed acyclic graph (DAG) of service dependencies. Services with no dependencies start first, and dependent services wait until their requirements are ready.
Environment variables support templating:
${services.<name>.host}— resolves to the container hostname${services.<name>.port}— resolves to the service port${services.<name>.env.<VAR>}— references another service’s env var${secrets.<KEY>}— injects a secret from--secretor--env-file${Generate(n)}— generates a random string of lengthn