Go hosting
Deploy Go HTTP and gRPC services as small static binaries on dedicated vCPU, with managed PostgreSQL or Redis on the private network. Go's low memory use leaves most of a plan available for databases and workers.
Build and run
- Detected by
- go.mod
- Build
- CGO_ENABLED=0 go build -o server ./cmd/server
- Start
- ./server
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /server ./cmd/server
FROM gcr.io/distroless/static-debian12
COPY --from=build /server /server
EXPOSE 8080
ENTRYPOINT ["/server"]Recommendations
- Distroless or scratch base images deploy quickly and contain very little besides your binary.
- Use go.uber.org/automaxprocs so GOMAXPROCS matches the vCPUs allocated to the process.
- With pgx, a pool size of about four connections per vCPU works well against managed PostgreSQL.
- gRPC and HTTP/2 are supported end to end.
Plans
| Plan | Price | vCPU | Memory | NVMe | Databases | Backups |
|---|---|---|---|---|---|---|
| Launch | $149/mo | 8 | 16 GB | 160 GB | 1 | Daily, kept 7 days |
| Grow | $249/mo | 12 | 32 GB | 320 GB | 2 | Daily, kept 14 days |
| Scale | $349/mo | 16 | 48 GB | 500 GB | 3, plus a read replica | Hourly and daily, kept 30 days |
| Custom | On request | As required | Up to a full server | As required | As required | As required |
Questions
Do we need a Dockerfile to deploy Go?
No. 9live detects Go and builds it with a maintained buildpack. If your repository has a Dockerfile, we use it instead.
How are environment variables managed?
Set them per environment in the dashboard or with the CLI. They are encrypted at rest and injected at runtime. Connection strings for managed databases are added automatically.
What happens when a deploy fails?
If the build fails, or the new release fails its health check, the current release keeps serving traffic. You get a notification with the build or health-check logs.
Other frameworks
Talk to an engineer about your setup
Tell us what you run today and where it runs. We reply within one business day with a recommended plan and an estimate for the migration.
