Blog · Deploy guides
How to deploy a Go Fiber app in 2026: one command, HTTPS and a Dockerfile you keep
You have a Fiber app that answers on localhost:3000, and you want it at a public address with HTTPS. On Pethost that is one command, pethost deploy, run in the folder that has go.mod. It writes the Dockerfile for you, builds the program and prints its address. Fiber's hello world was built and started in 45 seconds the first time, and in 3 seconds the second.
- One command:
pethost deployin the folder that hasgo.mod. There is no config file to write and no build or start command to fill in. - What it does: reads the Go version from
go.mod, writes a Dockerfile that runsgo build, and starts the program. - The port: whatever
app.Listennames. Pethost finds the port the program listens on, so noPORTvariable is needed. - The address:
https://my-api.yourname.pethost.app, with HTTPS at once. Your own domain is one DNS record. - The price: €9.99 a month for a machine of 2 vCPU, 3 GB and 30 GB that runs this app and every other project you have. There is no free tier.
What you need to deploy a Fiber app in 2026
Three things: the app, the pethost command and a Pethost account.
The app here is Fiber's hello world: go mod init my-api, go get github.com/gofiber/fiber/v3, and this main.go:
package main
import (
"log"
"github.com/gofiber/fiber/v3"
)
func main() {
// Initialize a new Fiber app
app := fiber.New()
// Define a route for the GET method on the root path '/'
app.Get("/", func(c fiber.Ctx) error {
// Send a string response to the client
return c.SendString("Hello, World 👋!")
})
// Start the server on port 3000
log.Fatal(app.Listen(":3000"))
}
The command is one program, installed by one line. Every command it has is in the CLI's reference.
curl -fsSL https://pethost.dev/install.sh | sh # macOS, Linux
irm https://pethost.dev/install.ps1 | iex # Windows, in PowerShell
The account needs a plan. If you are not signed in, pethost deploy opens your browser and signs you in. If you have no plan yet, it shows you where to choose one, and waits.
Deploy the Fiber app with one command
Go to the folder that has go.mod and run pethost deploy. This is the whole screen, for the hello world:
$ cd my-api
$ pethost deploy
Name it [my-api]: it will live at https://my-api.sam.pethost.app
✓ Packed 3 files, 5 KB
✓ Uploaded straight to your machine
✗ /compose.yaml: the project directory has no compose.yaml at its root: add one
✓ Go program detected, wrote Dockerfile.
✓ Packed 4 files, 5 KB
✓ Uploaded straight to your machine
✓ Built and started in 45 s
· wrote compose.yaml for the Dockerfile: the service app, reading .env
✓ app listens on 3000 → https://my-api.sam.pethost.app
It answers 200.
https://my-api.sam.pethost.app
Wrote .pethost (commit it). Next: pethost logs -f · pethost open
- It asks one thing The project's name, which is the first word of its address. Enter takes the folder's name.
- The machine finds nothing to run The line with the cross is its answer: a project runs from a Dockerfile or a Compose file, and the folder has neither yet.
- pethost writes the Dockerfile It saw
go.modand apackage mainbeside it, and uploads the folder again. - The machine builds and starts it It sees that the program listens on 3000 and sends the address there. Then pethost asks the address itself, and prints what it answered: 200.
The address answers what the handler sends, and a path with no route gets Fiber's own 404:
$ curl https://my-api.sam.pethost.app/
Hello, World 👋!
The file .pethost says which project this folder is. Commit it with the Dockerfile, and the next deploy asks nothing.
The Dockerfile that pethost writes for a Fiber app
This is the file as it was written into the hello world's folder, whole:
# Written by pethost deploy for this Go program: Go 1.25 (go.mod), its program is ..
# It is yours now: change it as you like. pethost does not write it again.
FROM golang:1.25
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o /usr/local/bin/my-api .
CMD ["my-api"]
Nothing in it is about Fiber: a Fiber app is a Go program, and that is what pethost looks for. Three things come from your folder:
- The Go version is the one on the
goline ofgo.mod. - The program is the
package mainat the module's root, or the one folder ofcmd/that has one. Wherecmd/has several, pethost writes nothing and says why. - The name is the last part of the module's path, as
go installwould name it.
The two cache mounts keep Go's modules and build cache on your machine between deploys. If the machine cannot build or start the Dockerfile pethost wrote, pethost takes the file back out of your folder and says what failed.
Which port does Fiber listen on?
The one you give app.Listen. The hello world says ":3000", and the deploy's screen says so too: app listens on 3000. The machine looks at the running container, so there is no port to declare and no PORT variable to read. Fiber's own start screen is in the log:
$ pethost logs
2026-10-10T11:29:50Z app INFO Server started on: http://127.0.0.1:3000 (bound on host 0.0.0.0 and port 3000)
2026-10-10T11:29:50Z app INFO Total handlers: 2
2026-10-10T11:29:50Z app INFO Prefork: Disabled
2026-10-10T11:29:50Z app INFO PID: 1
Visitors come over HTTPS on the usual port, and the proxy on your machine passes each request to the program. A variable the app reads is one command, pethost env set DATABASE_URL: it asks for the value without showing it, puts it into the project's .env file on the machine, and later deploys keep it.
Change the code and deploy again
Edit a handler and run the same command. The machine keeps the build's layers and Go's caches:
$ pethost deploy
my-api (.pethost)
✓ Packed 5 files · uploaded · built and started in 3 s
· wrote compose.yaml for the Dockerfile: the service app, reading .env
· kept the project's x-pethost
It answers 200.
https://my-api.sam.pethost.app
To deploy on every push instead, connect the repository once:
pethost github sam/my-api # from now on, every push deploys itself
Pethost reads only the repositories you gave its GitHub App. If a deploy goes wrong, pethost rollback puts the version before it back, and your machine keeps the three versions before the current one. An AI agent can do all of this for you through Pethost's MCP server: how an agent deploys and looks after a project. The same command deploys a Gin app.
Use your own domain for the app
Any name under your account's domain is an address at once, with HTTPS. A domain you own takes one command and one DNS record:
pethost domain add api.example.com
The command prints the record to make: a CNAME from your name to your machine's name. The certificate comes by itself once the name resolves, and renews itself.
What you get for the price
Pethost is €9.99 a month for everything you host, on 2 vCPU, 3 GB of memory and 30 GB of disk. A Fiber program is one small binary, so the machine has room for its database, a worker and your other projects. There is no fee per project and nothing metered: a busy month costs what a quiet one does.
- €9.99 a month for the whole machine
- 45 s to build and start the hello world, the first time
- 3 s for the deploy after it
What is already done on it: HTTPS with certificates that renew themselves, deploys from GitHub, nightly backups kept for 14 days, SSH into any container, and every request counted, with the busiest paths and the error rate of the last 30 days. The machine is always on, so a request never waits for a cold start. The plans are on the pricing part of the first page.
Pethost is the best pick for
- Go developers with a small service: the program, its database and its worker on one machine, on one bill
- Solo developers with several side projects, each at an address of its own
- People whose agent deploys for them: Claude Code or Codex puts the app online and reads its logs
- Early startups who want a fixed monthly cost while the product is small
Look elsewhere if
- Your application needs several regions or autoscaling
Questions
Does a Fiber app need a Dockerfile to deploy?
On Pethost a project runs from a Dockerfile or a Compose file, and you do not have to write it: in a folder that has neither, pethost deploy writes the Dockerfile for a Go program and deploys it. The file stays in your folder, and you can change it.
Do I have to read the PORT variable in a Fiber app?
No. Keep the port you give app.Listen, for example ":3000". Pethost finds the port the running program listens on and sends the address there, over HTTPS.
Can I deploy a Fiber app from GitHub on every push?
Yes. Deploy the folder once with pethost deploy, then run pethost github owner/repository. From then on every push to the repository deploys itself, and pethost rollback goes back to an earlier commit.
How do I add a custom domain with HTTPS to a Fiber app?
Run pethost domain add api.example.com and make the one DNS record it prints, a CNAME to your machine's name. The certificate comes by itself once the name resolves, and renews itself.
What does it cost to host a Fiber app on Pethost?
€9.99 a month for the Starter machine of 2 vCPU, 3 GB and 30 GB, with no fee per project: the same machine runs your other apps, sites and databases. There is no free tier. Prices are without VAT.
The screens are deploys of Fiber's hello world, with Fiber 3.5.0, Go 1.25 and pethost 0.2.1, on a test machine of ours that had built nothing before. The account in them is the example one, sam.
Put your projects online today
A machine of your own, as many projects as fit, one flat price. Nothing metered, nothing billed on top.