Skip to content

Docker Subscription

1. Docker Fields

The Docker module extends sadeem.subscription with container-specific configuration.

Stack Configuration

  1. Docker Image - Portainer image to deploy (tracked)
  2. Docker Environment - Portainer environment where the container runs (tracked)
  3. Stack ID - Portainer Docker stack ID (readonly)
  4. Docker Worker Count - Number of Odoo workers (tracked, 0 = threaded mode)
  5. External PostgreSQL - Use external PostgreSQL server instead of in-container DB
  6. PostgreSQL Server - External database server reference

Odoo Configuration

  1. Limit Time CPU - Max CPU time per request in seconds (default: 60)
  2. Limit Time Real - Max real time per request in seconds (default: 120)
  3. Limit Time Real Cron - Max cron job time, 0 = unlimited (default: 0)
  4. Limit Requests - Max requests per worker (default: 8192)
  5. Log Level - Odoo log level: info, debug_rpc, debug_sql, warn, error, critical (default: info)
  6. Update Module - Comma-separated modules to update on start (tracked)
  7. Auto Install Modules - Comma-separated modules to install on start (tracked)
  8. Server Wide Modules - Comma-separated server-wide modules (tracked)
  9. Without Demo - Disable demo data on module installation (default: True, tracked)
  10. Sendfile - Enable X-Sendfile/X-Accel-Redirect headers (default: False, tracked)
  11. User Addons - Path to user custom addons directory

Container Operations

  1. Docker Log - Container log output
  2. Latest Log Tail - Number of log lines to fetch (default: 100, max: 1000)
  3. Docker Command - Command to execute in the container
  4. Docker Command Output - Command execution result
  5. Monitor Enable - Enable live monitoring (beta)
  6. Monitor Data - Live monitoring data (JSON)
  7. 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
  1. 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
  2. On Confirm, HTTP and WebSocket ports are allocated from the environment's next_port
  3. 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.

  1. Code Server Stack ID - Portainer stack ID for the code server
  2. 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:

  1. The Docker stack is deleted from Portainer
  2. The user addons directory is removed from the server
  3. DNS records and Nginx hosts are cleaned up (handled by parent module)