Skip to content
For agents
Browse guides

Go HTTP servers

Prepare and deploy a Go HTTP app from source or a container image.

Open Markdown

Deploy a Go HTTP server from source. Smolcloud installs the Go toolchain, downloads public modules and compiles your app.

Start from the Go template

Shell
smolcloud init go ./my-app

This creates a small working app with a Dockerfile. You can use your own project instead. Either way, create an app first to get its ID.

The Go starter uses net/http, serves /api/health and reads PORT, with a default of 3000. Its Dockerfile compiles a static executable. If your app uses CGO, change the Dockerfile to include the C libraries it needs.

For an existing app, bind the listener to 0.0.0.0 and make sure the health path answers without your app's own login. Include HTML templates and other runtime files in the build output, or embed them in the executable.

Deploy source

Include go.mod and go.sum. Public modules are downloaded from the Go module proxy. For a project with several executables, set its build and start commands in railpack.json.

Create the app to get its ID, then deploy the source folder:

Shell
smolcloud deploy APP_ID ./my-app

If the folder has a Dockerfile, Smolcloud uses it. The starter includes one; delete it if you'd rather Smolcloud work out the build itself. Automatic builds lists what a build can download and where to see the commands it chose.

Set the port and health path in the app's Configuration. deploy waits until the app is live and prints its address. Open it and try a real page, not only the health path. If you need a private package registry, build an image in your own CI and deploy that.

Limits

  • The app runs as user 10001:10001, not root, and can't write to its own filesystem.
  • Builds can't reach private package registries or other download sites.
  • Keep data in PostgreSQL, a bucket or a disk; anything else is lost on the next deploy.