Deploy a Laravel Go app
Laravel Go, compiled on a VM of its own. git push to deploy.
Shelley handles the setup. About 10 minutes.
Prefer a terminal?
curl -fsSL https://exe.dev/deploy/laravel-go/prompt.txt | ssh exe.dev new --prompt=/dev/stdinLaravel Go is Laravel for Go, on the standard library's net/http:
routing, validation, models, queues, the scheduler, mail and Inertia,
compiled with your migrations and views into a single binary. This page
puts yours on an exe.dev VM of its own. git push compiles it there and
switches to the new release, PostgreSQL runs next to it, and the queue
worker and scheduler come back after a reboot. exe.dev serves it over
HTTPS, private until you share it.
Laravel Go is in beta. For the other Laravels, see Deploy a Laravel PHP app and Deploy a Laravel Rust app.
What you get#
- Go 1.27 (the VM's), Node.js 24 and PostgreSQL 16 installed, with an app database the exedev user reaches over its socket.
- A ~/app.git whose pre-receive hook builds each push (npm run build, go build), migrates, switches releases and checks /up; a failed deploy rejects the push and leaves the running release alone.
- The app running as app.service on 127.0.0.1:8000, the queue worker as app-worker.service and the scheduler as app-schedule.timer, all enabled to come back after a reboot.
- Settings in ~/app.env (mode 600) with a generated APP_KEY, and uploads in ~/data/storage.
- A nightly backup by app-backup.timer, with the first backup opened and checked.
- With REPO=new, a fresh Laravel Go app that trusts exe.dev's proxy and greets you by your exe.dev email at /hello.
What's running, and where
https://my-laravel-go.exe.xyz/
Your app, until you make it public
ssh my-laravel-go.exe.xyz
git push to deploy; shell and logs
Deploy with Shelley#
Click Deploy and Shelley will set up Laravel Go on a new VM, then check that it works. No config-file wrangling required.
Have these ready; Shelley asks for them:
REPO: the GitHub repository to deploy, as owner/name or a URL, ornewto start a fresh Laravel Go app
Prefer a terminal?
curl -fsSL \
https://exe.dev/deploy/laravel-go/prompt.txt \
| ssh exe.dev new --prompt=/dev/stdinWhen it's done, run this on your computer (only you can):
git clone -o exe my-laravel-go.exe.xyz:app.git # if you started fresh
git remote add exe my-laravel-go.exe.xyz:app.git # or, in your own app's checkoutWhat Shelley is told
REPO=<fill-this-in>
Set up Laravel Go on this VM by following the exe.dev recipe at https://exe.dev/deploy/laravel-go.md?via=deploy from top to bottom.
The values at the top of this message are mine:
- REPO: the GitHub repository to deploy, as owner/name or a URL, or `new` to start a fresh Laravel Go app
Ask me for any that still say <fill-this-in> before you need them.
The recipe's example VM name is my-laravel-go. This VM's name is the output of `hostname`: use it wherever the recipe writes my-laravel-go. Skip the step that creates the VM; you are on it.
You are done when all of these are true. Check each one yourself:
- Go 1.27 (the VM's), Node.js 24 and PostgreSQL 16 installed, with an app database the exedev user reaches over its socket.
- A ~/app.git whose pre-receive hook builds each push (npm run build, go build), migrates, switches releases and checks /up; a failed deploy rejects the push and leaves the running release alone.
- The app running as app.service on 127.0.0.1:8000, the queue worker as app-worker.service and the scheduler as app-schedule.timer, all enabled to come back after a reboot.
- Settings in ~/app.env (mode 600) with a generated APP_KEY, and uploads in ~/data/storage.
- A nightly backup by app-backup.timer, with the first backup opened and checked.
- With REPO=new, a fresh Laravel Go app that trusts exe.dev's proxy and greets you by your exe.dev email at /hello.
Read the whole recipe, including the closed details, and follow "Set up
by hand" in order, skipping VM creation. REPO=new takes "Start a new
app"; anything else takes "Bring your app" (turn URLs into owner/name).
If cloning fails, the repository is private: give the owner the `ssh
exe.dev integrations add github` command from that step, with this VM's
name and the repository, and wait for them.
Never commit to the owner's code, on GitHub or in ~/app.git. If their
app doesn't trust exe.dev's proxy yet, tell them about the one line in
"Behind exe.dev's proxy" instead. Generate secrets; ask the owner for
keys to outside services, and never invent values. If a deploy fails,
read its output, fix what you can on the VM, and redeploy with
`~/app.git/hooks/pre-receive </dev/null`. Use ~/bin/pre-receive and
~/bin/app-backup as published; if you think one is wrong, tell the
owner rather than editing it.
Don't run Restore or Update, don't reboot, and leave the VM private.
For a new app, the URLs to open include /hello.
Finish with the URLs I should open and these commands, which only I can run, from my own computer (with this VM's name in them):
git clone -o exe my-laravel-go.exe.xyz:app.git # if you started fresh
git remote add exe my-laravel-go.exe.xyz:app.git # or, in your own app's checkout
Also at /deploy/laravel-go/prompt.txt. The recipe it follows is /deploy/laravel-go.md.
Open your app#
When Shelley is done, open https://my-laravel-go.exe.xyz/ and sign in
to exe.dev. Started fresh? You'll see Laravel's welcome page, and
/hello greets you by your exe.dev email. Only you, and people you
share the VM with, can open it.
On the VM:
| What | Where |
|---|---|
| The repository you push to | ~/app.git |
The running release: app and public/ |
~/app → ~/releases/<time>-<commit> |
| Settings and secrets (mode 600) | ~/app.env, linked as .env in each release |
| Uploads and other files the app writes | ~/data/storage |
| The database | PostgreSQL, database app |
| Backups | ~/backups |
| Logs | journalctl -u app (and -u app-worker, -u app-schedule) |
The binary is the app's console too: cd ~/app && ./app route:list,
./app migrate:status, ./app queue:failed.
Deploy with git push#
On your computer, clone the new app from the VM, or add the VM as a remote in your own checkout:
git clone -o exe my-laravel-go.exe.xyz:app.git my-laravel-go
git remote add exe my-laravel-go.exe.xyz:app.git # or, in your checkout
Then commit and push:
git push exe main
Use your default branch's name if it isn't main. If ssh can't find
the VM that way, use vm+my-laravel-go@vm.exe.xyz:app.git
(why).
The deploy runs inside git push:
remote: -----> Building 3f2c9a1 Add a guestbook
remote: ✓ built in 205ms
remote: Migrating `2026_12_02_120000_create_greetings_table`...
remote: 1 migration ran.
remote: -----> Switching to 3f2c9a1
remote: -----> Deployed 3f2c9a1 to https://my-laravel-go.exe.xyz/
The hook builds the pushed commit in ~/build: npm ci,
npm run build and go build. It puts the binary and public/ in a
new directory under ~/releases, runs ./app migrate --force, points
~/app at it, restarts the app and the queue worker, and checks that
/up answers. Go keeps its build cache in ~/.cache/go-build, so after
the first build, which takes about a minute, a deploy takes about ten
seconds. The last three releases stay.
If the build or a migration fails, git rejects the push and nothing
changes. If the new release doesn't answer /up, the hook switches back
at once and rejects the push:
remote: -----> b5c1d02 answers /up with HTTP 000. Its errors: journalctl -u app
remote: -----> Rolling back to 3f2c9a1
remote: -----> Deploy failed. Still running 3f2c9a1.
To roll back, push an older commit: git push -f exe <good-sha>:main.
A rollback can't undo migrations, so keep them backward-compatible.
Settings and secrets#
~/app.env, readable only by you, is every release's .env. It starts
with production values:
APP_ENV=production
APP_KEY=base64:... # generated; encrypts cookies and sessions
APP_DEBUG=false
APP_URL=https://my-laravel-go.exe.xyz
LOG_CHANNEL=stderr # to the journal: journalctl -u app
DATABASE_URL=postgres:///app?host=/var/run/postgresql
In production, Laravel answers only requests for APP_URL's host, so
change it when you add a domain. After editing, restart:
sudo systemctl restart app app-worker. VITE_* values are compiled
into the frontend, so for those, redeploy with
~/app.git/hooks/pre-receive </dev/null. Keep a copy of APP_KEY
somewhere safe; the nightly backup has it.
Behind exe.dev's proxy#
exe.dev's HTTPS proxy ends TLS and connects to
127.0.0.1:8000, saying what the visitor asked for in X-Forwarded-Proto,
-Host and -For. Laravel believes those only from proxies it trusts,
so a new app trusts loopback in bootstrap/app.go:
Middleware: func(m *laravel.Middleware, cfg *config.Config) {
// exe.dev's HTTPS proxy connects from 127.0.0.1: believe its X-Forwarded-* headers.
m.Proxies = []string{"127.0.0.1", "::1"}
// ...
},
Without it, r.IP() is always 127.0.0.1 and the URLs Laravel builds
start with http://. Don't use "*": exe.dev appends to any
X-Forwarded-For a visitor sends, so the first address can be forged.
The database#
PostgreSQL 16 runs on the VM. The app database belongs to the exedev
user, which the app runs as, so it signs in over the socket with no
password. Look inside with psql app. Sessions, the cache and the queue
are tables there too.
For SQLite instead, replace postgres.Driver with sqlite.Driver in
bootstrap/app.go (import go.laravel.com/db/sqlite), run
go mod tidy, and in ~/app.env set
DATABASE_URL=sqlite:///home/exedev/data/app.sqlite. In
~/bin/app-backup, swap the pg_dump line for
sqlite3 ~/data/app.sqlite ".backup '$work/app.sqlite'".
Queues and the scheduler#
app-worker.service runs ./app queue:work on the database queue and
restarts on every deploy, since a worker runs the code it was compiled
with. On restart it stops taking jobs and finishes the ones it's running.
app-schedule.timer runs ./app schedule:run every minute. Check them:
cd ~/app && ./app schedule:list
journalctl -u app-worker -u app-schedule -n 20 --no-pager
Jobs run in goroutines, so one worker handles several at once: add
--concurrency=4 to ExecStart with
sudo systemctl edit --full app-worker.
Backups#
Every night, app-backup
writes ~/backups/app-<time>.tar.gz: a pg_dump of the database,
storage/app, ~/app.env and the code as a git bundle. It keeps 14.
Take one now with ~/bin/app-backup. Keep copies off the VM; on your
computer:
scp -r my-laravel-go.exe.xyz:backups .
Make it public, add a domain#
On your computer:
ssh exe.dev share set-public my-laravel-go
For your own domain, point a CNAME at my-laravel-go.exe.xyz, run
ssh exe.dev domain add my-laravel-go app.example.com
(custom domains), and set
APP_URL=https://app.example.com in ~/app.env.
Beta notes#
Laravel Go 0.1.0, as tested here on December 2, 2026:
- It needs Go 1.27, the Go a new exe.dev VM comes with.
- A release needs
public/next to the binary (views and migrations are built in); the hook copies it. - The built-in Reverb server (
reverb:start) is for development only, per Laravel's docs.
The nuts and bolts#
Happy with what Deploy set up? You can stop here. These are the steps Shelley follows, which you can also run by hand.
Set up by hand
Create the VM#
On your computer (pick another name if my-laravel-go is taken):
ssh exe.dev new --name=my-laravel-go
ssh my-laravel-go.exe.xyz
Everything else runs on the VM, as exedev.
Install Node.js and PostgreSQL#
Go 1.27, which Laravel Go needs, comes with the VM. Add Node.js 24 from
NodeSource for the Vite build, PostgreSQL 16 from Ubuntu, and the
Laravel CLI for laravel new:
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs postgresql
curl -fsSL https://laravel.com/install.sh | sh
export PATH="$HOME/.laravel/bin:$PATH"
go version; node --version; psql --version; laravel --version
Expect go1.27 or later, v24, 16 and Laravel CLI. On an older VM
with Go 1.26, that's fine too: when a go.mod asks for a newer Go,
go build downloads it, checked against Go's checksum database.
The database and settings#
A PostgreSQL role for exedev and its app database, the directories,
and the settings file with a fresh APP_KEY:
sudo -u postgres createuser exedev
sudo -u postgres createdb -O exedev app
mkdir -p ~/data/storage ~/releases ~/backups ~/bin
if [ ! -e ~/app.env ]; then
install -m 600 /dev/null ~/app.env
cat >> ~/app.env <<ENV
# Laravel Go settings; each release links this file as .env.
# Keep a copy somewhere safe: APP_KEY decrypts cookies and sessions.
APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:$(openssl rand -base64 32)
APP_DEBUG=false
APP_URL=https://$(hostname).exe.xyz
LOG_CHANNEL=stderr
LOG_LEVEL=info
DATABASE_URL=postgres:///app?host=/var/run/postgresql
SESSION_DRIVER=database
CACHE_STORE=database
QUEUE_CONNECTION=database
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
MAIL_MAILER=log
ENV
fi
psql app -c 'select current_user'
stat -c '%a %n' ~/app.env
Expect exedev and 600 /home/exedev/app.env. An existing ~/app.env
is left alone: its APP_KEY decrypts your sessions.
The services#
The app, the queue worker, and the scheduler, each running the binary in
~/app. They wait for the first deploy:
sudo tee /etc/systemd/system/app.service >/dev/null <<'UNIT'
[Unit]
Description=Laravel Go app on 127.0.0.1:8000
After=network.target postgresql.service
Wants=postgresql.service
ConditionPathExists=/home/exedev/app/app
[Service]
User=exedev
WorkingDirectory=/home/exedev/app
ExecStart=/home/exedev/app/app
Restart=always
RestartSec=2
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target
UNIT
sudo tee /etc/systemd/system/app-worker.service >/dev/null <<'UNIT'
[Unit]
Description=Laravel Go queue worker
After=network.target postgresql.service
Wants=postgresql.service
ConditionPathExists=/home/exedev/app/app
[Service]
User=exedev
WorkingDirectory=/home/exedev/app
ExecStart=/home/exedev/app/app queue:work
Restart=always
RestartSec=5
TimeoutStopSec=150
[Install]
WantedBy=multi-user.target
UNIT
sudo tee /etc/systemd/system/app-schedule.service >/dev/null <<'UNIT'
[Unit]
Description=Laravel Go scheduler (app schedule:run)
ConditionPathExists=/home/exedev/app/app
[Service]
Type=oneshot
User=exedev
WorkingDirectory=/home/exedev/app
ExecStart=/home/exedev/app/app schedule:run
UNIT
sudo tee /etc/systemd/system/app-schedule.timer >/dev/null <<'UNIT'
[Unit]
Description=Run the Laravel Go scheduler every minute
[Timer]
OnCalendar=*-*-* *:*:00
AccuracySec=1s
[Install]
WantedBy=timers.target
UNIT
sudo systemctl daemon-reload
sudo systemctl enable app app-worker app-schedule.timer
sudo systemctl start app-schedule.timer
The deploy hook and backups#
Fetch pre-receive, the hook from Deploy with git push, and app-backup, and run the backup nightly:
curl -fsSL -o ~/bin/pre-receive https://exe.dev/deploy/laravel-go/pre-receive
curl -fsSL -o ~/bin/app-backup https://exe.dev/deploy/laravel-go/app-backup
chmod +x ~/bin/pre-receive ~/bin/app-backup
sudo tee /etc/systemd/system/app-backup.service >/dev/null <<'UNIT'
[Unit]
Description=Back up the Laravel Go app to ~/backups
[Service]
Type=oneshot
User=exedev
ExecStart=/home/exedev/bin/app-backup
UNIT
sudo tee /etc/systemd/system/app-backup.timer >/dev/null <<'UNIT'
[Unit]
Description=Back up the Laravel Go app every night
[Timer]
OnCalendar=*-*-* 03:00:00
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.target
UNIT
sudo systemctl daemon-reload
sudo systemctl enable --now app-backup.timer
Get the code#
Start a new app (REPO=new). Create it with laravel new, which
also installs its frontend packages and compiles it once, then trust
exe.dev's proxy and add /hello:
cd /tmp && laravel new my-app --go
cd /tmp/my-app
sed -i 's/^\(\t*\)Middleware: func(m \*laravel.Middleware, cfg \*config.Config) {$/&\n\1\t\/\/ exe.dev'"'"'s HTTPS proxy connects from 127.0.0.1: believe its X-Forwarded-* headers.\n\1\tm.Proxies = []string{"127.0.0.1", "::1"}\n/' bootstrap/app.go
cat > routes/hello.go <<'GO'
package routes
import (
"cmp"
"fmt"
"go.laravel.com/web"
)
// hello greets visitors signed in to exe.dev, whom exe.dev's proxy names
// in X-ExeDev-Email.
func hello(r *web.Request) *web.Response {
email := cmp.Or(r.Header.Get("X-ExeDev-Email"), "stranger")
return web.Text(fmt.Sprintf("Hello, %s! You asked for %s from %s.\n", email, r.FullURL(), r.IP()))
}
GO
sed -i 's|^\troute.Get("/", welcome.Show)$|&\n\troute.Get("/hello", hello)|' routes/web.go
gofmt -l . ; go vet ./... && grep -c 'm.Proxies\|"/hello"' bootstrap/app.go routes/web.go
Expect bootstrap/app.go:1 and routes/web.go:1, and nothing from
gofmt or go vet. Commit it into a new ~/app.git with the hook, and
push, which deploys:
git init -q --bare -b main ~/app.git
ln -s ~/bin/pre-receive ~/app.git/hooks/pre-receive
cd /tmp/my-app && git init -q -b main
git add -A
git -c user.name="exe.dev" -c user.email="exedev@$(hostname).exe.xyz" commit -q -m "New Laravel Go app"
git push -q ~/app.git main
cd ~ && rm -rf /tmp/my-app
The push ends with -----> Deployed.
Or bring your app from GitHub (replace OWNER/NAME), and deploy it:
git clone -q --bare https://github.com/OWNER/NAME.git ~/app.git
ln -s ~/bin/pre-receive ~/app.git/hooks/pre-receive
git clone -q ~/app.git /tmp/app-check && grep -E '^go |go\.laravel\.com' /tmp/app-check/go.mod; grep -o 'db/[a-z]*"' /tmp/app-check/bootstrap/app.go; rm -rf /tmp/app-check
~/app.git/hooks/pre-receive </dev/null
The greps show the Go and Laravel Go versions it needs and its
database driver (db/postgres matches the settings above). Add the
app's own settings from its .env.example to ~/app.env. The hook runs
npm ci, so the repository needs its package-lock.json; laravel new
apps commit it. For a private repository, attach it with the
GitHub integration, on your computer:
ssh exe.dev integrations add github --name app-repo --repository OWNER/NAME --attach vm:my-laravel-go
Then clone https://github.int.exe.xyz/OWNER/NAME.git on the VM
instead; no token lands on the disk.
Check the app#
Ask for pages the way exe.dev's proxy does:
for s in app app-worker app-schedule.timer app-backup.timer; do echo "$s $(systemctl is-active $s)"; done
h=$(hostname).exe.xyz
curl -s -o /dev/null -w '%{http_code}\n' -H "Host: $h" localhost:8000/up
curl -s -H "Host: $h" -H "X-Forwarded-Host: $h" -H 'X-Forwarded-Proto: https' \
-H 'X-Forwarded-For: 203.0.113.7' -H 'X-ExeDev-Email: you@example.com' localhost:8000/hello
Expect four active, 200, and, for a new app,
Hello, you@example.com! You asked for https://my-laravel-go.exe.xyz/hello from 203.0.113.7.
Test a backup#
backup=$(~/bin/app-backup)
rm -rf /tmp/restore-test && mkdir /tmp/restore-test && tar -xzf "$backup" -C /tmp/restore-test
pg_restore --list /tmp/restore-test/app.dump | grep -c 'TABLE DATA'
git -C ~/app.git bundle verify -q /tmp/restore-test/app.bundle && echo 'code ok'
grep -c '^APP_KEY=base64:' /tmp/restore-test/app.env
rm -rf /tmp/restore-test
Expect a count of tables, code ok and 1.
Restore a backup
On the VM, pick a backup (ls -lt ~/backups), stop the app, and load
the database, uploads and settings:
backup=~/backups/app-20261202-030000.tar.gz # the one you want
sudo systemctl stop app app-worker app-schedule.timer
rm -rf /tmp/restore && mkdir /tmp/restore && tar -xzf "$backup" -C /tmp/restore
pg_restore --clean --if-exists --no-owner -d app /tmp/restore/app.dump
rsync -a --delete /tmp/restore/storage/app/ ~/data/storage/app/
install -m 600 /tmp/restore/app.env ~/app.env
sudo systemctl start app app-worker app-schedule.timer
rm -rf /tmp/restore
On a new VM, follow Set up by hand up to Get the code, copy the backup over, and load the code from its bundle before restoring as above:
mkdir /tmp/restore && tar -xzf ~/app-20261202-030000.tar.gz -C /tmp/restore
git clone -q --bare /tmp/restore/app.bundle ~/app.git
ln -s ~/bin/pre-receive ~/app.git/hooks/pre-receive
~/app.git/hooks/pre-receive </dev/null
If the VM has a new name, set APP_URL to its address after restoring
~/app.env, and sudo systemctl restart app.
Update Laravel Go, Go and Node.js
Laravel Go and your modules are in go.mod and go.sum, so an
update is a commit. On your computer: go get go.laravel.com@latest,
go mod tidy, go test ./..., commit, and git push exe main. While
it's in beta, read the
release notes and
UPGRADE.md first.
Go comes with the VM, in /usr/local/go. To build with a newer
release, put it in your go.mod (go get go@1.27.5 on your computer)
and push: go build downloads that release on the VM and checks it
against Go's checksum database.
PostgreSQL and Node.js update with apt:
sudo apt-get update && sudo apt-get upgrade -y.
Something not working?
journalctl -u app -n 50 --no-pager
journalctl -u app-worker -n 50 --no-pager
- 400 Bad Request on every page: the address isn't
APP_URL's host. FixAPP_URLin~/app.envandsudo systemctl restart app. http://links, or every visitor is127.0.0.1: the app doesn't trust exe.dev's proxy; see Behind exe.dev's proxy.- 502 from exe.dev: nothing answers on 127.0.0.1:8000. Check
systemctl status appand its journal. missing go.sum entry: rungo mod tidyon your computer and commitgo.sum.npm cifails: commitpackage-lock.json, and keep it in step withpackage.json(npm installon your computer).- Disk filling up:
du -sh ~/.cache/go-build ~/go ~/releases ~/backups.go clean -cachefrees the build cache; the next deploy rebuilds from scratch. git pushrejected with "pre-receive hook declined": the deploy failed and the old release still runs; the lines above say why.
Frequently asked questions#
Is Laravel Go ready for production?
It's a beta (0.1), released December 2, 2026, and Laravel says releases before 1.0 may include breaking changes to APIs and configuration. Your go.mod and go.sum pin the version, and the deploy builds exactly what they say; read the release notes before go get go.laravel.com@latest. For an app that has to be boring today, Laravel PHP is the safe choice.
Why build on the VM?
So git push is the whole deploy, and what runs is always a commit in ~/app.git. Go caches compiled packages in ~/.cache/go-build, so a change to your own code builds in seconds. To build somewhere else, such as CI, copy the binary and public/ into a new directory in ~/releases and follow the second half of ~/bin/pre-receive.
Why PostgreSQL and not SQLite?
It's Laravel Go's default, and Laravel recommends running the database you develop against. On the VM it's one apt package, and the app signs in over a socket with no password. SQLite works too; see The database.
Does a deploy drop requests?
Barely. On restart Laravel stops taking new connections and lets requests in flight finish, and the new binary answers within about a second. Requests that arrive in that gap get an error from exe.dev's proxy.
How does this compare to Laravel Cloud?
Laravel Cloud is the managed option: autoscaling, scale-to-zero, managed databases, queues and Reverb. This page is one always-on server you can SSH into, with the database, worker and scheduler on the same disk, and an agent beside your code. exe.dev doesn't scale across machines.
How big a VM does it need?
The default (2 vCPUs, 8 GB, 25 GB of disk) is plenty. The starter's binary is about 50 MB, and Go's module and build caches take about 1.2 GB of disk.
Published Dec 2, 2026 · Updated Dec 2, 2026 · tested end to end Dec 2, 2026 · Markdown · manifest.json · Something wrong? Tell us