Matomo Analytics

Sites

Go support

Deploy Laravel for Go or any other Go web application on your own servers.

Push your code, Ploi builds and runs it

Pick Go as the project type, or install a repository with a go.mod and Ploi picks it up. Ploi installs Go, builds the binary on every deploy and keeps it running behind NGINX, with SSL and logs in the panel.

ploi.io/sites/go
General Go SSL Repository Logs

Running

Every deployment builds the binary and restarts it.

Listens on

127.0.0.1:8000

Binary

app

Toolchain

go1.27.4

Scheduler

schedule:run, every minute

Queue worker

queue:work

How Ploi runs a Go site

From repository to a running binary, without writing server config

Set up from go.mod

Ploi reads your go.mod, sees whether the app is built on Laravel for Go and finds the main package to build: the module root, or a command under cmd/.

Built on every deploy

Each deployment runs go build on the server with the versions in your go.sum, and restarts the binary once the build succeeds.

Kept running behind NGINX

Supervisor runs the binary on its own port and starts it again if it stops. NGINX serves your static files and passes the rest to the app.

What you get with every Go site

  • The latest Go release from go.dev, installed once per server and checked against its checksum
  • A go.mod that asks for a newer Go downloads that release on the next build
  • Its own port, passed to the app as PORT and SERVER_PORT
  • NGINX as reverse proxy, with WebSockets and free Let's Encrypt certificates
  • A Go tab with the Supervisor state, the binary, the Go version and recent output
  • Create Go sites from the API and the MCP server too
Deploy script
$ git pull origin main
# Laravel for Go builds its frontend first:
$ npm ci && npm run build
$ go build -o app .
go: downloading go.laravel.com v0.2.0
$ ./app migrate --force
4 migrations ran.
Application deployed, restarting the binary

Ready for Laravel for Go

When go.laravel.com is in your go.mod, Ploi sets up the rest of the framework too

Environment ready

On the first clone Ploi points APP_URL at your domain and generates an APP_KEY when it is empty.

Migrations on deploy

The deploy script runs migrate --force after the build, so the database follows your code.

Frontend assets

npm ci and npm run build run before the build, and NGINX serves the built files directly.

Scheduler

Turn on the scheduler from the Go tab. Ploi adds a cronjob that runs schedule:run every minute.

Queue worker

Start queue:work from the Go tab. It runs as a daemon and restarts after every deployment.

Behind a proxy

The Go tab shows the line to trust NGINX as a proxy, so visitor IPs and HTTPS URLs come through.

Any Go web app

net/http, Gin, Echo, Fiber, Chi or your own server: if it listens on a port, Ploi can run it. Read the port from PORT or SERVER_PORT and bind to 127.0.0.1, NGINX takes care of the outside world.

Laravel for Go net/http Gin Echo Fiber Chi Gorilla
main.go
// Ploi passes the site's port in PORT
port := os.Getenv("PORT")
if port == "" {
    port = "8000"
}

log.Fatal(http.ListenAndServe("127.0.0.1:"+port, mux))

Questions

I already have a site with a Go repository on it. Can I switch it over?

Yes. Change the project type to Go in the site settings, then click "Set up from go.mod" on the Go tab. Ploi reads go.mod, starts the binary and writes a deploy script that builds it. A new site picks up a repository with a go.mod and no composer.json on its own.

Which Go version does Ploi install?

The latest release from go.dev, in /usr/local/go, shared by every Go site on the server. When your go.mod asks for a newer Go, that release is downloaded on the next build. Update to the newest release from the Go tab.

Which package does Ploi build?

The module root when it is a main package, otherwise the command under cmd/, or the one named after your module when there are several. The binary is called app. To build something else, change the go build line in the deploy script.

Which database does Laravel for Go use?

New Laravel for Go applications connect to PostgreSQL through DATABASE_URL in .env. For MySQL or SQLite, swap the driver in bootstrap/app.go and point DATABASE_URL at your database.

What happens before the first deployment?

The binary does not exist yet, so the Go tab tells you to deploy the site. After the first successful build the app starts by itself.

Ready to dive in?
Start your free trial today.

Create an account and enjoy your 5-day free trial — no credit card required.

Start your free trial