Quickstart cipi.yml Web panel API MCP Ecosystem Guides Docs GitHub Telegram channel
  1. Home
  2. Guides
  3. Deploy Laravel Rust on your own VPS with zero downtime
Laravel

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.

By Updated 7 min read

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.

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 serverUbuntu 24.04 or 26.04 with Cipi installed. For compiling, 4 GB of RAM or 2 GB plus swap
A repositoryYour Laravel Rust app, on GitHub, GitLab or any Git host, reachable over SSH
A domainAn 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 wantOn the serverIn Cargo.toml
PostgreSQL, the skeleton's own choicesudo cipi db install pgsql, onceNothing: database-postgres is there
MariaDB or MySQL, what a Cipi server has from the startNothingNothing 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.

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
$ sudo cipi app create --rust --user=blog --domain=blog.example.com --repository=git@github.com:acme/blog.git --engine=pgsql

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 userblog, isolated from every other app
A databaseNamed 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/.envAPP_KEY, APP_ENV=production, APP_URL, DATABASE_URL, database-backed sessions, cache and queue
Two slotsPorts on localhost for blue/green deploys
A queue worker and the schedulerOn 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.

3. The first deploy#

bash
sudo cipi deploy blog
A Laravel Rust deploy, blue/green
$ sudo cipi deploy blog
Step 1 of 7Check

A few seconds: cargo is asked which drivers the build will have. If your database's is missing, Cipi adds it to the build.

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

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 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 workerqueue:work under Supervisor, restarted on each new release. Log: ~/logs/queue.log
Schedulerschedule: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.

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.

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.

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 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#

ProblemFix
The deploy ends at not a valid object name: mainThe 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 deployExpected: no release is running yet. It goes with the first deploy that succeeds
The deploy stops at rust:driverThe driver of the app's database is not in the binary, and Cipi could not add it to the build: the message says why. Add the feature it names to Cargo.toml, or move the app to PostgreSQL. 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 driverA 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 cloningThe 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 minutesOut 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 newersudo cipi rust update, then deploy again. With a rust-toolchain.toml, raise its channel
The deploy times out on the first buildsudo cipi app deploy-config blog --build-timeout=3600 and deploy again: what was compiled is kept
400 Bad Request on a second domainIn 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 binariesSet default-run in Cargo.toml, or sudo cipi app edit blog --rust-bin=<name>

Limits to know#

Inertia SSROne app per server
ReverbThe binary's own server: one process, state in memory
rust-toolchain.tomlThe channel is followed; components and targets are not installed

The reference page keeps the list current: Laravel Rust apps.

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.

Try it on your own server

Free and open source. One command on a fresh Ubuntu 24.04 or 26.04 VPS.

wget -O - https://cipi.sh/setup.sh | bash
Read the quickstart