Multiple Environment Deployment on Same Server
Deploy development, staging, and production environments on a single server.
Why Multiple Environments?
- ✅ Test changes safely before going live
- ✅ Show clients work-in-progress on staging
- ✅ Keep costs low by sharing one server
- ✅ Maintain separate configs per environment
How It Works
OEC.sh runs each environment in isolated Docker containers on the same server. Each gets its own:
- Database (PostgreSQL container)
- Odoo application container
- Subdomain (e.g.,
project-dev.apps.oec.sh,project-staging.apps.oec.sh)
They share the server's CPU, RAM, and disk — you control how much each environment gets.
Step 1: Set Up Your Project
If you haven't already, create a project with your Git repository.
Step 2: Create Multiple Environments
- Open your project
- Go to Environments tab
- Click Add Environment for each:
| Environment | Type | Suggested Resources |
|---|---|---|
| Development | Development | 1 CPU, 2 GB RAM, 10 GB disk |
| Staging | Staging | 2 CPU, 4 GB RAM, 20 GB disk |
| Production | Production | 2-4 CPU, 4-8 GB RAM, 30+ GB disk |
- Select the same server for all environments
- Deploy each environment
Step 3: Configure Per Environment
Each environment can have different:
- Git branch —
dev,staging,main - Odoo config — debug mode, workers, log level
- Custom domain — staging.yoursite.com, app.yoursite.com
- Addons — test modules on dev without affecting production
Resource Planning
For a single server, plan your total resources:
| Server Size | Recommended Environments |
|---|---|
| 4 CPU / 8 GB | 2-3 environments |
| 8 CPU / 16 GB | 4-6 environments |
| 16 CPU / 32 GB | 8-10 environments |
Tip: Development environments can share resources more aggressively since they're not always active.
How Each Resource Is Shared
Each environment gets its own CPU / RAM / disk allocation. But the three resources behave differently when multiple environments share one server.
CPU — soft limit, can over-commit
CPU is allocated as cgroup weights. You can sum your environments' CPU values above the server's total core count and it still works:
- If env A is idle and env B is busy, env B uses the idle cycles from env A automatically.
- The allocation acts as a minimum guarantee during contention, not a hard ceiling.
- On a 4-core server, four envs of 2 CPU each (=8 CPU total) is fine in practice as long as they don't all peak at the same time.
RAM — hard limit, no over-commit
RAM is a hard ceiling per environment. The cgroup will kill (OOM) any container that exceeds its limit.
- If env A is idle, env B cannot borrow its RAM.
- Sum of environment RAM must stay ≤ server RAM − ~1 GB system overhead.
- Don't over-provision. If you give every env enough headroom for occasional spikes, you'll run out of bookable RAM fast.
Disk — hard allocation per env
Each environment gets its own slice of the VM filesystem, reserved at deploy time.
- No overflow into another env's space.
- Sum of environment disk must stay ≤ server disk − ~10 GB system overhead (Docker images, logs, OS).
- Disk fills up faster than people expect — Odoo filestore, attachments, audit logs, postgres WAL. Monitor and scale before hitting 80%.
Practical sizing for Odoo
| Env type | CPU | RAM | Disk |
|---|---|---|---|
| Light dev / sandbox | 0.5 | 1 GB | 10 GB |
| Standard dev / staging | 1–1.5 | 2 GB | 15 GB |
| Production (small) | 2 | 4 GB | 30 GB |
| Production (medium) | 4 | 8 GB | 50–100 GB |
You can resize at any time from the environment's Settings → Resources tab. CPU and RAM changes apply on the next container restart; disk increases apply immediately (decreases require a fresh env).
Best Practices
- Use branches — Map each environment to a Git branch (dev → development, staging → staging, main → production)
- Clone for fresh data — Periodically clone production to staging for realistic testing
- Set up backups — At minimum, back up production daily
- Monitor resources — Check server monitoring to ensure environments aren't competing for resources
- Clean up — Delete temporary environments when done to free resources
Next Steps
- Clone an Environment — Copy production data to staging
- Add Custom Domain — Give each environment a proper URL
- Scale Resources — Adjust CPU/RAM per environment