Replicas & Scaling
Run multiple instances of your application with automatic scaling, resource limits, and capacity planning.
Replicas & Scaling
OneLift provides a complete scaling suite: manual scaling, automatic scaling, resource limits, and capacity monitoring.
Manual Scaling
Set the replicas field in .lift.json or use the CLI:
{
"replicas": 3
}
# Scale to 3 replicas
lift scale 3
# Check capacity before scaling
lift capacity
Containers are named <app>-1, <app>-2, <app>-3 and load-balanced by Traefik.
Load Balancing & Sticky Sessions
Traefik distributes traffic across replicas using round-robin. Each new visitor (without a session cookie) may land on a different replica.
Once a visitor connects, a sticky session cookie (onelift_instance) is set. All subsequent requests from the same browser go to the same replica. This prevents session loss for stateful applications like n8n, Strapi, or any app that stores sessions in memory.
- Same user (same browser/cookie) → always hits the same replica
- Different users → distributed across replicas
- New incognito window → may hit a different replica
Autoheal (Automatic Recovery)
OneLift runs a server-level autoheal container that monitors Docker healthchecks and automatically restarts unhealthy containers across all tools.
- Runs every 30 seconds
- Restarts containers that fail their Docker healthcheck
- Container restarts are logged to the Activity page
- Managed automatically — no user configuration needed
Check autoheal status with:
lift self-status
Automatic Scaling
Configure CPU-based autoscaling with predefined profiles:
# Use a profile
lift autoscale strapi --profile balanced --min 1 --max 5
# Custom CPU target
lift autoscale strapi --cpu-target 75 --min 2 --max 8
# Disable
lift autoscale strapi --off
The scaler daemon monitors CPU usage via docker stats and adjusts replicas within the defined bounds.
Resource Limits
Set memory and CPU limits per tool:
# View current limits
lift limit
# Set limits
lift limit --tool strapi --memory 2g --cpu 2
Limits are applied immediately via docker update without container restart.
Capacity Planning
Check server resources and per-tool headroom:
lift capacity
Shows CPU, RAM, disk usage and calculates how many more instances of each tool can fit.
Real-time Monitoring
When the Docker Monitoring agent is installed, the Scaling panel shows live CPU, RAM, and uptime for each container. Data refreshes at the agent's configured interval (default: 60 seconds).
Without the agent, metrics are only fetched on page load (one-time snapshot via docker stats).
To install the agent, go to Agents → Overview and enable Docker Monitoring.
Infrastructure Management
lift self-status # Check Traefik, Autoheal status
lift self-logs # View deploy/operation logs
lift self-restart # Restart infrastructure services
lift self-rollback # Rollback CLI to previous version
Scaling Marketplace Tools
Marketplace tools (PostgreSQL, Redis, n8n, Grafana, etc.) support the same scaling commands via the --path flag, which points to the tool's install directory under /opt/onelift/tools/.
# Scale PostgreSQL to 2 replicas
lift scale postgresql 2 --path /opt/onelift/tools/postgresql
# Scale a specific service in a multi-service tool
lift scale strapi 3 --path /opt/onelift/tools/strapi --service app
# Check current replica count for a marketplace tool
lift scale postgresql --path /opt/onelift/tools/postgresql
You can also scale marketplace tools directly from the OneLift dashboard under the tool's settings panel — no CLI needed.
Scale reset on reconfigure: If you scale a marketplace tool up, then reconfigure it (change domain or settings) via the dashboard, the replica count is automatically reset to 1 during the reconfigure deploy. Scale again after reconfiguring.
Related
- lift scale - Scale replicas
- lift autoscale - Automatic scaling
- lift capacity - Server capacity
- lift limit - Resource limits
- lift update - Update marketplace tools to newer versions
- Zero-Downtime Deploys - Blue-green deployments