Build and deploy settings

Every setting that controls how a service is built, started, checked, restarted and sized.

A service's settings decide how Dekka builds it, how it starts, how Dekka knows it's healthy and how much it may use. Open a service on the canvas and choose Settings to change them, then Stage changes and Deploy changes to apply them. Most of them can also come from a dekka.toml or dekka.json in the repository.

Choose a builder

Services from GitHub have three builders under Builder.

  • Automatic picks a build for you and works for common Node.js, Python and Go projects.
  • Buildpack builds with a Railpack-style buildpack.
  • Dockerfile builds the Dockerfile at Dockerfile path, which defaults to Dockerfile in the root directory.

If the automatic build guesses wrong, set the Build command, such as npm run build, and the Start command, such as npm start or uvicorn app.main:app --host 0.0.0.0 --port $PORT. Empty commands use what Dekka detects.

Deploy only when certain files change

Watch paths lists globs, one per line, such as apps/api/** or packages/shared/**/*.ts. A push deploys the service only when at least one changed file matches one of them, and an empty list means any change deploys it. Globs are matched from the repository root, not the root directory, and a service can have up to 20.

Run migrations before a release

The Pre-deploy command, such as npm run migrate or python manage.py migrate --noinput, runs once before the new release takes traffic.

How does Dekka know my service is healthy?

For a web service, Dekka requests the Health check path on the new release and sends it traffic only after the path returns a 2xx. If that doesn't happen within the Timeout, which defaults to 30 seconds and can be up to 300, the deployment fails and the previous release keeps serving.

What happens when my service crashes?

The Restart policy decides. Restart when it crashes is the default and tries up to the number of Retries, which defaults to 10. Always restart restarts the service whenever it exits, and Never restart leaves it stopped.

Size a service

Under Resources, Replicas sets how many copies run, and vCPU and Memory set the limit for each copy. A new service gets 0.5 vCPU and 256 MiB. Each plan caps these per service.

Plan Memory vCPU Replicas
Free 256 MiB 0.5 1
Starter 512 MiB 1 2
Growth 1024 MiB 2 4

A service with a volume runs one replica.

Sleep when idle

Sleep when idle stops a service when it has no traffic and wakes it on the next request, which can add a few seconds to that request. It's off by default.

Networking settings

A web service's Port is the port it listens on, and Dekka sets PORT to the same value. Public address turns its apps.dekka.cloud address on or off. Your code must listen on 0.0.0.0 rather than localhost, or Dekka can't reach it.

Setting names in the API and config files

In the API, these are fields of a service's spec. A config file uses the same names in its build and runtime sections.

  • build.strategy is the Builder, one of auto, which is the default, railpack or dockerfile.
  • build.dockerfile_path is the Dockerfile path, Dockerfile by default.
  • build.build_command and build.start_command are the commands, detected when empty.
  • build.watch_paths is a list of globs, empty by default.
  • build.pre_deploy_command is the Pre-deploy command.
  • runtime.port is the Port, 3000 by default.
  • runtime.health_check_path is the Health check path, / by default.
  • runtime.health_check_timeout_seconds is the health check Timeout, 30 by default.
  • runtime.memory_mib, runtime.vcpu and runtime.replicas are the resources, 256, 0.5 and 1 by default. vCPU goes in steps of 0.25.
  • runtime.restart_policy is on_failure, which is the default, always or never, and runtime.restart_max_retries is the Retries, 10 by default.
  • runtime.cron_schedule is the cron schedule, and runtime.sleep_when_idle is false by default.
  • source.root_dir is the Root directory, autodeploy is Deploy on push, and networking.public_domain is Public address. A config file can't set these three.