Quickstart cipi.yml Web panel API MCP Ecosystem Guides Docs GitHub Telegram channel
  1. Home
  2. Docs
  3. Apps
  4. Laravel Rust apps

Laravel Rust apps

Laravel for Rust, compiled on deploy and switched blue/green. Experimental.

AppsUpdated

A Laravel Rust app compiles to one binary that serves HTTP by itself. Cipi builds it on the server at every deploy, starts the new binary beside the old one and moves Nginx only once it answers: no downtime, and a rollback one command away.

Laravel for Rust is in beta, and this app type is experimental: commands and defaults may still change with the framework. Use it for new projects and staging before you rely on it.

A Laravel Rust app
$ sudo cipi app create --rust --user=blog --domain=blog.example.com --repository=git@github.com:acme/blog.git --engine=pgsql

Create one#

bash
# With a database named after the app, a queue worker and the scheduler
sudo cipi app create --rust --user=blog --domain=blog.example.com \
    --repository=git@github.com:you/blog.git

# On MariaDB or MySQL, no worker, no scheduler
sudo cipi app create --rust --user=api --domain=api.example.com \
    --repository=git@github.com:you/api.git --engine=mariadb \
    --no-queue --no-scheduler

# An API with no database of its own
sudo cipi app create --rust --user=edge --domain=edge.example.com \
    --repository=git@github.com:you/edge.git --no-db

# Inertia with server-side rendering
sudo cipi app create --rust --user=shop --domain=shop.example.com \
    --repository=git@github.com:you/shop.git --ssr
FlagMeaningDefault
--rustThe app type. Also Laravel Rust in the wizard
--repositoryGit URL over SSH. Requiredasked
--db=NAME / --no-dbThe database made with the app, or nonea database named after the app
--enginemariadb or pgsql: the databasePostgreSQL where the server has it, otherwise the server's default
--no-queueNo queue workera worker runs
--no-schedulerNo schedulerit runs every minute
--ssrInertia server-side renderingoff
--buildThe frontend buildnpm run build; npm run build:ssr with --ssr
--node-versionThe Node major of the frontend build: 22 or 24the server's default
--health-pathThe route a new release must answer on/up
--branch, --envAs for every app

The first Laravel Rust app installs the toolchain: Rust, a C compiler and the Node version of the build.

Trying Laravel's own skeleton? It has one branch, 0.x, and builds the PostgreSQL driver only. Without --branch Cipi deploys the repository's default branch, and the deploy gives the build the driver of the app's database, PostgreSQL or not: a copy of the skeleton deploys as it is.

Until the first deploy has gone through, the domain answers 502: nothing runs behind Nginx before a release has started.

The database#

A Laravel Rust app does not choose its database driver when it runs: the driver is compiled into the binary, as a Cargo feature of laravel-rust. The skeleton Laravel publishes enables PostgreSQL's alone. Cipi makes the binary and the app's database agree at every deploy: a driver the build lacks is added to the build.

The app's databaseThe feature the binary needsWith Laravel's skeleton as it is
PostgreSQLdatabase-postgresWorks: the feature is in Cargo.toml
MariaDB or MySQLdatabase-mysqlWorks: the deploy adds the feature to the build
SQLitedatabase-sqliteWorks the same way, on an app created with --no-db and a sqlite: URL in its .env

Every deploy checks it first. Before the frontend and before the build, Cipi asks cargo which drivers the binary will have. When the one DATABASE_URL asks for is among them, the build is the repository's, with nothing added. When it is not, Cipi builds with it and says so:

text
Database driver database-mysql — added to this build by Cipi (cargo build --features laravel-rust/database-mysql)

That flag does what naming the feature in Cargo.toml does. Nothing is written to your repository, nor to its Cargo.lock. It adds a driver to the build, not to your code: an app that writes SQL for one engine is not made to run on another.

In your own repository, name it anyway. Then cargo run, your tests and your CI build the driver production runs on, and a committed Cargo.lock pins its crates:

toml
# Cargo.toml — the skeleton's line, for a database on MariaDB or MySQL
laravel-rust = { version = "0.1", features = ["database-mysql", "redis", "sqs"] }

When the deploy stops instead. Cargo can add a feature only to a dependency of the package it builds. In a workspace without a root package, or when laravel-rust reaches your app through a crate of your own, the deploy stops at rust:driver — after a few seconds, before anything is compiled — and names the feature to add to Cargo.toml. Nothing changes for visitors.

Which engine a new app gets. PostgreSQL when the server has it, because that is the driver the skeleton names; otherwise the server's default, which is MariaDB unless you changed it. --engine=mariadb or --engine=pgsql chooses. A server gets PostgreSQL with one command, next to the engine it has:

bash
sudo cipi db install pgsql

The error all this prevents reads database connection postgres uses an unsupported or disabled driver, and it comes after minutes of build. postgres there is the name of the framework's default connection, whatever its URL: the message means the driver of your DATABASE_URL is not in the binary.

Move an app to PostgreSQL#

Not something the driver asks for: this is for when you want the app on PostgreSQL. For an app that was created on MariaDB and has no data to keep:

bash
sudo cipi db install pgsql                                  # once per server
sudo cipi db create --name=blog --engine=pgsql --app=blog   # shows the password, once
sudo cipi app env blog --set=DATABASE_URL=postgres://blog:PASSWORD@127.0.0.1:5432/blog
sudo cipi deploy blog

The new database is empty: nothing is copied from the old one, which stays on the server until you delete it (sudo cipi db delete blog --engine=mariadb).

Before the first deploy#

Three things about the repository are worth settling before the first deploy. The database driver is not one of them: the deploy sees to it.

In the repositoryWhy
Cargo.lock committedThe build uses --locked: every deploy compiles the versions you tested. Without the file, dependencies are resolved again each time
Trust the proxy in src/app.rsNginx is in front, on the same server. Without it request.ip() is 127.0.0.1 and generated URLs start with http://
The health routeNew apps answer on /up. If yours moved it, say where: --health-path=/healthz
rust
// src/app.rs
.with_middleware(|middleware, _| {
    middleware.trust_proxies(["127.0.0.1"]);
})

In production Laravel answers only for the host of APP_URL and its subdomains; another host gets 400 Bad Request. An app with aliases on other domains lists them with middleware.trust_hosts([…]).

Where things live#

/home/blog/
├── current -> releases/7         # the release being served
├── releases/6/ 7/                # source, public/, resources/views, bin/app
├── shared/
│   ├── .env                      # APP_KEY, APP_URL, DATABASE_URL…
│   └── storage/                  # uploads, log files, a SQLite database
├── .cache/cipi-rust/target/      # cargo's build cache, kept between deploys
└── .cargo/                       # the crates downloaded for this app

The binary is copied into each release as bin/app, next to the folders it reads while it runs (public/, resources/views/, storage/). Every release has its own, so a rollback starts the binary that release was built with.

Environment#

~/shared/.env is linked into every release, and the binary reads it when it starts.

VariableValue
APP_KEYGenerated
APP_ENV, APP_DEBUGproduction, false
APP_URLhttps:// and the app's domain. It follows sudo cipi app edit blog --domain=…, which also restarts the app
DATABASE_URLpostgres://, mariadb:// or mysql:// on 127.0.0.1, for the database made with the app
SESSION_DRIVER, CACHE_STORE, QUEUE_CONNECTIONdatabase. With --no-db: cookie, memory and sync
LOG_CHANNELstderr: the log of the slot. Add ,daily for files in storage/logs
SERVER_HOST, SERVER_PORTNot yours: Cipi sets them for each blue/green slot, whatever the file says
bash
sudo cipi app env blog          # edit
sudo cipi node restart blog     # apply: a zero-downtime restart

Deploy#

A Laravel Rust deploy, blue/green
$ sudo cipi deploy blog
Step 1 of 8Clone

The commit of the branch, with .env and storage/ linked in.

If the new release never answers, it is stopped and the old one keeps serving: the deploy fails with nothing published.

bash
sudo cipi deploy blog
sudo cipi deploy blog --rollback
sudo cipi app deploy-config blog --no-migrate
sudo cipi app deploy-config blog --keep-releases=3 --build-timeout=3600

A rollback moves the code back, not the database: Laravel Rust migrations go forward only. Add columns in one release and remove them in a later one, so the previous release still runs on the new schema.

How long a build takes#

The first deployCompiles every crate in release mode: several minutes, more on a small server
The next onesYour own code and whatever dependency changed
Time limitOne hour for each build step. sudo cipi app deploy-config blog --build-timeout=… changes it
MemoryLinking a release binary needs RAM. Under about 4 GB of RAM and swap together, add swap first: Cipi says so when it installs Rust
DiskThe build cache grows to gigabytes. sudo cipi rust clean blog removes it; the next deploy compiles from the start

Commands of the app#

The commands of a Laravel Rust app are compiled into its binary. Run them from the release being served:

bash
# As root
sudo cipi app artisan blog migrate:status
sudo cipi app artisan blog route:list

# As the app's user
sudo su - blog
laravel queue:failed
laravel key:generate --show

laravel is a shell function for the app's user: it runs ~/current/bin/app from ~/current, where the .env is.

Queue worker and scheduler#

What runsTurn it on or off
Queue workerbin/app queue:work under Supervisor, in the live releasesudo cipi app edit blog --queue=on|off
Schedulerbin/app schedule:run, every minute from the app's crontabsudo cipi app edit blog --scheduler=on|off

The worker is restarted on the new release after every deploy, once Nginx has moved. Its log is ~/logs/queue.log. sudo cipi worker is for Laravel's PHP workers and Symfony's Messenger, and refuses a Laravel Rust app.

Inertia server-side rendering#

With SSR on, a Node process beside the app renders the first page on the server. Cipi runs it for you, in the release that is serving.

bash
sudo cipi app edit blog --ssr=on      # or --ssr at create
sudo cipi deploy blog
What changes
The .envINERTIA_SSR=true
The frontend buildnpm run build:ssr, which also writes bootstrap/ssr/app.js. A build command of your own is left as it is: it has to write that file
A new programnode bootstrap/ssr/app.js under Supervisor, on the app's Node version, restarted on each new release
Its log~/logs/ssr.log

A deploy that finds no bundle says so: without it Laravel renders every page in the browser, with no error.

One app per server. Laravel Rust reaches the SSR process on 127.0.0.1:13714 and has no setting for another port. A second app asking for SSR is refused, with the name of the one that has it.

Reverb#

Laravel Rust has a Reverb WebSocket server in its binary. Cipi can run it beside the app, with the same command a Laravel app uses:

bash
sudo cipi app reverb enable blog
sudo cipi deploy blog
sudo cipi app reverb status blog
sudo cipi app reverb disable blog
What enable does
Cargo.tomlNothing: add the reverb feature of laravel-rust yourself, and commit
The .envBROADCAST_CONNECTION=reverb, REVERB_APP_ID, REVERB_APP_KEY, REVERB_APP_SECRET, the public host, port and scheme. They follow the certificate and the domain
A new programbin/app reverb:start on a localhost port, started by the next deploy
Nginx/app and /apps of the app's domain go to it, WebSocket upgrades included
Its log~/logs/reverb.log

Laravel documents this server as one for local development: a single process, with connections and channels kept in memory. On one server with a moderate number of clients it does the job. Every deploy and every restart drops the open connections; Laravel Echo reconnects. For more than that, point REVERB_* in the .env at another Reverb server.

Status, restart, logs#

bash
sudo cipi node status blog      # the two slots, the worker, SSR, Reverb
sudo cipi node restart blog     # zero-downtime restart
sudo cipi node logs blog        # what the server wrote to stderr

A Laravel Rust app shares the blue/green machinery of Node server apps, which is why these commands start with node.

The toolchain#

One stable Rust for the server, in /opt/cipi/rust, installed by rustup (Rust's official installer, checked against its published checksum). Apps build with it as their own user; none can change it.

bash
sudo cipi rust status           # version, pinned toolchains, the apps
sudo cipi rust update           # the latest stable
sudo cipi rust clean blog       # remove one app's build cache
sudo cipi rust prune            # remove pinned toolchains no app uses
sudo cipi rust remove           # only when no app uses it

After an update the apps keep running the binary they have. Each is rebuilt, from the start, by its next deploy.

A toolchain of the app's own#

A rust-toolchain.toml in the repository is followed. The deploy reads its channel, installs that toolchain beside the server's stable the first time, and builds the app with it.

toml
# rust-toolchain.toml
[toolchain]
channel = "1.99.0"
Channelsstable, beta, nightly, a version (1.99 or 1.99.0), a dated nightly (nightly-2026-11-30)
Anything elseThe deploy stops and says which channels it takes
components, targets, pathNot used: a toolchain is installed with rustc, cargo and the standard library
How manySix beside stable. sudo cipi rust prune removes the ones no app builds with any more
No fileThe server's stable

Limits#

Inertia SSROne app per server
ReverbThe binary's own server, which Laravel calls a development one
rust-toolchain.tomlThe channel is followed; components and targets are not installed
Server syncLaravel Rust apps are moved like the others. On the new server Reverb is turned on again by hand, and the first deploy compiles every crate

Common problems#

ProblemFix
The deploy ends at not a valid object name: mainThe repository has no main: Laravel's skeleton has 0.x alone. sudo cipi app edit blog --branch=0.x, then deploy. An app created without --branch takes the repository's default by itself
502 Bad Gateway right after creating the appNo release yet: the first successful deploy starts the app. After that, sudo cipi node status blog shows the two slots
The deploy stops at rust:driverThe app's database has no driver 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 the connection, not the engine. A deploy adds the driver by itself; this is a server that has not been updated (sudo cipi self-update) or a deploy.php edited by hand. See the database
Permission denied (publickey) while cloningThe repository does not have the app's deploy key: sudo cipi deploy blog --key shows it, to add as a read-only deploy key. A public repository needs none when given by its https:// address: sudo cipi app edit blog --repository=https://github.com/you/blog.git
400 Bad Request on an aliasLaravel answers for APP_URL's host only: list the others with trust_hosts
URLs start with http://trust_proxies(["127.0.0.1"]) is missing
The build is killed after minutesThe server ran out of memory while linking. Add swap, or build with fewer jobs: jobs = 1 under [build] in ~/.cargo/config.toml of the app's user
requires rustc 1.xx or newersudo cipi rust update, then deploy. With a rust-toolchain.toml, raise its channel
Pages are not rendered on the serverSSR needs --ssr=on, a build that writes bootstrap/ssr/app.js, and no other app holding port 13714: sudo cipi node status blog shows the ssr program
The Reverb program does not stay upThe reverb feature is missing in Cargo.toml: ~/logs/reverb.log says the command is unknown
Cargo.toml builds several binariesSet default-run in Cargo.toml, or sudo cipi app edit blog --rust-bin=<name>
The deploy times out during the first buildsudo cipi app deploy-config blog --build-timeout=3600, and deploy again: what was compiled is kept

Questions#

QuestionAnswer
Do I need PHP for a Rust app?Not for the app. Cipi's deploy tool and the webhook receiver run on PHP, so the server keeps it.
Can it share a server with PHP apps?Yes: it is one more isolated app, with its own Linux user and its own two ports on localhost.
Can I build elsewhere and upload the binary?Not with this type: the build is part of the deploy.
Where are the static files served from?By the app itself, from public/ of the release. Nginx proxies every request to it.
SQLite?Yes: DATABASE_URL=sqlite://storage/app/database.sqlite?mode=rwc keeps it in shared/storage, with the database-sqlite feature. Create the app with --no-db.
Step by step?Deploy Laravel Rust on your own VPS.