Bring your own server
On this page
You can deploy to a server you already rent or own, such as a VPS or bare metal. You install a small agent on the server, and from then on Dokwe can build and run your projects there.
Requirements#
The server needs:
- Linux on x86_64 or arm64 (aarch64). No other CPU architectures are supported; the installer stops on any other.
- Root access. Run the command as root or with
sudo; the installer stops otherwise. - systemd. The agent is installed and runs as a systemd service.
- A package manager. The installer uses
apt,dnforyumto add anything missing, and stops if it finds none. - Docker and git. The installer adds them if they're missing, and the Docker daemon must be running.
The dashboard recommends Ubuntu 24.04+ or Debian 12+.
Connect a server#
Generate an install command#
Go to Servers and click Add server. Enter a name. Region and provider are optional. Then click Generate command.
Run it on your server#
SSH into the server and paste the command. It looks like this:
bashcurl -sSL https://dokwe.com/install | bash -s -- --token <token> --server-name "<name>" --enable-fleetIf you entered a region, the command also includes
--region "<region>".Verify the connection#
Once the agent connects, the server shows as online in Servers.
The token in the command can be used once and expires after 24 hours. If it expires before you run the command, generate a new one.
What the installer does#
The installer:
- reads the server's public IP, OS, CPU, memory and disk, and registers the server with Dokwe
- installs the agent binary at
/usr/local/bin/dokwe-agent - writes its config to
/etc/dokwe-agent/config.yaml, readable only by root - creates a Docker network named
dokwe-network - installs and starts a systemd service named
dokwe-agent, which restarts on its own if it stops
To read the agent's own logs on the server:
journalctl -u dokwe-agent -fHow the agent connects#
The agent opens an outbound WebSocket to Dokwe and authenticates with its agent token, which it sends as a bearer token. Dokwe stores only a hash of that token. You don't need to open any inbound port for this control connection.
If the connection drops, the agent reconnects. It waits 2 seconds at first, doubles the wait after each failed attempt, and never waits more than 60 seconds.
Over this connection, the agent sends:
- a heartbeat every 15 seconds
- server metrics every 30 seconds: CPU, memory, disk, load average and container count
- build logs, container logs, container events and container metrics as they happen
You can rotate a server's agent token from the server's page if you think it has leaked.
What runs where#
- Builds run on your server. The agent clones your repository and runs
docker buildlocally. - Containers run in Docker on your server, on the
dokwe-networknetwork. Each container gets a host port between 40000 and 49999. Dokwe's router sends your domain's traffic to that port. - Environment variables are sent from Dokwe with each deploy. The agent writes them into the build and passes them to the container. Manage them in environment variables.
- Logs stream from your server to Dokwe, so you can read them in the dashboard. See logs and terminal.
Because traffic reaches your containers on their host ports, those ports must be reachable from Dokwe.
Deploy to your server#
Open a project's pipeline, choose an environment, and set your server as its deployment target in the Settings tab. Your next deploy runs on that server.
To run one environment on several servers, see replicas and routing.
Server status#
| Status | Meaning |
|---|---|
pending | You generated a command, but the agent hasn't registered yet. |
online | The agent is connected. |
offline | The agent disconnected, or missed heartbeats for 45 seconds. |
A server goes back to online as soon as its agent reconnects.
Remove a server#
Uninstall the agent#
Open the server's page and copy the uninstall command. Run it as root on the server. It stops and removes the
dokwe-agentservice, the binary,/etc/dokwe-agentand thedokwe-networknetwork.Deregister it#
On the server's page, go to Settings, then Danger zone, and click Deregister server.
Deregistering only removes the server from Dokwe. It doesn't stop the agent or the containers on the machine, so uninstall first.