Edit Environment
Feature ID: ENV-002
Category: Environments
Required Permission: project.environments.update
API Endpoint: PATCH /api/v1/projects/{project_id}/environments/{env_id}
Overview
Modify an existing environment's configuration, scale resources, change server assignment, update domain settings, and adjust Odoo parameters. Changes can be applied immediately or saved for the next deployment.
Use this feature to:
- Scale CPU, RAM, or disk resources up or down
- Reassign environment to a different server
- Change Git branch or toggle auto-deploy
- Update custom domain configuration
- Adjust Odoo configuration parameters
- Modify PostgreSQL optimization settings
- Update environment variables
Important: Most configuration changes require a manual redeploy to take effect. Resource scaling does NOT automatically trigger redeployment.
Prerequisites
Required Access
- Permission:
project.environments.update(Project Admin or Org Owner) - Organization Membership: Active member of the organization
- Environment Access: Environment must belong to your project
Environment State
- Any Status: Environment can be edited in any status (pending, running, stopped, error)
- Production Protection: Production environments have additional deletion safeguards
Infrastructure
- Available Quota (for scaling): Sufficient organization quota for increased resources
- Running Servers (for reassignment): At least one server in RUNNING status
How to Edit an Environment
Step 1: Navigate to Environment Settings
- Go to Dashboard → Projects
- Click on the project containing the environment
- Click the Environments tab
- Locate the environment you want to edit
- Click the Edit icon (pencil) or View button on the environment row
- Click the Settings tab at the top of the environment page
You will be at /environments/{env-id}/edit in the Settings view.
Step 2: Choose Settings Category
The Settings view has 5 tabs:
- Server Resources - Server assignment, CPU, RAM, Disk allocation
- Domain - Custom domain configuration and SSL status
- Database - Odoo configuration and PostgreSQL optimization
- Repositories - Git branch, auto-deploy, addon repositories
- Advanced - Environment size analysis, danger zone (destroy)
Unsaved Changes Indicator: Tabs with pending changes show an orange "Unsaved" badge.
Server Resources Tab
Change Server Assignment
When to change: Move environment to a different physical server
- Navigate to Settings → Server Resources tab
- Find the Server dropdown (shows current server or "No server assigned")
- Click the dropdown to see available servers
- Display format:
{server-name} | {ip-address} | {available-capacity} - Only RUNNING servers are selectable
- Display format:
- Select the new server
- Important: Verify new server has sufficient capacity (shown in dropdown)
- Click Save Changes at bottom of tab
Server Requirements:
- Status must be
RUNNING(not provisioning or offline) - Must belong to your organization
- Must have available capacity for environment's current resources
- Environment count must be below server's max_projects limit (usually 8)
What happens:
- Environment's
vm_idis updated to new server - No automatic redeploy - you must manually deploy to move containers
- Next deployment will create containers on the new server
Unassign Server
To remove server assignment:
- Click the X button in the server dropdown
- Server field becomes "No server assigned"
- Click Save Changes
Note: Environment cannot be deployed without an assigned server.
Scale CPU Resources
Range: 0.25 - 32 cores (limited by server capacity and organization quota)
- In Server Resources tab, find CPU Cores slider
- Drag slider or enter value directly
- Increment: 0.5 core steps
- Display shows: Total cores, PostgreSQL allocation (30%), Odoo allocation (70%)
- Capacity Indicator: Watch the server capacity bar
- Green: Resources available
- Red: Exceeds server capacity (save disabled)
- Quota Indicator: Check organization quota usage
- Updates in real-time as you adjust resources
- Click Save Changes
Scaling Up:
- Requires available organization quota
- Must not exceed assigned server's total cores
- PostgreSQL cores auto-recalculated (30% of new total)
Scaling Down:
- Can reduce to minimum 0.25 cores
- Frees up quota for other environments
- PostgreSQL cores auto-recalculated
Recommended Allocations:
| Environment Type | CPU Cores | Notes |
|---|---|---|
| Development | 1-2 cores | Sufficient for testing |
| Staging | 2-4 cores | Matches production load testing |
| Production | 4-8+ cores | Based on concurrent users |
Scale RAM Resources
Range: 256 MB - 131,072 MB (128 GB) - limited by server capacity and quota
- In Server Resources tab, find RAM dropdown
- Select from preset options:
- 512 MB, 1 GB, 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, 64 GB, 128 GB
- Or enter custom value in MB
- Display shows: Total RAM, PostgreSQL allocation (30%), Odoo allocation (70%)
- Capacity Indicator: Verify server has available memory
- Click Save Changes
Scaling Considerations:
- Odoo requires minimum 1 GB RAM for stable operation
- PostgreSQL benefits from larger cache (30% allocation)
- Each Odoo worker consumes ~150-300 MB RAM
Recommended Allocations:
| Environment Type | RAM (GB) | Max Users | Workers |
|---|---|---|---|
| Development | 2-4 GB | 1-5 | 2 |
| Staging | 4-8 GB | 10-20 | 4 |
| Production | 8-16 GB | 50-100 | 8 |
| Production (High Load) | 16-32 GB | 100-500 | 16 |
Scale Disk Storage
Range: 1 - 1000 GB (limited by server capacity and quota)
- In Server Resources tab, find Disk Space slider
- Drag slider or enter value
- Increment: 5 GB steps
- Minimum shown in UI: 5 GB (backend minimum: 1 GB)
- Growth Recommendation: Check current usage first
- Navigate to Advanced tab → Environment Size section
- Review Database Size, Filestore Size, Addons Size
- Add 20-30% buffer for growth
- Click Save Changes
Disk Usage Breakdown:
- Database: PostgreSQL database files (~10-50% of total)
- Filestore: Uploaded attachments, images, documents (~30-70%)
- Addons: Custom modules and dependencies (~5-10%)
- Logs: Application and system logs (~5-10%)
Scaling Down Warning:
- Cannot scale disk below current usage
- Check Advanced → Environment Size before reducing
- Backend validates disk >= current total size
Override PostgreSQL Resources (Advanced)
By default, PostgreSQL receives 30% of total CPU and RAM. To customize:
- In Server Resources tab, scroll to PostgreSQL Resources Override
- Click Custom PostgreSQL Allocation toggle to enable
- Set PostgreSQL CPU Cores:
- Range: 0.1 - 16 cores
- Default: 30% of total CPU
- Set PostgreSQL RAM:
- Range: 128 MB - 65,536 MB
- Default: 30% of total RAM
- Odoo Resources: Automatically calculated
- Odoo CPU = Total CPU - PostgreSQL CPU
- Odoo RAM = Total RAM - PostgreSQL RAM
- Click Save Changes
When to override:
- High read/write database workload → Increase PostgreSQL allocation
- Compute-heavy Odoo operations → Decrease PostgreSQL allocation
- Large database with complex queries → Increase PostgreSQL RAM
Domain Tab
Update Custom Domain
Use case: Point your own domain to the environment
- Navigate to Settings → Domain tab
- System URL (read-only): Shows auto-generated
{subdomain}.apps.oec.sh - Custom Domain field: Enter your domain (e.g.,
app.mycompany.com) - Click Save Changes
- Configure DNS (required):
- Go to your DNS provider
- Create A record:
app.mycompany.com→ Server IP address - Wait for DNS propagation (5-60 minutes)
- Verify DNS: Return to this tab, click Verify DNS button
- SSL Provisioning: Once verified, SSL certificate auto-provisions via Let's Encrypt
Domain Status Indicators:
- Pending: DNS not yet verified
- Verifying: DNS propagation in progress
- Verified: DNS confirmed, SSL provisioning started
- Active: SSL certificate installed, HTTPS working
- Failed: DNS verification or SSL provisioning failed
Troubleshooting:
- DNS not propagating: Wait 5-60 minutes, some providers take longer
- SSL failed: Ensure port 80 and 443 are open on server
- Domain already in use: Each domain can only be used by one environment
Remove Custom Domain
- Navigate to Settings → Domain tab
- Clear the Custom Domain field
- Click Save Changes
- Environment reverts to using system URL only
Database Tab
Update Odoo Configuration
Configure Odoo runtime parameters (odoo.conf settings):
- Navigate to Settings → Database tab
- Scroll to Odoo Configuration section
- Use Preset (optional): Select from predefined configurations
- Minimal: Basic settings, low resource usage
- Standard: Recommended for most environments
- Production: Optimized for live deployments
- High Performance: Maximum performance settings
- Or customize parameters:
Common Parameters:
| Parameter | Description | Recommended Value |
|---|---|---|
workers | Number of Odoo worker processes | 4-8 (production), 2 (dev) |
max_cron_threads | Concurrent scheduled job threads | 2 |
limit_memory_hard | Hard memory limit per worker (bytes) | 2684354560 (2.5 GB) |
limit_memory_soft | Soft memory limit per worker (bytes) | 2147483648 (2 GB) |
limit_request | Max requests per worker before restart | 8192 |
limit_time_cpu | CPU time limit per request (seconds) | 60 |
limit_time_real | Real time limit per request (seconds) | 120 |
log_level | Logging verbosity | info (prod), debug (dev) |
db_maxconn | Max PostgreSQL connections | 64 |
db_template | Template database for new databases | template0 |
- Click Save Changes
- Redeploy Required: Changes take effect on next deployment
Worker Calculation:
- Formula:
workers = (CPU_cores * 2) + 1 - Example: 4 CPU cores → 9 workers
- Minimum: 2 workers
- Maximum: Limited by RAM (each worker ~200 MB)
Configure PostgreSQL Optimization
Enable or disable PostgreSQL performance features:
PGTune (Auto-Configuration)
- Navigate to Settings → Database tab
- Find PostgreSQL Optimization section
- Toggle Enable PGTune
- Enabled (default): Auto-generates optimal PostgreSQL config based on allocated resources
- Disabled: Uses PostgreSQL defaults
- Click Save Changes
- Redeploy Required: Changes apply on next deployment
What PGTune configures:
shared_buffers- Memory for caching (25% of RAM)effective_cache_size- OS cache estimation (75% of RAM)work_mem- Memory per query operationmaintenance_work_mem- Memory for maintenance operationsmax_connections- Maximum concurrent connections
PgBouncer (Connection Pooling)
- In PostgreSQL Optimization section
- Toggle Enable PgBouncer
- Enabled (default): Activates connection pooling
- Disabled: Direct PostgreSQL connections
- Pool Size (advanced): Auto-calculated or custom
- Formula:
pool_size = (CPU_cores * 2) + 1 - Range: 10-100 connections
- Formula:
- Click Save Changes
- Redeploy Required: Changes apply on next deployment
PgBouncer Benefits:
- Reduces PostgreSQL connection overhead
- Improves performance under high concurrent load
- Typical performance gain: 20-30% with 50+ concurrent users
Port Configuration:
- PostgreSQL: Port 5432 (container-internal)
- PgBouncer: Port 6432 (Odoo connects here when enabled)
Repositories Tab
Change Git Branch
Use case: Switch to a different branch for deployment
- Navigate to Settings → Repositories tab
- Find Git Branch dropdown
- Shows all branches from connected Git repository
- Current branch is highlighted
- Select new branch from dropdown
- Click Save Changes
What happens:
- Environment's
git_branchis updated - If auto-deploy enabled: Deployment triggers automatically
- If auto-deploy disabled: Next manual deployment uses new branch
Common Use Cases:
- Development → Feature branch (e.g.,
feature/new-module) - Staging → Release branch (e.g.,
release/v2.0) - Production → Stable branch (e.g.,
main,production)
Toggle Auto-Deploy
Use case: Enable/disable automatic deployment on git push
- In Repositories tab, find Auto-Deploy toggle
- Click toggle to enable/disable
- Enabled: Deployment triggered on git push to
git_branch - Disabled: Manual deployment only
- Enabled: Deployment triggered on git push to
- Click Save Changes
Recommendation:
- ✅ Enable for Development environments (fast iteration)
- ⚠️ Consider for Staging environments (automated testing)
- ❌ Disable for Production environments (manual control)
Manage Addon Repositories
Use case: Add or remove custom Odoo addon repositories
- In Repositories tab, scroll to Addon Repositories section
- Add Addon Repository:
- Click Add Addon Repository button
- Select repository from dropdown (from your Git connections)
- Select branch
- Click Add
- Remove Addon Repository:
- Find repository in the list
- Click Remove icon (X)
- Click Save Changes
- Redeploy Required: Warning appears - "Redeploy to apply addon changes"
Deployment Behavior:
- Addon repositories are cloned during deployment
- Modules are added to Odoo addons path
- Modules become available in Odoo Apps list
Advanced Tab
View Environment Size
Check current disk space usage breakdown:
- Navigate to Settings → Advanced tab
- Environment Size section shows:
- Database Size: PostgreSQL database files (in MB/GB)
- Filestore Size: Uploaded attachments and documents
- Addons Size: Custom modules and dependencies
- Total Size: Sum of all components
- Last Updated: When size calculation last ran
Use this information to:
- Plan disk scaling (before running out of space)
- Identify growth trends
- Estimate backup sizes
Size Refresh: Sizes update every 6 hours automatically
Destroy Environment (Danger Zone)
Warning: This permanently deletes the environment and all associated data.
- Navigate to Settings → Advanced tab
- Scroll to Danger Zone (collapsed by default)
- Click Destroy Environment button
- Backup Decision dialog appears (if backups exist):
- Keep All Backups: Delete environment, keep all backups (orphaned)
- Keep Latest Backup: Delete environment, keep only most recent backup
- Delete All Backups: Delete environment and all backups from storage
- Type to Confirm: Enter environment name exactly to confirm
- Click Destroy button
Production Protection:
- Production environments cannot be destroyed
- Error message: "Cannot delete production environment"
- Must change environment type first (contact support)
What gets deleted:
- Environment database record
- All deployment records
- All log entries
- Docker containers (if deployed)
- Database and filestore on server
- Optionally: Backups (based on selection)
Saving Changes
Save Flow
- Make changes in any Settings tab
- Unsaved Indicator: Tab shows orange "Unsaved" badge
- Click Save Changes button at bottom of tab
- Validation: Backend checks capacity, quota, server status
- Success: Changes saved, badge removed, toast notification appears
- Error: Validation errors displayed, changes not saved
Save Button States:
- Enabled (blue): Changes pending, validation passed
- Disabled (gray): No changes or validation failed
- Loading (spinner): Save in progress
Validation Errors
Common validation errors:
| Error Message | Cause | Solution |
|---|---|---|
| "Server capacity exceeded" | Requested resources > server capacity | Reduce CPU/RAM/Disk or select larger server |
| "Quota exceeded" | Organization quota limit reached | Stop unused environments or upgrade plan |
| "Server not found" | Selected server deleted or not accessible | Select different server |
| "Server not running" | Selected server offline or provisioning | Wait for server to reach RUNNING status |
| "Subdomain already exists" | Custom subdomain in use | Choose different subdomain |
Visual Feedback
During Editing
- Tab Badges: Orange "Unsaved" badge on tabs with pending changes
- Capacity Bars: Real-time server capacity indicators (green/red)
- Quota Meters: Organization quota usage percentage bars
- Field Validation: Red borders and error messages on invalid fields
Upon Save
- Success Toast: "Settings saved successfully" (green notification, top-right)
- Tab Badge Removed: "Unsaved" badge disappears
- Form Reset: Pending changes counter resets to 0
Upon Error
- Error Toast: Specific error message (red notification, top-right)
- Field Highlights: Invalid fields outlined in red
- Inline Messages: Error descriptions below affected fields
What Requires Redeployment
Changes That Require Manual Redeploy
The following changes are saved but only take effect after redeploying:
- Server Assignment: Containers must be recreated on new server
- Resource Scaling: CPU/RAM/Disk changes require container restart
- Custom Domain: DNS and SSL configuration updates
- Odoo Configuration: odoo.conf parameters
- PostgreSQL Optimization: PGTune and PgBouncer settings
- Addon Repositories: New repositories must be cloned
- Environment Variables: Docker container environment
To apply changes: Click Deploy button in environment header or overview tab.
Changes That Auto-Deploy (if enabled)
- Git Branch Change: If auto-deploy enabled, triggers deployment automatically
- Git Push: If auto-deploy enabled, deployment triggers on push to
git_branch
Common Scenarios
Scenario 1: Scale Up Production for High Traffic
Goal: Increase resources before Black Friday sale
- Navigate to environment → Settings → Server Resources tab
- Scale up resources:
- CPU: 4 cores → 8 cores
- RAM: 8 GB → 16 GB
- Click Save Changes
- Go to Overview tab → Click Deploy to apply changes
- Monitor deployment logs for completion
- Verify increased resources in Monitoring tab
Estimated Downtime: 2-5 minutes (container restart)
Scenario 2: Move Environment to Different Server
Goal: Migrate to a new, more powerful server
- Ensure new server is in RUNNING status
- Navigate to environment → Settings → Server Resources tab
- Change Server dropdown to new server
- Verify new server has capacity
- Click Save Changes
- Go to Overview tab → Click Deploy
- Deployment creates containers on new server
- Old containers are stopped and removed
Estimated Downtime: 3-7 minutes (full redeployment)
Scenario 3: Switch Staging to Feature Branch
Goal: Test new feature in staging environment
- Navigate to staging environment → Settings → Repositories tab
- Change Git Branch to
feature/new-checkout-flow - Click Save Changes
- If auto-deploy disabled: Manually click Deploy
- If auto-deploy enabled: Deployment triggers automatically
- Monitor deployment in Logs tab
- Test feature at staging URL
Scenario 4: Enable PgBouncer for Better Performance
Goal: Improve database connection performance
- Navigate to environment → Settings → Database tab
- Find PostgreSQL Optimization section
- Toggle Enable PgBouncer to ON
- Click Save Changes
- Go to Overview tab → Click Deploy
- Wait for deployment completion (PgBouncer container created)
- Verify in logs:
pgbouncer container started
Performance Gain: 20-30% for high-concurrency workloads
API Reference
Update Environment Endpoint
PATCH /api/v1/projects/{project_id}/environments/{env_id}
Content-Type: application/json
Authorization: Bearer {jwt_token}Path Parameters:
project_id(UUID, required) - The project UUIDenv_id(UUID, required) - The environment UUID
Request Body (all fields optional):
{
"name": "updated-name",
"vm_id": "new-server-uuid",
"domain": "app.mycompany.com",
"subdomain": "new-subdomain",
"git_branch": "feature/branch",
"auto_deploy": true,
"port": 8069,
"cpu_cores": 4.0,
"ram_mb": 8192,
"disk_gb": 50,
"postgres_cpu_cores": 1.2,
"postgres_ram_mb": 2458,
"odoo_config": {
"workers": 8,
"max_cron_threads": 2,
"log_level": "info"
},
"environment_vars": {
"CUSTOM_VAR": "new_value"
},
"is_active": true
}Response (200 OK):
{
"id": "env-uuid",
"name": "updated-name",
"vm_id": "new-server-uuid",
"environment_type": "staging",
"subdomain": "new-subdomain",
"system_url": "https://new-subdomain.apps.oec.sh",
"status": "running",
"cpu_cores": 4.0,
"ram_mb": 8192,
"disk_gb": 50,
"postgres_cpu_cores": 1.2,
"postgres_ram_mb": 2458,
"odoo_cpu_cores": 2.8,
"odoo_ram_mb": 5734,
"updated_at": "2024-12-11T11:30:00Z"
}Error Responses:
| Status | Error Code | Description |
|---|---|---|
| 400 | QUOTA_EXCEEDED | Organization quota limit reached |
| 400 | SERVER_CAPACITY_EXCEEDED | Server doesn't have enough resources |
| 400 | SERVER_NOT_RUNNING | Selected server is offline or provisioning |
| 400 | SUBDOMAIN_EXISTS | Subdomain is already in use |
| 403 | PERMISSION_DENIED | Missing project.environments.update permission |
| 404 | ENVIRONMENT_NOT_FOUND | Environment doesn't exist |
| 404 | SERVER_NOT_FOUND | Selected server doesn't exist |
Full API Documentation: See Environment API Reference
Related Features
- Create Environment - Deploy a new environment
- Deploy Environment - Deploy updated configuration
- Clone Environment - Duplicate environment with data
- View Deployment Logs - Monitor deployment progress
- Manage Servers - Configure and monitor servers
- Organization Quota - View and manage resource quota
- Custom Domains - Configure custom domain and SSL
Best Practices
Resource Scaling
Scale Gradually:
- Increase resources by 25-50% at a time
- Monitor performance after each change
- Avoid over-provisioning (wastes quota)
Monitor Before Scaling:
- Check Monitoring tab for CPU/RAM usage
- Scale up if consistently above 70-80% usage
- Scale down if consistently below 30% usage
Plan for Growth:
- Development: Start small, scale as needed
- Staging: Match production specifications
- Production: Add 20-30% buffer for traffic spikes
Server Management
Use Multiple Servers:
- Separate development and production servers
- Isolate high-traffic environments
- Plan for disaster recovery (multi-server redundancy)
Test Server Changes:
- Always use Test Connection before saving
- Verify capacity indicators show green
- Check server status in Settings → Servers
Configuration Management
Test in Development First:
- Make configuration changes in dev environment
- Validate changes work as expected
- Promote tested config to staging, then production
Document Custom Settings:
- Keep notes on custom Odoo config parameters
- Document why specific settings were chosen
- Track configuration history in version control
Review Odoo Worker Count:
- Formula:
workers = (CPU_cores * 2) + 1 - Adjust based on actual load patterns
- Monitor worker memory usage
Git Workflow
Branch Strategy:
- Development → Feature branches
- Staging → Release candidates or
developbranch - Production → Stable branch (
main,production)
Auto-Deploy Usage:
- ✅ Enable: Development environments
- ⚠️ Consider: Staging with automated tests
- ❌ Avoid: Production environments
PostgreSQL Optimization
Always Enable PGTune:
- Provides significant performance improvement
- Auto-adjusts config based on resources
- Zero configuration required
Enable PgBouncer for Production:
- Improves performance with 20+ concurrent users
- Minimal overhead
- Recommended for all production environments
Consider Read Replica (Odoo 18+):
- Use for read-heavy workloads
- Offload reporting queries
- Requires 30% additional CPU/RAM, 100% disk
Next Steps
After editing your environment:
- Deploy changes - See Deploy Environment
- Monitor deployment - See View Deployment Logs
- Verify changes - Check environment URL and test functionality
- Monitor performance - Use Monitoring tab for real-time metrics
- Create backup - See Create Manual Backup
Last Updated: December 11, 2025 Applies to: OEC.SH v2.0+ Related Sprint: Sprint 2E41 - Documentation System