SSH & one-off shells

Two tiers of access: into the app's container (where your code is running), or onto the stack host (where dokku itself runs). The first is for app-shaped problems; the second is for stack-shaped ones.

Shell inside the running container

$ ownstack ssh app <app> [--stack=<stack>]

This opens an interactive bash shell inside a running container of the web process. Your code is at /app; $DATABASE_URL and friends are set; you can run rails console, npm run repl, whatever.

The shell shares the running container with serving traffic. Close it cleanly (exit); a runaway shell pinning CPU affects users.

One-off command in a fresh container

$ ownstack remote run <app> rails db:migrate
$ ownstack remote run <app> bin/rake some:task
$ ownstack remote run <app> node scripts/clean.js

Spawns a new container from the latest image, runs the command, prints output, exits, removes the container. Doesn't touch the running web/worker. Good for migrations, ad-hoc data scripts, or anything that shouldn't share state with serving traffic.

SSH onto the stack host

$ ownstack ssh stack <stack>

Drops you onto the stack's host as the ubuntu user. Use this for stack-shaped operations: dokku plugin installs, looking at /var/log/nginx/*, checking disk usage, doing OS-level things.

Direct dokku commands skip OwnStack's bookkeeping

If you SSH to the stack and run dokku ps:scale, dokku config:set, etc. directly, the change happens but the control plane doesn't know. Most things are fine; some are not (multi-stack syncing, audit logs). Prefer the CLI when an equivalent exists.

Direct dokku SSH (advanced)

Every stack runs a dokku SSH endpoint as user dokku@<stack-ip>. Your account's SSH key is authorized when you provision a stack. You can run any dokku command directly:

$ ssh dokku@<stack-ip> apps:list
$ ssh dokku@<stack-ip> ps:report <app>
$ ssh dokku@<stack-ip> logs <app> --tail
$ ssh dokku@<stack-ip> postgres:list

Tail logs

$ ownstack remote logs --app=<app> --tail 200
$ ownstack remote logs --app=<app> --follow

Follows stdout/stderr from all running processes. Add --ps=worker to filter to one process type.