Skip to Content
dFlow

Day-one with dflow

Register, set context, deploy, build, databases, and cleanup efficiently.

This is one sitting, from an empty laptop to a URL you can open. The commands talk to https://k8s.dflow.sh until login saves a different server. You can skip to a later section once the account, project, and environment exist.

Install and probe

Install the CLI, print the version, and check that the API answers.

curl -fsSL https://github.com/dflow-sh/dflow/releases/latest/download/install.sh | sh
dflow version
dflow api:ready --api https://k8s.dflow.sh

When stdout is a pipe, or you pass --progress plain, the CLI prints [phase] lines on stderr. For a build, the build log stays on stdout, so a CI log stays readable.

Account and context

Signup and login ask for the password in the terminal. They need an interactive TTY. They do not accept --password. Use a normal terminal. After you have a workspace token, a script can use dflow login --token-stdin. dflow login --google and dflow login --github sign in when the server has that provider. They print a URL. The first account is still email and password.

dflow auth:register --email you@example.com
# password at the prompt (12–128 characters)
# When the API requires email verification, run: dflow auth:verify TOKEN_FROM_EMAIL

dflow login --email you@example.com
dflow whoami
dflow context:show

Create a team workspace when someone else should join. The personal workspace stays private. Creating a project selects it. Creating an environment selects it. Later commands use that pair.

dflow workspaces:create team
dflow projects:create gate
dflow environments:create live --region eu

dflow projects:create gate --environment live --region eu creates the project and the environment, and selects both. Use the two commands above when you want to add the environment later.

dflow context:use --workspace team --project gate --environment live saves that choice when you want to set it yourself. The CI example below does it that way. --region eu asks for a cluster in that region.

Workspace tokens

A workspace token is what a script or an editor uses. The secret is printed once. Store it, and keep it out of the repository.

dflow tokens:create --role developer --expires-in 90d
dflow tokens:list

The file

dflow.json is the source of truth. Write it in the repository, create the application, and apply the file. The example below is an image. A GitHub repository uses build instead of image. --yes stores the file and starts what it declares.

dflow apps:create web
dflow apps:document web --file dflow.json --yes

When you later change env or secrets in the dashboard, dFlow updates the stored copy. Put that difference back into the repository file. The printed copy omits env values, so it is safe to look at and it is not the file you commit.

Deploy from an image

This starts a published container image. The sample image hashicorp/http-echo exits unless ECHO_TEXT is set, so set that variable first. Before the first deploy, apps:env:set only stores the value and prints status stored. The value is applied when the first deploy runs.

dflow apps:create web
dflow apps:env:set web ECHO_TEXT=hello --wait --wait-timeout 10m
dflow apps:deploy web --image hashicorp/http-echo:1.0.0 --port 5678 \
  --cpu-millicores 200 --memory-mi 256 \
  --wait --wait-timeout 10m
dflow apps:route:set web --wait --wait-timeout 10m
host=$(dflow apps:route:show web --output json | jq -r .host)
curl -fsS "https://${host}"

Use the host from dflow apps:route:show, or from the route table after apps:route:set --wait. Copy that value. A hostname you invent, such as web-PROJECT-ENV.apps..., can be wrong: the platform adds a four-character suffix when that name is already taken on the cluster.

Deploy from source

A build compiles a repository or a local directory, stores the image, and deploys it. The default wait is too short for a build, so pass --wait-timeout 20m. Set ECHO_TEXT before the build so the sample container stays up. A public GitHub repository builds with apps:build --repo and no extra setup. A private repository builds when the workspace installed the GitHub App for that repo (dflow github:status lists installs), or after dflow apps:source:token:set. Without either, deploy a prebuilt image with dflow apps:deploy --image.

dflow apps:create echo
dflow apps:env:set echo ECHO_TEXT=hello-from-build --wait --wait-timeout 10m
dflow apps:build echo --repo https://github.com/hashicorp/http-echo --port 5678 \
  --wait --wait-timeout 20m
dflow apps:route:set echo --wait --wait-timeout 10m

A directory on this machine uses the same build. The packed upload is at most 100MB. .git, node_modules, and .env are left out. .env.example is included. Pass --repo or --path, not both.

dflow apps:build web --path ./web --wait --wait-timeout 20m

Restart replaces the running containers and keeps the same image, variables, and replica count:

dflow apps:restart web --wait --wait-timeout 10m

Routes, env, secrets, logs

Environment variables are visible with apps:env:get. A secret value is read from stdin and is not printed back. apps:secret:list shows the names only.

dflow apps:env:get web
printf 'secret' | dflow apps:secret:set web DEMO_KEY --wait --wait-timeout 10m
dflow apps:secret:list web
dflow apps:logs web --tail 50
dflow apps:events web
dflow apps:events:pods web

A hostname of your own has to be a name you control. It cannot sit under the platform apps suffix:

dflow apps:route:set web --host app.example.com --wait --wait-timeout 15m

Jobs, volumes, releases

A job runs a container once and exits. A volume is a disk mounted into the application. A release is one deployed image, which you can roll back to later.

dflow jobs:create --app web --name once \
  --image postgres:16-alpine --command postgres --command --version \
  --wait-timeout 5m
dflow volumes:create --name data --size-gi 1 --storage-class local-path
dflow volumes:mount data --app web --mount-path /data
dflow apps:releases:list web

Databases

This creates a database in the current environment and can attach it to an application with --app. db:credentials prints the password once. PostgreSQL, MySQL, and MongoDB are dflow db:postgres:create, dflow db:mysql:create, and dflow db:mongodb:create. Each of those requires --database. Redis is dflow db:redis:create. The Redis provider id is redis. Linking writes DFLOW_DATABASE_* for SQL and MongoDB, and DFLOW_REDIS_* for Redis. MongoDB is one instance, still a replica set.

--storage defaults to 20Gi. A size from 1Gi through 100Gi is accepted. The example below passes 1Gi. PostgreSQL --version defaults to 18 (16, 17, or 18). MySQL defaults to 8.0 (8.0 or 8.4). MongoDB defaults to 8 (6, 7, or 8). Redis has no version flag.

dflow db:postgres:create appdb --database appdb --app web --storage 1Gi \
  --wait --wait-timeout 15m
dflow db:list
dflow db:credentials appdb
dflow db:redis:create cache --app web --wait --wait-timeout 15m
dflow db:backups:create appdb --wait --wait-timeout 15m
dflow db:backups:list appdb

When the object store driver is s3, PostgreSQL, MySQL, and Redis get a daily backup at 02:00 UTC, five-field cron 0 2 * * *, kept 7 days. Point-in-time restore is on for those three. The commands are dflow db:backups:list, dflow db:backups:create, and dflow db:restore. MongoDB backups are not available, and on MongoDB those commands return that. Deleting a database does not delete the bucket copy. Delete and restore still ask you to confirm the name.

Official templates:

dflow templates:list
dflow templates:install umami

templates:install can take several minutes. It prints generated secrets such as secret.password and secret.APP_SECRET once. Save them before you close the terminal. templates:list shows the recipes the API already knows.

Workspace invites

Invite someone into the team workspace, not the personal one. Removing a member asks you to type that person's email.

dflow invites:create colleague@example.com --role developer
dflow invites:accept INVITE_TOKEN
dflow members:list
dflow members:role USER_ID developer
dflow members:remove USER_ID --confirm-email colleague@example.com

members:role and members:remove are refused on the personal workspace. Remove asks for that member's email.

Cleanup (destructive)

These commands delete data. The confirm value has to match the application, service, or project name. There is no workspace delete command yet. Delete every environment first, then dflow projects:delete NAME --confirm-name NAME.

dflow volumes:delete data --confirm data
dflow apps:delete echo --confirm-name echo --wait --wait-timeout 10m
dflow apps:delete web --confirm-name web --wait --wait-timeout 10m
dflow db:delete appdb --confirm-name appdb --wait --wait-timeout 10m
dflow tokens:revoke TOKEN_ID --confirm PREFIX

If you added a custom route hostname, delete it with dflow apps:route:delete web HOST --wait --wait-timeout 10m. Delete template applications the same way when you no longer need them.

Use dflow in CI

Store a workspace token in the CI secret store. The password stays at a prompt on your machine. A job passes the token on stdin.

export DFLOW_API=https://k8s.dflow.sh
printf '%s' "$DFLOW_TOKEN" | dflow login --token-stdin --context ci --api "$DFLOW_API"
dflow --context ci whoami
dflow --context ci context:use --workspace team --project gate --environment live
dflow --context ci apps:deploy web \
  --image "$IMAGE" --port 5678 --wait --wait-timeout 10m --output json

Use --output json in scripts and fail when status is failed. Image deploys and env changes accept --wait, --wait-timeout, and --progress auto|tty|plain. While --wait runs, build output streams on stdout, phases on stderr (or a spinner when stderr is a TTY), and rollout pod events as indented lines:

⠹ rolling_out 42s
  pod web-7d9f Pulling image
Building with Railpack 0.43.0
Pushing image
✓ building 1m12s
summary   succeeded in 2m04s
app       web
release   ghcr.io/org/web:main-abc
url       https://web-demo-staging.apps.example.test

apps:route:set --wait waits until the platform hostname answers. A custom hostname exits 0 once that platform host answers, and the CLI prints that TLS is pending until DNS points at the platform. --wait-tls keeps waiting until the custom hostname itself answers.

How is this guide?

Last updated on