Docker Subscription
1. Docker Fields
The Docker module extends
sadeem.subscriptionwith container-specific configuration.
Stack Configuration
- Docker Image - Portainer image to deploy (tracked)
- Docker Environment - Portainer environment where the container runs (tracked)
- Stack ID - Portainer Docker stack ID (readonly)
- Docker Worker Count - Number of Odoo workers (tracked, 0 = threaded mode)
- External PostgreSQL - Use external PostgreSQL server instead of in-container DB
- PostgreSQL Server - External database server reference
Odoo Configuration
- Limit Time CPU - Max CPU time per request in seconds (default: 60)
- Limit Time Real - Max real time per request in seconds (default: 120)
- Limit Time Real Cron - Max cron job time, 0 = unlimited (default: 0)
- Limit Requests - Max requests per worker (default: 8192)
- Log Level - Odoo log level: info, debug_rpc, debug_sql, warn, error, critical (default: info)
- Update Module - Comma-separated modules to update on start (tracked)
- Auto Install Modules - Comma-separated modules to install on start (tracked)
- Server Wide Modules - Comma-separated server-wide modules (tracked)
- Without Demo - Disable demo data on module installation (default: True, tracked)
- Sendfile - Enable X-Sendfile/X-Accel-Redirect headers (default: False, tracked)
- User Addons - Path to user custom addons directory
Container Operations
- Docker Log - Container log output
- Latest Log Tail - Number of log lines to fetch (default: 100, max: 1000)
- Docker Command - Command to execute in the container
- Docker Command Output - Command execution result
- Monitor Enable - Enable live monitoring (beta)
- Monitor Data - Live monitoring data (JSON)
- Monitor Update Interval - Refresh interval: 5s, 10s, 30s, or 60s (default: 30)
2. Deployment Flow
Image → Best Environment → Assign Ports → Create Stack → DNS/Nginx → Running
- When the Docker Image field changes, the system calls
get_best_environment()to auto-populate:- Docker environment, server IP, HTTP/WebSocket ports
- Nginx server and certificate
- Cloudflare settings (if enabled on environment)
- Odoo version, addons paths
- On Confirm, HTTP and WebSocket ports are allocated from the environment's
next_port - On Run Subscription, the system:
- Creates the Cloudflare DNS record
- Creates the Nginx proxy host with SSL
- Generates a Docker Compose YAML and creates the stack in Portainer
- Transitions to Running state
3. Container Actions
| Action | Description |
|---|---|
| Restart | Gracefully restarts the Docker container |
| Start | Starts a stopped container |
| Stop | Stops a running container |
| Apply Configuration | Updates the stack with current Odoo configuration and restarts |
| View Logs | Fetches container logs with configurable tail lines |
| Run Command | Executes a whitelisted command inside the container |
Allowed Commands
For security, only whitelisted commands can be executed in containers: ls, apt install/remove, pip install/uninstall, pip3 install/uninstall.
4. Docker Compose Generation
The system generates a Docker Compose YAML string for each subscription stack including:
- Service definition with image, ports, volumes, DNS
- Entrypoint parameters for Odoo (database name, workers, memory limits, log level, etc.)
- PostgreSQL service (internal container or external connection)
- Volume mounts for data, user addons, shared addons, and enterprise addons
- Memory and CPU limits calculated from worker count
5. Code Server
Each Docker subscription can have a separate VS Code Server container for remote development.
- Code Server Stack ID - Portainer stack ID for the code server
- Code server domain, password, port, and state fields (inherited from subscription base)
| Action | Description |
|---|---|
| Create Code Server | Creates a separate Docker stack with the VS Code Server image |
| Start/Stop Code Server | Controls the code server container |
| Change Password | Updates the code server access password |
6. Cancellation
When a Docker subscription is cancelled:
- The Docker stack is deleted from Portainer
- The user addons directory is removed from the server
- DNS records and Nginx hosts are cleaned up (handled by parent module)