Deploy safely
A production deployment has two artifacts: the application binary and its reviewed migration directory. Build the binary with only the database feature it needs, provide the database URL through secrets management, and run migrations as an explicit release step.
Release sequence
rent migrate validate
rent migrate preflight
rent migrate apply
rent migrate drift --checkvalidate checks files and checksums without a connection. preflight inspects the destination and classifies the
pending operations. apply records each successful version in Rent's migration journal. drift --check proves the
live catalog matches the RSL schema and exits unsuccessfully when it does not.
Run these commands once per environment, outside a horizontally scaled application startup path. Take a database backup before destructive migrations and require review for every destructive plan.
TLS
Rent uses SQLx's Rustls runtime. Put the TLS policy in the connection URL accepted by your database provider. For example, hosted PostgreSQL commonly requires:
postgres://app:secret@host.example/application?sslmode=requireUse the provider's CA and stricter verification mode when its connection guide supplies them. Do not disable
certificate verification in production. rent doctor provides a fast deployment-time connection check using the
same URL.
Pool sizing
use std::time::Duration;
use rent::driver::{DatabasePool, PoolOptions};
use rent::sql::Dialect;
let pool = DatabasePool::connect_with(
Dialect::Postgres,
&database_url,
PoolOptions {
max_connections: 24,
min_connections: 4,
acquire_timeout: Duration::from_secs(3),
idle_timeout: Some(Duration::from_secs(600)),
max_lifetime: Some(Duration::from_secs(1_800)),
test_before_acquire: true,
},
)
.await?;Budget connections across every replica; do not assign the server's entire limit to each process. Start small, observe acquisition wait time and database saturation, then raise the limit only when evidence supports it.
Logs and shutdown
Install a tracing subscriber before connecting. Rent spans record operation metadata but not bound values.
Dropping all clients and the pool closes idle connections; stop accepting work and await in-flight requests before
process exit.
Use runtime and observability for pool and retry details, and troubleshooting for common production failures.