Articles

Host Go APIs and MCP servers on scale-to-zero microVMs

Compile Go services automatically from go.mod to a small binary under Free’s 256 MB limit, pause billing ~1s after idle, and deploy with canary rollbacks and bundled Postgres.

Updated

Host a Go HTTP API or Go MCP server on scale-to-zero Firecracker microVMs that auto-build from go.mod, produce a small compiled binary well under Free's 256 MB limit, and pause billing ~1 second after each request. On Gregale, Go services (net/http, Gin, Chi, or Streamable HTTP MCP handlers) need no Dockerfile for module-root builds, run behind a pre-wake OWASP WAF, and attach managed PostgreSQL as DATABASE_URL on Hobby ($10 a month).

How Go deploys without Dockerfile boilerplate

When Gregale sees go.mod at your repository root, the builder matches the Go release in your go directive and compiles the module cleanly to ./out:

  • Small static binary footprint. A compiled Go server fits effortlessly inside Gregale Free's 256 MB app-layer limit (1 app, 20 GB-RAM-hours a month at $0) and wakes quickly from memory snapshots between requests.
  • No Procfile binary mismatch. Heroku-style Procfile entries like web: my-app point to binaries another buildpack names; on Gregale, set hosting: start: ./out in gregale.yaml or omit Procfile so Gregale runs ./out automatically. Multi-binary layouts under cmd/server can specify a Dockerfile or gregale.yaml.
  • Safe defaults built in. Every production deploy stages across 1% → 10% → 50% → 100% live traffic with automatic 5xx rollback (beta), free per-PR preview environments, and optional gregale add postgres.

Minimal Go service and one-click MCP starter

go
package main

import (
	"log"
	"net/http"
	"os"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, _ *http.Request) {
		w.Write([]byte("ok"))
	})
	mux.HandleFunc("GET /", func(w http.ResponseWriter, _ *http.Request) {
		w.Write([]byte("hello"))
	})

	port := os.Getenv("PORT")
	if port == "" {
		port = "8080"
	}
	log.Fatal(http.ListenAndServe(":"+port, mux))
}

Deploy a Go HTTP API or try the public Go remote MCP server template in one click:

bash
gregale deploy --dry-run
gregale deploy --name go-api
gregale add postgres --app go-api

How Go hosting options compare

PlatformSource build without DockerfileFree backend tierIdle billing behaviorReleases & Postgres recovery
GregaleYes (go.mod → ./out)Free: 1 app, 256 MB, 20 GB-hoursPauses ~1s after last requestDefault 5xx canary rollback + DB PITR
Fly.ioBuilder / Dockerfile$5/mo allowance (up to 3 VMs)Auto-stop/start on requestsImage redeploy + manual PG cluster restore
Google Cloud RunBuildpacks / Dockerfile180k vCPU-s, 360k GiB-s/monthScales to zero per requestManual revisions + separate Cloud SQL
RenderNative Go runtime750 hrs (spins down 15m idle)Paid services bill 24/7Manual deploy rollback + DB restore
RailwayRailpack$1 monthly usage creditServerless sleeps when idleManual deploy rollback + sibling DB restore

Stay on Fly.io or Google Cloud Run if you need multi-region edge placement or tight GCP VPC/IAM coupling. Choose Gregale when you want Go services running in Firecracker microVMs that pause billing ~1 second after idle, bundled PostgreSQL in a $10 Hobby plan, free PR previews, and automatic 5xx canary rollbacks. See Deploy a Go app, Host an MCP server, and starter templates.

Questions

Do I need a Dockerfile to deploy a Go HTTP API on Gregale?

Not for standard module-root services. Gregale detects go.mod, picks the Go toolchain version from your go directive, compiles ./out and runs it automatically.

How fast do scale-to-zero Go microVMs wake and stop billing?

Idle instances pause about one second after the last HTTP request to stop billing, park after 10 minutes, and resume quickly on the next request without an always-on VM charge.

Why avoid a Heroku-style Procfile for Go apps on Gregale?

Heroku Go Procfiles often reference a custom binary name installed only by Heroku’s buildpack; on Gregale, remove that Procfile or point hosting start in gregale.yaml at ./out.