Deploying Laravel Go and Laravel Rust over SSH
Laravel Go and Laravel Rust bring the Laravel developer experience to compiled languages. Both are in beta, and both change what a deployment looks like: instead of shipping PHP sources and running Composer on the server, you ship a binary.
A binary is a good fit for SSH deployments. There is no runtime to install and no dependency to resolve on the server. The question is the one we covered for Next.js and AdonisJS: where to build it, so that it runs on the server.
Catapult now has two experimental recipes for this: laravel_go and laravel_rust.
What gets deployed
- Laravel Go compiles to a single binary with its views and migrations embedded. Catapult delivers the binary and
public/. - Laravel Rust compiles to a binary with its migrations embedded, and reads its views from
resources/views/at runtime. Catapult delivers the binary,public/andresources/views/.
For local and container builds, your package manager builds the frontend assets once on the machine running Catapult. With remote, each server builds them in its release directory. Migrations run with ./app migrate --force in the new release, before publication: a failed migration stops the deployment while the previous release keeps serving. .env and storage/ are shared between releases.
For an application without a frontend, remove laravel:assets from the pipeline. If you manage migrations separately, remove laravel:migrate. In TypeScript, import remove from @catapultjs/deploy and call it with the task name after loading the recipe. In JSON, list the tasks to skip in the top-level remove array. Use a custom task to run migrations on a single host.
Same setting, three build locations
The recipes use the same build.location setting as Next.js and AdonisJS:
| Location | Laravel Go | Laravel Rust |
|---|---|---|
container | golang:1.27-bookworm image | rust:1.99-bookworm image |
local | Cross-compiled on your machine, no cgo | Only on a Linux machine of the server platform |
remote (default) | On the server: Go, Node.js and npm for assets | On the server: Rust, a C compiler, Node.js and npm for assets |
container is the most portable choice. Catapult reads the architecture and the glibc version of the server, builds for that platform with Docker or Podman, and keeps the module and build caches in volumes: the first Rust build compiles hundreds of crates, later ones take seconds. It also refuses a builder image whose glibc is newer than the server's, which would produce a binary that does not start.
local is where the two languages differ. Go cross-compiles a static binary with CGO_ENABLED=0, from macOS too. Rust crates with C code, such as ring or mimalloc, cannot be cross-compiled without a C toolchain for the target, so Catapult refuses a local Rust build on another platform before building anything.
Before delivery, Catapult checks that the file it built is a Linux binary of the server architecture.
A Laravel Go deployment
The recipes choose no process manager. With systemd, install your units from the project and restart them after publication:
// deploy.ts
import { after, before, defineConfig, set } from '@catapultjs/deploy'
import '@catapultjs/deploy/recipes/laravel_go'
import '@catapultjs/deploy/recipes/systemd'
set('build', { location: 'container' })
set('systemd_services', ['myapp-server', 'myapp-worker'])
set('systemd_unit_files', ['deploy/myapp-server.service', 'deploy/myapp-worker.service'])
before('deploy:publish', 'systemd:install')
after('deploy:publish', 'systemd:restart')
export default defineConfig({
hosts: [
{
name: 'production',
ssh: 'deploy@example.com',
deployPath: '/srv/myapp',
healthcheck: { url: 'http://127.0.0.1:8000/up', retries: 10 },
},
],
})# deploy/myapp-server.service
[Service]
User=deploy
WorkingDirectory=/srv/myapp/current
ExecStart=/srv/myapp/current/app
Restart=always
TimeoutStopSec=25The worker unit runs app queue:work, and the scheduler runs every minute with cron or a systemd timer. Laravel Go stops gracefully on SIGTERM, so a restart lets requests in flight finish. A rollback switches current back, and systemd:restart restarts the units on the previous binary.
For Laravel Rust, the config is the same with recipes/laravel_rust: the binary takes the name of your Cargo package, or laravel_rust_bin.
Complete examples
The repository includes two complete examples, with PostgreSQL, systemd units and deploy configs: examples/laravel-go and examples/laravel-rust.
Or as a container image
If your servers run Docker or Podman rather than systemd units, the same applications can be deployed as images with the container recipes: a multi-stage Containerfile builds the assets and the binary, and recipes/container streams the image over SSH. The Laravel Go and Rust in containers guide walks through it, and both examples include a deploy.container.ts.
Beta on both sides
Laravel Go and Laravel Rust are in beta, and so are these recipes: commands, options and defaults may change. If you deploy with them, tell us how it goes.