For six days we moved Laravel's mechanisms over to Rust: routes, the session, the queue, migrations, seeders. Day seven is about the things a migration can't live without: how to keep up with a framework that ships a new version every day, and how to know what's actually happening on the server. Spoiler: at one point we got it wrong, and that's the best part of the day.
In short
- The upgrade: Laravel Rust 0.1.5 → 0.1.6. We read not just
UPGRADE.mdbut the source diff too. In it we find a fix to howX-Forwarded-Foris parsed — one we'd had since day one. - The mystery:
worker.logholds only startup lines, not a single job. We decided jobs weren't reaching the queue. The server proved us wrong: they were, there just weren't many of them. - The takeaway: a quiet fallback of "if the queue isn't configured, write right away" looks exactly like an empty queue in the log. Now every process says at startup where its jobs go.
- In production: both services wrote
Rust jobs: queued on Redis….
A beta that ships every day
Laravel Rust came out on December 1. By the evening of December 3 crates.io already had seven versions: 0.1.0 through 0.1.6. From day one we've pinned exact versions:
laravel_core = { package = "laravel-rust-core", version = "=0.1.6", default-features = false }
laravel_http = { package = "laravel-rust-http", version = "=0.1.6", default-features = false }
The = sign means no "compatible" upgrades, only the version we've checked. In PHP terms it's "laravel/framework": "13.45.0" instead of "^13.0". For a stable framework that's overcautious; for a beta it's basic hygiene.
Upgrading is a deliberate step. The UPGRADE.md for 0.1.6 is short: patch releases need no changes to the app. But "no changes needed" doesn't mean "nothing changed". So we look at the sources themselves: Cargo keeps every crate version side by side in ~/.cargo/registry, and you can simply compare them.
cargo update -p laravel-rust
for c in queue console core database http; do
diff -rq ~/.cargo/registry/src/*/laravel-rust-$c-0.1.5/src ~/.cargo/registry/src/*/laravel-rust-$c-0.1.6/src
done
The queue and the console are untouched. What changed: the database crate (docs and relations), the HTTP request and one file we care about a lot: middleware/proxies.rs.
A fix we already had
DevSense sits behind Cloudflare and nginx, so the visitor's real address arrives in the X-Forwarded-For header. It's a chain: the client's address, then every proxy that passed the request along. The important detail: the first address in the chain is written by the client itself. Anyone can fake it.
In 0.1.5, setting TRUSTED_PROXIES=* ("trust everyone") made the framework skip the whole chain and take exactly that first address. 0.1.6 fixes it: with *, only the proxy that actually connected is trusted. Here's the framework's changed test — it says it better than any description:
- #[case::any_proxy_reports_the_furthest(&["*"], "10.0.0.1", "198.51.100.9, 203.0.113.7", "198.51.100.9")]
+ #[case::any_proxy_trusts_only_the_caller(&["*"], "10.0.0.1", "198.51.100.9, 203.0.113.7", "203.0.113.7")]
It used to be 198.51.100.9 — an address anyone could have written in. Now it's 203.0.113.7 — the address our proxy passed on.
The bug never hit us, because back on Day 1 we banned * on our side:
/// nginx on this machine, plus `TRUSTED_PROXIES` as the PHP app reads it (comma-separated
/// addresses or networks, such as Cloudflare's), so `request.ip()` is the same visitor address
/// PHP sees. `*` is not accepted here: it would take the first, client-chosen address.
fn trusted_proxies() -> Vec<String> {
let mut proxies = vec!["127.0.0.1".to_owned(), "::1".to_owned()];
if let Ok(list) = std::env::var("TRUSTED_PROXIES") {
proxies.extend(
list.split(',')
.map(str::trim)
.filter(|p| !p.is_empty() && *p != "*")
.map(str::to_owned),
);
}
proxies
}
It's nice when upstream reaches the same conclusion. But the real moral is different: in a beta, read the diff. Our rate limits and view counter depend on the visitor's address. A line about this might never have made it into the changelog.
Two more changes:
- the request body is now read through a bounded stream (
http_body_util::Limited): the size limit is checked as the body is read; - the
multerdependency moved up to4.0.0-rc.1— a release candidate. The framework itself needs it for file uploads. Our routes don't accept multipart and the crate has no known vulnerabilities, but it's worth remembering.
And a small thing we only noticed now. Our Cargo.toml said rust-version = "1.90", while Laravel Rust requires 1.99. Cargo dutifully printed "resolving to Rust 1.90 compatible versions", which was misleading. We set it to the real minimum:
# Laravel Rust 0.1.x requires Rust 1.99; say so here, so cargo resolves against the real minimum.
rust-version = "1.99"
The mystery of the empty log
On Day 4 we got a queue worker in Rust. It records the use of personal tokens: the Zones hook queues a tokens.touch job and the worker updates last_used_at. In production everything worked: the date in the dashboard kept updating.
But worker.log under supervisor contained only this:
Processing jobs from `redis:rust`. Press Ctrl+C to stop.
Processing jobs from `redis:rust`. Press Ctrl+C to stop.
Processing jobs from `redis:rust`. Press Ctrl+C to stop.
Not a single processed job. The Laravel PHP worker writes a line for each one. Where are they in Rust?
We went into the laravel-rust-queue sources. The worker does write a line per job — here it is:
/// One line per attempt: the job's name, how it ended, and how long it ran, with the error below.
fn report(processed: &Processed, console: &mut Console) {
// Failures are reported to the logs, so `--quiet` hides every job line.
if console.is_quiet() {
return;
}
And the Laravel Rust console writes status messages like these to stderr, not stdout: that way a command's output can be piped, while the statuses stay on screen. Let's check our supervisor config:
stdout_logfile=/var/www/devsense/rust/storage/logs/worker.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=3
redirect_stderr=true
redirect_stderr=true — stderr goes into worker.log too. So the job lines should be there. Since they aren't, there were no jobs. And yet the date in the dashboard kept updating…
This is where we built our first theory. On Day 4 we'd added a safety net: if the queue isn't configured (.env lacks QUEUE_CONNECTION=redis or DB_QUEUE_FAILED_TABLE=rust_failed_jobs), the service writes to the database right away, as before:
if jobs::ready() {
let job = TouchToken {
token_id: token.id,
ip: ip.to_owned(),
};
match job.dispatch().await {
Ok(_) => return Ok(()),
Err(error) => tracing::warn!(%error, "queueing TouchToken failed; writing inline"),
}
}
TouchToken::write(token.id, ip).await
If the server's .env is missing a line, everything looks exactly like this: the date updates, the worker stays quiet. A beautiful theory.
The server says "no"
We tested the theory on the server:
grep -E '^(QUEUE_CONNECTION|DB_QUEUE_FAILED_TABLE|REDIS_DB|REDIS_URL)=' /var/www/devsense/rust/.env
tail -n 20 /var/www/devsense/rust/storage/logs/worker.log
Everything was in place in .env. And in the log, between the startup lines, there was exactly one:
tokens.touch 18.2ms
The queue had been working since day one. There were few jobs for two reasons. Only the Zones hook queues the job, which means only our own commits. And no more than once every five minutes per token — just like in PHP. As for the "Processing jobs" lines, those are worker restarts on every deploy: there were more of them in a day than jobs.
Our first theory was wrong. But the question was still the right one: from the log you couldn't tell "no jobs" from "jobs aren't being queued". A safety net that silently bypasses the queue is a good idea for the user and a bad one for whoever is on call.
Let the service say it itself
Laravel Rust loads .env right before booting the app, and it has a booted hook — the equivalent of boot() in a PHP service provider. It runs once in every process: in the HTTP server, in the worker, in any console command.
// Day 7: one line at boot (server, worker, every command) saying where Rust's jobs go.
// `.env` is loaded right before booting, so this sees the same values the handlers do.
.booted(async |_app| {
crate::jobs::log_mode();
Ok(())
})
The line itself is built by a pure function — easy to test:
/// Whether jobs are queued, and the log line that says so. Only the two switches are named, never
/// other settings (`REDIS_URL` may carry a password).
pub fn mode(connection: Option<&str>, failed_table: Option<&str>) -> (bool, String) {
if is_ready(connection, failed_table) {
return (
true,
format!("Rust jobs: queued on Redis, queue `{QUEUE}`, failed ones in `{FAILED_TABLE}`"),
);
}
let shown = |value: Option<&str>| match value.map(str::trim) {
None | Some("") => "unset".to_owned(),
Some(value) => format!("`{}`", value.chars().take(40).collect::<String>()),
};
(
false,
format!(
"Rust jobs run inline, not queued: QUEUE_CONNECTION is {} (needs `redis`), \
DB_QUEUE_FAILED_TABLE is {} (needs `{FAILED_TABLE}`)",
shown(connection),
shown(failed_table),
),
)
}
Two details. If the queue is configured, it's info; if not, it's warn: that's the kind of thing that should jump out at you. And only the two switches make it into the log. We never print REDIS_URL: it may contain a password.
In PHP Laravel we'd have done the same with Log::info() in AppServiceProvider::boot(). The difference is that here the compiler and a test make sure the line never drifts from the real is_ready check.
Verification
Locally:
INFO app::jobs: Rust jobs: queued on Redis, queue `rust`, failed ones in `rust_failed_jobs`
In production after the deploy:
grep -a "Rust jobs" /var/www/devsense/rust/storage/logs/supervisor.log /var/www/devsense/rust/storage/logs/worker.log | tail -n 4
supervisor.log: INFO app::jobs: Rust jobs: queued on Redis, queue `rust`, failed ones in `rust_failed_jobs`
worker.log: INFO app::jobs: Rust jobs: queued on Redis, queue `rust`, failed ones in `rust_failed_jobs`
The HTTP server and the worker see the same setting. If a line in .env ever goes missing, the first thing in the log will be a warning, not silence.
What we took away from day seven
- In a beta, the diff matters more than the changelog. Five minutes of comparing sources, and we know what changed in address parsing instead of hoping.
- Every fallback should be audible. Quietly working around the problem is good for the user. But it absolutely has to be said in the log.
- Test a theory on the server before fixing it. One
grepsaved us from repairing something that wasn't broken.
What comes next
Next up is what every visitor sees: HTML. Markdown and templates are moving to Rust. We'll render Markdown with comrak, and Blade will be replaced by MiniJinja, which is built into Laravel Rust. We'll start with the safest step: compare the article HTML built in Rust byte for byte with what PHP serves today.
Links
- Upgrading Laravel Rust — installation and versions
- Logging in Laravel Rust —
LOG_CHANNEL,LOG_LEVEL, stderr - The application lifecycle — when
bootedfires - Supervisor: program settings —
redirect_stderrandstdout_logfile - From Laravel to Laravel Rust. Day 4 — the first queue and the first worker
- From Laravel to Laravel Rust. Day 1 — trusted proxies and the first route
- Web in Rust in 2026 — Axum, Actix Web, Loco, Rocket and Laravel Rust