Zum Inhalt springen
#0108
DaemonFiles

Deploy a Go binary as a daemon in three curls

You compiled myapi with go build -o myapi .. You want it running, supervised, with auto-restart, on a real Linux container. Old options: write a Dockerfile, push to a registry, write a compose file. Or write a systemd unit you have to ssh in to install.

Curl one: PUT the binary to a hoody-files URL. It lands on the container's filesystem at /home/me/myapi.

Curl two: POST /api/v1/daemon/programs/add with command: "/home/me/myapi", autorestart: "true", user: "me".

Curl three: POST /api/v1/daemon/programs/{id}/enable then POST .../start.

The Go binary is now a supervised long-running process. Logs are an HTTP GET. Status is an HTTP GET. Restart is an HTTP POST. From go build to production in under a minute, without Docker, without a registry push, without YAML.

Three curls and the binary is supervised. No Dockerfile. No systemd unit. No YAML.