dokwe.yml reference
On this page
dokwe.yml describes how Dokwe builds and runs your project. It lives at the root of your repository and is validated against a JSON Schema, both by dokwe validate on your machine and by Dokwe at deploy time.
Where the file lives#
Dokwe looks for dokwe.yml at the repository root by default. The project's manifest path setting can point somewhere else. For monorepos, the path is resolved inside the project's root directory.
Native projects must have a valid manifest. A native deploy stops at the Resolving manifest phase if the file is missing, fails validation, or declares a mode that doesn't match the project. See Container or native.
Container projects take their build settings (install, build, and start commands, and a custom Dockerfile) from the project's settings in the dashboard. The container-mode keys below are accepted by the validator, but the deploy pipeline reads dokwe.yml only for native projects.
Files generated by dokwe init start with a schema comment for YAML editors that support yaml-language-server:
# yaml-language-server: $schema=https://dokwe.com/schemas/dokwe.schema.jsonGenerate a starter file#
dokwe init inspects the current folder, detects the framework, and writes a commented dokwe.yml.
dokwe initIt detects laravel, nextjs, node, php, or generic. Override detection with --framework. In interactive mode it asks for the BYOS server name, whether to use a custom domain (and whether to redirect www), and the host path to deploy to. It also offers secret-looking keys from .env.example as env.required entries.
The generated file always uses mode: native. Without a custom domain, it leaves domain unset so the project uses its automatic domain. dokwe init refuses to overwrite an existing file unless you pass --force.
For CI, skip the prompts:
dokwe init --non-interactive --host my-server --destination /var/www/my-appIn non-interactive mode, --host defaults to <folder-name>-prod and --destination defaults to /var/www/<folder-name>. See CLI reference for every flag.
Validate locally#
dokwe validate checks the file without contacting Dokwe. It runs the JSON Schema plus extra native-mode checks, prints errors and warnings with their path, and exits with status 1 on errors.
dokwe validate
dokwe validate -f deploy/dokwe.ymlDokwe runs the same rules at deploy time and writes any warnings to the deploy log.
Top-level keys#
Unknown keys are rejected everywhere in the file unless a section says otherwise.
| Key | Type | Required | Mode | Description |
|---|---|---|---|---|
mode | container | native | Yes | Both | Selects the deploy path. Must match the project's deployment mode. |
host | string | Native, see below | Native only | Slug of the BYOS server this project deploys to. Pattern ^[a-z][a-z0-9-]{0,62}$. |
rootDir | string | No | Both | Build context, relative to the repo root. Defaults to the repo root. |
manifestPath | string | No | Both | Path to this file. Informational only: Dokwe uses the project's manifest path setting. |
runtime | object | No | Native only | Runtime versions and packages the host must have. See runtime. |
build | list or object | No | Both | Build commands. See build. |
installCommand | string | No | Container | Legacy. Ignored when build is present. |
buildCommand | string | No | Container | Legacy. |
startCommand | string | No | Container | Legacy. |
dockerfile | string | No | Container | Path to a custom Dockerfile. Overrides auto-generation. |
deploy | object | Native | Native only | Where and how releases land on the host. See deploy. |
release | list of strings | No | Native only | Commands run in releases/<sha>/ after extract, before the symlink swap. A non-zero exit aborts the deploy. |
release_rollback | list of strings | No | Native only | Commands run during dokwe rollback, before the symlink is restored. |
services | map | Native | Native only | Host services Dokwe manages. At least one. See services. |
env | object | No | Both | Required keys and plain defaults. See env. |
environments | map | No | Both | Per-environment overrides. See environments. |
Mode rules#
mode: containerrejectshost,runtime,deploy,release,release_rollback, andservices. Their presence is an error.mode: nativerequiresservicesanddeploy. It also requireshost, either at the root or in every entry underenvironments.
At deploy time, Dokwe sends a native release to the server set as the target environment's deployment target. host is checked by the validator and printed by dokwe validate. See Bring your own server.
runtime#
Native only. Before building, Dokwe checks the host for everything listed here. By default, it installs anything missing. Auto-install supports Ubuntu and Debian hosts.
| Key | Type | Default | Description |
|---|---|---|---|
php | string | PHP version, for example "8.3". Matched on major.minor. | |
node | string | Node.js version. | |
composer | string | Composer version, for example "2.x". | |
python | string | Reserved. | |
ruby | string | Reserved. | |
packages | list of strings, unique | Distro package names, installed with apt. | |
extensions | list of strings, unique | PHP extensions, as listed by php -m. Installed from ondrej/php (Ubuntu) or sury (Debian). | |
autoInstall | boolean | true | Set false to only verify. Dokwe then fails with a hint instead of installing. |
Quote version numbers such as "8.3" so YAML keeps them as strings.
build#
Commands that produce your build. Two forms are accepted.
The shorthand is a list of commands:
build:
- composer install --no-dev --optimize-autoloader
- npm ci
- npm run buildThe long form is an object:
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
commands | list of strings | Yes | At least one command. | |
where | control-plane | host | No | control-plane | Where the build runs. |
cache | list of strings | No | Paths to persist between builds. Only meant for where: host. |
For native projects, Dokwe runs the commands in a clean sandbox on the control plane. The working tree after the last command becomes the release artifact.
The current native pipeline runs the build commands in the control-plane sandbox. It doesn't act on where or cache yet.
deploy#
Native only. Dokwe uses a Capistrano-style layout under destination: releases/, shared/, and a current symlink.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
destination | string | Yes | Absolute host path. Must start with /. | |
keepReleases | integer, 1–50 | No | 5 | Older releases are pruned after a successful swap. |
owner.user | string | No | www-data | Owner of deployed files. |
owner.group | string | No | www-data | Group of deployed files. |
shared | list of strings, unique | No | Repo-relative paths kept across releases and symlinked into each one. Absolute paths and .. are rejected. | |
lvSnapshot | object | No | Optional LVM snapshot for full-filesystem rollback. Omit to use release-symlink rollback only. | |
lvSnapshot.lvPath | string | Yes, in lvSnapshot | Absolute LV path. Must start with /dev/. | |
lvSnapshot.size | string | Yes, in lvSnapshot | Snapshot size, for example "5G". Pattern ^[0-9]+[GMK]$. |
services#
Native only. A map of service name to service definition. Names must match ^[a-z][a-z0-9-]{0,29}$. Each service has a kind:
kind | Use it for |
|---|---|
nginx+php-fpm | PHP apps such as Laravel, served by nginx and PHP-FPM |
nginx-static | Static sites, SPAs, or an nginx front for a Node or Bun process |
systemd | Long-running processes: app servers, queue workers, websockets |
cron | Scheduled commands |
Every kind accepts these keys:
| Key | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Skip this service. Most useful in an environment override. |
healthCheck | object | See Health checks. Not accepted by cron. |
Domains and routing#
For nginx+php-fpm and nginx-static, domain decides how traffic reaches the service:
domainunset. Dokwe routes the project's automatic domain (<slug>-app.dokwe.com) and every custom domain on the project's Domains tab to the service through its proxy, with HTTPS handled by Dokwe. See Custom domains and HTTPS.domainset to a domain on the project's Domains tab. Dokwe routes that domain to this service through its proxy and handles HTTPS, so certbot doesn't run on the host. Use this to serve several sites from one project: give each service its own domain and add each domain on the Domains tab. Domains on the tab that no service names, such as the automatic domain, go to thewebservice.domainset to any other hostname. Nginx on the host answers for that hostname directly. With the defaultsslMode: certbot, certbot on the host issues the certificate. You manage DNS.
nginx+php-fpm#
| Key | Type | Default | Description |
|---|---|---|---|
kind | nginx+php-fpm | Required. | |
user | string | Override deploy.owner.user for this service. | |
group | string | Override the group for this service. | |
domain | hostname | Primary server_name. Omit to use the automatic domain. | |
aliases | list of hostnames, unique | Extra server_names. Each redirects to domain with a 301. Ignored when domain is unset. | |
wildcardSubdomain | boolean | false | Serve domain and *.domain from one vhost. Requires sslMode: external with both certificate paths. |
root | string | public | Document root, relative to current/. |
sslMode | certbot | external | none | certbot | How TLS is handled when domain is set. |
sslCertificate | string | Host path to the certificate. Required with sslMode: external. | |
sslCertificateKey | string | Host path to the key. Required with sslMode: external. | |
clientMaxBodySize | string | 10M | Maximum request body. Pattern ^[0-9]+[KMG]?$. |
headers | map of strings | Response headers added verbatim. | |
proxy | list | Reverse-proxy blocks. See proxy. |
Let's Encrypt HTTP validation can't issue wildcard certificates. For wildcardSubdomain, obtain a wildcard certificate with a DNS-01 tool such as acme.sh, then point sslCertificate and sslCertificateKey at it.
nginx-static#
Accepts the same keys as nginx+php-fpm, with these differences:
| Key | Type | Default | Description |
|---|---|---|---|
kind | nginx-static | Required. | |
tryFiles | string | $uri $uri/ /index.html | nginx try_files value. |
sslCertificate, sslCertificateKey | string | Not automatically required by sslMode: external. Required when wildcardSubdomain is true. |
systemd#
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
kind | systemd | Yes | ||
command | string | Yes | ExecStart value. Runs through /usr/bin/env, not a shell. | |
user | string | No | www-data | |
group | string | No | www-data | |
restart | always | on-failure | no | No | always | |
restartSec | integer, 0 or more | No | 5 | |
workingDirectory | string | No | <destination>/current | |
environmentFile | string | No | <destination>/shared/.env |
The systemd unit is named <service-name>.service.
cron#
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
kind | cron | Yes | ||
schedule | string | Yes | Standard five-field cron expression. | |
command | string | Yes | Runs as cd <current> && <command> >> /dev/null 2>&1. | |
runAs | string | No | www-data | User the command runs as. |
user, group | string | No | Accepted by the schema. |
The schema annotates runAs with a default of root, but Dokwe applies www-data when you leave it out. This stops scheduled commands from creating root-owned files in shared/.
proxy#
Each entry in proxy becomes an nginx location that forwards to an upstream.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | nginx location value. Must start with /. A prefix match should end with /. | |
upstream | string | Yes | host:port, for example 127.0.0.1:3000. | |
websocket | boolean | No | false | Forward WebSocket upgrades. |
readTimeout | string | No | 60s | Pattern ^[0-9]+(ms|s|m|h)$. |
sendTimeout | string | No | 60s | Same pattern. |
On nginx+php-fpm, a prefix path without a trailing / (such as /app) triggers a warning, because it would also match routes like /appraisals.
Health checks#
healthCheck takes one of three shapes, chosen by type.
| Key | http | tcp | command | Default |
|---|---|---|---|---|
type | Required | Required | Required | |
path | Optional | / | ||
expectStatus | Optional | [200, 301, 302] | ||
port | Required, 1–65535 | |||
command | Required. Non-zero exit means unhealthy. | |||
timeoutSec | Optional | Optional | Optional | 10 |
intervalSec | Optional | Optional | Optional | 30 |
failureThreshold | Optional | Optional | Optional | 3 |
Dokwe runs one health check per deploy: the nginx+php-fpm service's check if it has one, otherwise the first service that defines one. An http check on a site with its own domain asks https://<domain><path>, using the domain of the service that defines the check, or else of the nginx+php-fpm or nginx-static service that has one. If no service has a domain, an http check is skipped; use tcp or command instead.
env#
| Key | Type | Default | Description |
|---|---|---|---|
file | string | .env | Native. Path under shared/ that variables are written to. Ignored for container. |
required | list of strings, unique | Keys that must be set. A native deploy aborts if any is missing or empty. Pattern ^[A-Z][A-Z0-9_]*$. | |
defaults | map of strings | Plain-text defaults. Key pattern ^[A-Z][A-Z0-9_]*$. |
For native deploys, Dokwe builds the final set of variables in this order, with later sources winning:
env.defaultsin the manifest- Project-level variables from the dashboard or
dokwe env environments.<type>.env.defaults
Never put secrets in env.defaults. The file is committed to your repository. The validator warns when a key name contains key, secret, password, token, or credential and its value looks like a secret. Store secrets as environment variables instead.
environments#
Sparse, per-environment overrides. Each key is an environment type, such as development, staging, or production, and must match ^[a-z][a-z0-9-]{0,29}$. A null value means the environment exists and uses every default.
An override can contain these keys:
| Key | Type |
|---|---|
host | string, same pattern as root host |
runtime | Same shape as runtime |
build | Same shape as build |
deploy | Same shape as deploy, so destination is required if you include it |
release | list of strings |
release_rollback | list of strings |
services | map of service name to a partial service |
env | Same shape as env |
Service overrides are partial: every field is optional, and the fields you list replace the root service's values. An override for a service that doesn't exist at the root triggers a warning and has no effect.
Dokwe picks the override whose key matches the type of the environment being deployed.
At deploy time, Dokwe currently applies the services and env parts of an override. env.required lists are combined with the root list. The other override keys are validated but not yet applied.
Container example#
A container project that uses a custom Dockerfile in a monorepo folder. Remember that container projects read their build settings from the dashboard.
# yaml-language-server: $schema=https://dokwe.com/schemas/dokwe.schema.json
mode: container
rootDir: apps/web
dockerfile: Dockerfile
env:
required:
- DATABASE_URL
defaults:
NODE_ENV: production
environments:
staging:
env:
defaults:
LOG_LEVEL: debugNative example#
A Laravel app with a web server, a queue worker, and the scheduler, plus a staging override.
# yaml-language-server: $schema=https://dokwe.com/schemas/dokwe.schema.json
mode: native
host: my-server
runtime:
php: "8.3"
composer: "2.x"
node: "20"
extensions:
- redis
- intl
build:
- composer install --no-dev --optimize-autoloader
- npm ci
- npm run build
deploy:
destination: /var/www/my-app
keepReleases: 5
owner:
user: www-data
group: www-data
shared:
- storage
- .env
release:
- php artisan migrate --force
- php artisan config:cache
services:
web:
kind: nginx+php-fpm
root: public
clientMaxBodySize: 64M
healthCheck:
type: http
path: /
expectStatus: [200, 301, 302]
queue:
kind: systemd
command: php artisan queue:work --sleep=3 --tries=3
restart: always
restartSec: 5
scheduler:
kind: cron
schedule: "* * * * *"
command: php artisan schedule:run
env:
file: .env
required:
- APP_KEY
- DB_PASSWORD
defaults:
APP_ENV: production
LOG_CHANNEL: stack
environments:
staging:
services:
scheduler:
disabled: true
env:
defaults:
APP_ENV: stagingBecause web has no domain, the app is served on its automatic domain and any custom domains you add in the dashboard.