Environments
Manage development, staging, and production environments with isolated configuration.
Environments in oCore represent distinct deployment targets within a project. Each environment is tied to a specific Odoo instance, a Git branch, and an environment type (production, staging, or development). This separation lets you test changes in isolation before promoting them to production.
Environment Management
View and manage environments for your project.
Creating an Environment
Environments are created when you provision an instance linked to a project, or by explicitly creating one from the project's environments tab.
Open a project and go to the Environments tab.
Click Create Environment and fill in the details:
| Field | Description |
|---|---|
| Name | Environment display name |
| Type | production, staging, or development |
| Branch | Git branch to track for deployments |
| Instance | The Odoo instance backing this environment |
Click Create. The environment is linked to the specified instance and branch.
curl -X POST https://ocore.example.com/api/projects/{projectId}/environments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Staging",
"type": "staging",
"branch": "staging",
"instanceId": "INSTANCE_UUID"
}'ocore environment create \
--project PROJECT_UUID \
--name Staging \
--type staging \
--branch staging \
--instance INSTANCE_UUIDEnvironment Types
| Type | Purpose | Typical Setup |
|---|---|---|
| Production | Live customer-facing environment | main branch, full backups, monitoring alerts |
| Staging | Pre-production testing | staging branch, periodic backups, test data |
| Development | Active development and experimentation | develop branch, manual backups, frequent deploys |
One Production Per Project
A project typically has one production environment and one or more staging/development environments. This ensures there is a clear promotion path from development to production.
Environment Variables and Configuration
Each environment can have its own set of environment variables, which are injected into the Odoo container at runtime.
Common Environment Variables
| Variable | Description | Example |
|---|---|---|
WORKERS | Number of Odoo worker processes | 4 |
LIMIT_MEMORY_HARD | Memory limit per worker (bytes) | 2684354560 |
LIMIT_TIME_CPU | CPU time limit per request (seconds) | 600 |
LIMIT_TIME_REAL | Wall clock time limit per request | 1200 |
DB_MAXCONN | Max database connections | 64 |
PROXY_MODE | Enable proxy mode for reverse proxy setups | True |
Update environment variables through the instance settings. Changes take effect after restarting the instance.
Environment Promotion
Environment promotion allows you to copy configuration and optionally data from one environment to another. This is useful for pushing staging-tested changes to production.
Promotion Workflow
Test changes in the development environment.
Merge code to the staging branch. oCore deploys automatically (if webhooks are configured).
After QA approval, merge the staging branch to main. oCore deploys to production.
Snapshot-Based Safety
oCore creates a pre-deployment snapshot before each production deployment. If something goes wrong, you can roll back to the previous state. See Deployments for rollback details.
Cloning Environments
Clone an existing environment to create a copy with the same configuration but linked to a different branch or instance. This is useful for creating a staging environment from production.
curl -X POST https://ocore.example.com/api/environments/{envId}/clone \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Staging Copy",
"branch": "feature-xyz"
}'Environment-Specific Features
Each environment has access to:
- Backups -- Scheduled and manual backups with GFS retention (see Backups)
- Snapshots -- Point-in-time snapshots for quick rollback (see Deployments)
- Databases -- Database management including neutralization for staging (see Databases)
- Monitoring -- Per-environment resource metrics and health checks (see Monitoring)
- Test Suites -- Automated test execution per environment
- Operation Logs -- Detailed logs for all operations (deployments, backups, restores)
Deleting an Environment
Permanent Action
Deleting an environment removes it from the project. The underlying instance is not deleted -- you must delete it separately if desired.
curl -X DELETE https://ocore.example.com/api/environments/{envId} \
-H "Authorization: Bearer $TOKEN"Required Permissions
Environment management requires the manage:environments permission. Viewing environments requires view:environments. Both are scoped by project access.
Troubleshooting
Environment not receiving deployments
- Verify a branch mapping exists for this environment's branch
- Check that the Git webhook is configured and delivering events
- View deployment history to see if builds are failing
Environment variables not applied
- Environment variables require an instance restart to take effect
- Verify the variable names are correct (case-sensitive)
- Check the instance logs for configuration parsing errors
Cannot clone environment
- Ensure you have
manage:environmentspermission - Verify the source environment is in a stable state (not mid-deployment)
- Check that there is sufficient server capacity for the new instance
Promotion path unclear
- Use branch-to-environment mappings to formalize the promotion path
- Document your team's workflow: which branch maps to which environment
- Consider using snapshots before production deployments for safety