# Deploy Laravel Rust on your own VPS with zero downtime

> Run Laravel for Rust on an Ubuntu VPS with Cipi — the Rust toolchain, cargo build on every deploy, blue/green releases behind Nginx, migrations, a queue worker, the scheduler, Inertia SSR, Reverb, HTTPS and rollback.

URL: https://cipi.sh/guides/deploy-laravel-rust · Last updated: 2026-12-01 · By Andrea Pollastri · 7 min read · Category: Laravel

Laravel for Rust compiles your application to a single binary that serves HTTP by itself: no PHP-FPM, no Octane. On a VPS that leaves three jobs for whoever runs it — build the binary, keep it running behind a web server, and replace it without dropping requests.

Cipi does the three. This guide takes a Laravel Rust app from repository to production on an Ubuntu VPS.

> [!WARNING]
> Laravel for Rust is in beta and Cipi's support for it is **experimental**. Everything below works the way the framework's own deployment guide describes it; expect details to move with the framework.

## What you need

| | |
| --- | --- |
| A server | Ubuntu 24.04 or 26.04 with [Cipi installed](https://cipi.sh/docs/installation). For compiling, 4 GB of RAM or 2 GB plus swap |
| A repository | Your Laravel Rust app, on GitHub, GitLab or any Git host, reachable over SSH |
| A domain | An `A` record you can point at the server |

## 1. Get the repository ready

One decision and three small things in your code. Settle them before the first deploy and it works the first time.

**Where the data lives.** In Laravel Rust the database driver is compiled into the binary: it is a Cargo feature of `laravel-rust`, and the skeleton Laravel publishes enables PostgreSQL's alone. Cipi gives the build the driver of the app's database when `Cargo.toml` does not name it, so both engines work with the repository as it is.

| You want | On the server | In `Cargo.toml` |
| --- | --- | --- |
| **PostgreSQL**, the skeleton's own choice | `sudo cipi db install pgsql`, once | Nothing: `database-postgres` is there |
| **MariaDB or MySQL**, what a Cipi server has from the start | Nothing | Nothing needed: the deploy adds `database-mysql` to the build. Name it to have it in your own builds too |

```toml
# Cargo.toml, optional: MariaDB or MySQL in cargo run, your tests and CI as well
laravel-rust = { version = "0.1", features = ["database-mysql", "redis", "sqs"] }
```

This guide takes PostgreSQL. What the deploy does about the driver is in [step 3](https://cipi.sh/guides/deploy-laravel-rust#3-the-first-deploy).

**Commit `Cargo.lock`.** The deploy builds with `--locked`, so production compiles exactly the versions you tested.

**Trust the proxy.** Nginx sits in front of your app on the same server. Tell Laravel, so generated URLs are `https://` and `request.ip()` is the visitor's:

```rust
// src/app.rs
.with_middleware(|middleware, _| {
    middleware.trust_proxies(["127.0.0.1"]);
    // …your existing middleware
})
```

**Keep the health route.** New apps answer on `/up`. Cipi asks that route before it sends traffic to a new release.

## 2. Create the app

```bash
$ sudo cipi app create --rust --user=blog --domain=blog.example.com \
    --repository=git@github.com:acme/blog.git --engine=pgsql
```

A Laravel Rust app:

```console
$ sudo cipi app create --rust --user=blog --domain=blog.example.com --repository=git@github.com:acme/blog.git --engine=pgsql
✓ Build tools
→ Downloading rustup (x86_64-unknown-linux-gnu)...
→ Installing Rust (stable, minimal profile) in /opt/cipi/rust...
✓ Rust 1.99.0
→ Creating 'blog' (laravel-rust)...
✓ User   ✓ Directories   ✓ Deploy key
✓ Database blog (PostgreSQL)
✓ .env with DATABASE_URL (database-postgres)
✓ PHP-FPM 8.5 (webhook only)   ✓ Nginx → blog.example.com
✓ Blue/green slots on 127.0.0.1:3100, 3101 + queue worker — started by the first deploy
✓ Scheduler + deploy trigger   ✓ Deployer   ✓ Permissions

  Runtime:    Laravel Rust — Rust 1.99.0, blue/green on 127.0.0.1:3100, 3101
  Frontend:   npm run build  (Node 24; skipped without a package.json)
  Health:     /up     Queue: queue:work   Scheduler: schedule:run every minute
  Next: cipi deploy blog  (the first build compiles every crate: several minutes)
```

No `--branch` here: Cipi deploys `main` when the repository has it, and otherwise the repository's default branch. A copy of Laravel's skeleton has `0.x` alone, and that is what gets deployed.

The first Laravel Rust app on a server installs the toolchain: stable Rust through rustup, a C compiler, and the Node version for the frontend build. Then the app itself:

| | |
| --- | --- |
| A Linux user | `blog`, isolated from every other app |
| A database | Named `blog`, with its URL already in the `.env`. PostgreSQL here; without the flag it is PostgreSQL too where the server has it, and the server's MariaDB or MySQL where it has not. `--engine=mariadb` to choose that, `--no-db` for none |
| `~/shared/.env` | `APP_KEY`, `APP_ENV=production`, `APP_URL`, `DATABASE_URL`, database-backed sessions, cache and queue |
| Two slots | Ports on localhost for blue/green deploys |
| A queue worker and the scheduler | On by default; `--no-queue`, `--no-scheduler` to leave them out |

Save the summary: it is shown once. It also tells you which Cargo feature your server's database needs. Add the deploy key to the repository as a read-only key, or let Cipi do it with a [provider token](https://cipi.sh/docs/git).

## 3. The first deploy

```bash
$ sudo cipi deploy blog
```

A Laravel Rust deploy, blue/green:

```console
$ sudo cipi deploy blog
task deploy:prepare
task rust:driver      database-postgres
task rust:assets      npm ci, npm run build
task rust:build       cargo build --release --locked
   Compiling blog v0.1.0 (/home/blog/releases/7)
    Finished `release` profile [optimized] target(s) in 48.20s
bin/app ← blog
task rust:migrate     bin/app migrate --force
task rust:switch
[cipi-node] starting release 7 on green (127.0.0.1:3101)
[cipi-node] healthy on green (HTTP 200 on /up)
[cipi-node] nginx now proxies to green
[cipi-node] stopped blue
[cipi-node] queue worker on release 7
task deploy:symlink   current → releases/7
✓ Deploy completed  (release 7, 1m52s)
```

1. **Check** — the database driver
   A few seconds: cargo is asked which drivers the build will have. If your database's is missing, Cipi adds it to the build.
2. **Frontend** — npm ci, npm run build
   Skipped when the repository has no `package.json`.
3. **Build** — cargo build --release
   Every crate, the first time. The build cache stays on the server for the next deploy.
4. **Migrate** — migrate --force
   Your migrations are compiled into the binary and run before any traffic reaches it.
5. **Start** — the idle slot
   The new binary starts on its own port, next to nothing (the first time) or next to the live release.
6. **Health** — /up
   It must answer. If it does not, the deploy fails and nothing changes for visitors.
7. **Switch** — Nginx
   One reload. The old process finishes the requests it has, then stops.

The first build takes several minutes: get a coffee. Later deploys compile only what changed.

> [!NOTE]
> **`Database driver database-mysql — added to this build by Cipi`?** The app's database is on an engine `Cargo.toml` names no driver for: typically Laravel's skeleton, which has PostgreSQL only, on an app created with MariaDB. The deploy built with the driver anyway, and left the repository as it is. [The database](https://cipi.sh/docs/laravel-rust#database) has the rest, and the one case where the deploy stops instead.

## 4. HTTPS

Point the domain's `A` record at the server, then:

```bash
$ sudo cipi ssl install blog
```

`APP_URL` was written with `https://` from the start.

## 5. Push to deploy

The create summary has a webhook URL and a secret. Add them to the repository (GitHub: *Settings → Webhooks*, content type JSON) and every push to the branch deploys. With a provider token saved, the webhook is already registered.

## 6. Day to day

```bash
# Commands of your app, from the live release
$ sudo cipi app artisan blog migrate:status
$ sudo cipi app artisan blog route:list

# The same as the app's user
$ sudo su - blog
$ laravel queue:failed

# Environment: edit, then restart with no downtime
$ sudo cipi app env blog
$ sudo cipi node restart blog

# What is running, and what it says
$ sudo cipi node status blog
$ sudo cipi node logs blog
```

Logs go to standard error, which Cipi keeps per slot. For files in `storage/logs` as well, set `LOG_CHANNEL=stderr,daily`.

## 7. Queue and scheduler

Both were set up at creation:

| | |
| --- | --- |
| Queue worker | `queue:work` under Supervisor, restarted on each new release. Log: `~/logs/queue.log` |
| Scheduler | `schedule:run` every minute, from the app's crontab |

```bash
$ sudo cipi app edit blog --queue=off
$ sudo cipi app edit blog --scheduler=on
```

## 8. Inertia SSR, Reverb, a pinned Rust

Three things you may want next. Each is one command, or one file.

**Server-side rendering with Inertia.** A Node process beside the app renders the first page:

```bash
$ sudo cipi app edit blog --ssr=on
$ sudo cipi deploy blog
```

Cipi sets `INERTIA_SSR=true`, builds with `npm run build:ssr` and runs `node bootstrap/ssr/app.js` of the live release under Supervisor. One app per server can have it: Laravel Rust reaches that process on port 13714, and nothing lets an app pick another.

**Reverb.** The binary has a WebSocket server of its own. Add the `reverb` feature to `laravel-rust` in `Cargo.toml`, then:

```bash
$ sudo cipi app reverb enable blog
$ sudo cipi deploy blog
```

Cipi writes the `REVERB_*` variables, runs `reverb:start` beside the app and sends `/app` and `/apps` of your domain to it.

> [!WARNING]
> Laravel documents this server as one for local development: a single process, with connections kept in memory. It is fine on one server with a moderate number of clients, and every deploy drops the open connections (Echo reconnects). For more, point `REVERB_*` at another Reverb server.

**A Rust version of your own.** Commit a `rust-toolchain.toml`:

```toml
[toolchain]
channel = "1.99.0"
```

The next deploy installs that toolchain beside the server's stable and builds with it. `sudo cipi rust status` shows which app builds with which.

## 9. Roll back

```bash
$ sudo cipi deploy blog --rollback
```

Every release keeps its own binary, so going back does not rebuild anything: the previous one starts on the idle slot, answers on `/up`, and takes the traffic.

> [!WARNING]
> The database does not go back. Laravel Rust migrations move forward only: add a column in one release and drop the old one in a later release, so the release before still works. The same pattern as [zero-downtime migrations](https://cipi.sh/guides/laravel-zero-downtime-migrations).

## 10. Keep the server healthy

- **Rust updates.** `sudo cipi rust update` moves to the latest stable. Apps keep running; each is rebuilt by its next deploy.
- **Disk.** The build cache grows. `sudo cipi rust clean blog` removes it; the next deploy compiles from the start. `sudo cipi rust prune` removes pinned toolchains no app uses.
- **A new server.** [`sudo cipi sync`](https://cipi.sh/docs/sync) moves the app with its database and `storage/`; the first deploy there compiles it.
- **Backups.** `~/shared` (the `.env`, `storage/`) and the database: `sudo cipi backup profile add blog-nightly --scope=all --cron='0 2 * * *' --keep-days=14 --dest=s3 --encrypt`.
- **Uptime.** `sudo cipi health set blog --url=https://blog.example.com/up --expect=200`.

## Troubleshooting

| Problem | Fix |
| --- | --- |
| The deploy ends at *not a valid object name: main* | The app is on a branch the repository does not have: `sudo cipi app edit blog --branch=0.x` (the deploy names the branches it found), then deploy again |
| `502 Bad Gateway` before the first deploy | Expected: no release is running yet. It goes with the first deploy that succeeds |
| The deploy stops at `rust:driver` | The driver of the app's database is not in the binary, and Cipi [could not add it to the build](https://cipi.sh/docs/laravel-rust#database): the message says why. Add the feature it names to `Cargo.toml`, or [move the app to PostgreSQL](https://cipi.sh/docs/laravel-rust#database-move). On a server that has not been updated, every missing driver stops there: `sudo cipi self-update`, then deploy again |
| *database connection `postgres` uses an unsupported or disabled driver* | A binary built without the driver of `DATABASE_URL`. `postgres` is the name of Laravel's default connection, not the engine. A deploy adds the driver by itself: update the server (`sudo cipi self-update`) and deploy again |
| `Permission denied (publickey)` while cloning | The repository does not have the app's deploy key: `sudo cipi deploy blog --key` shows it. A public repository needs none when given by its `https://` address |
| The build is killed after a few minutes | Out of memory while linking. Add swap (2–4 GB), or set `jobs = 1` under `[build]` in `~/.cargo/config.toml` of the app's user |
| *package requires rustc 1.xx or newer* | `sudo cipi rust update`, then deploy again. With a `rust-toolchain.toml`, raise its `channel` |
| The deploy times out on the first build | `sudo cipi app deploy-config blog --build-timeout=3600` and deploy again: what was compiled is kept |
| `400 Bad Request` on a second domain | In production Laravel answers for the host of `APP_URL` and its subdomains. List the others with `middleware.trust_hosts([…])` |
| Links are generated with `http://` | `trust_proxies(["127.0.0.1"])` is missing (step 1) |
| *Cargo.toml builds several binaries* | Set `default-run` in `Cargo.toml`, or `sudo cipi app edit blog --rust-bin=<name>` |

## Limits to know

| | |
| --- | --- |
| Inertia SSR | One app per server |
| Reverb | The binary's own server: one process, state in memory |
| `rust-toolchain.toml` | The channel is followed; `components` and `targets` are not installed |

The reference page keeps the list current: [Laravel Rust apps](https://cipi.sh/docs/laravel-rust#limits).

## Reference docs

- [Laravel Rust apps](https://cipi.sh/docs/laravel-rust)
- [Create an app](https://cipi.sh/docs/create-app)
- [Node apps](https://cipi.sh/docs/node-apps)
- [Databases](https://cipi.sh/docs/databases)

## Questions

### Is Laravel Rust ready for production?

Laravel for Rust is in beta, and Cipi's app type for it is experimental. It is a good fit for new projects, internal tools and staging; follow the framework's releases before you move something critical.

### Do I have to compile on the server?

Yes, with this app type: the build is a step of the deploy, so the server needs the Rust toolchain (Cipi installs it) and enough memory to link a release binary.

### How long does a deploy take?

The first one compiles every crate — several minutes, more on a small server. After that the build cache is reused and only your code and changed dependencies are compiled.

### Is there downtime during a deploy?

No. The new binary starts on a second port, must answer on `/up`, and only then does Nginx move to it. If it never answers, the old release keeps serving and the deploy fails.

### Can I use MySQL or MariaDB?

Yes. Create the app with `--engine=mariadb`: Cipi writes a `mariadb://` or `mysql://` URL to match the server's engine, and the deploy adds the `database-mysql` feature of `laravel-rust` to the build when `Cargo.toml` does not name it. Laravel's skeleton names the PostgreSQL driver only, and deploys on either engine as it is.

### Does the queue worker restart on deploy?

Yes. A worker runs the code it was compiled with, so Cipi restarts it on the new release right after Nginx has moved.

### Can I use Inertia server-side rendering?

Yes: `--ssr` at create, or `sudo cipi app edit blog --ssr=on`. Cipi builds the SSR bundle and runs the Node process beside the app. One app per server can have it, because Laravel Rust reaches that process on a fixed port.

### Can I pin the Rust version?

Yes. Commit a `rust-toolchain.toml` with the channel: Cipi installs that toolchain beside the server's stable and builds your app with it.

### How is this different from Laravel Cloud?

Cloud is managed and scales for you. This is your own server: one binary behind Nginx, a database next to it, a fixed monthly price, and everything under your control.

---

Index of every page: https://cipi.sh/llms.txt · Everything in one file: https://cipi.sh/llms-full.txt · Source: https://github.com/cipi-sh/cipi (MIT)
