deploymate

Operate

Build on another machine

Building is the heaviest thing a small server does: compilers and package installs can use more memory than the apps themselves, and a build that runs out of memory fails the deploy. DeployMate can send builds to another computer instead, yours or a friend's, over Tailscale. The finished image comes back and runs on your server as before.

What leaves your serverThe source code of the app being built, and its build output. Pick a machine whose owner you trust: it sees your code while building. Runtime secrets (environment variables) are not part of a build.

1. On the strong machine

It needs Docker and Tailscale, signed in to the same tailnet as your server. Start a BuildKit daemon that listens only on its Tailscale address:

docker run -d --name dm-buildkitd --restart unless-stopped --privileged \
  -p "$(tailscale ip -4):1234:1234" moby/buildkit:latest --addr tcp://0.0.0.0:1234
tailscale ip -4

Note the Tailscale address it prints, such as 100.64.0.5.

Lock the doorThis daemon runs with full privileges and has no password: anyone who can reach port 1234 can run code on that machine. In Tailscale's access controls, allow port 1234 from your DeployMate server only.

2. On your DeployMate server

sudo systemctl edit deploymate
# in the editor, add:
#   [Service]
#   Environment=DEPLOYMATE_BUILD_HOST=tcp://100.64.0.5:1234
sudo systemctl restart deploymate

That adds DEPLOYMATE_BUILD_HOST to the service. The next deploy's build log starts with building on tcp://100.64.0.5:1234.

Good to know

  • If the strong machine is off, deploys still work. The build log says the host isn't reachable and the build runs on your server instead. If your server is the small one, that is the build that may run out of memory, so agree when the machine will be on.
  • Repeat builds are quicker. The cache lives on the build machine.
  • The image still has to travel back. Over a home connection a multi-gigabyte image (many machine-learning images) is slow; that case is better solved by running the app on the stronger machine: see Worker nodes.
  • One build host for now, and only the tcp:// form is accepted.