Skip to content

Idle Sleep ​

Automatically sleep idle containers and wake them on traffic. Saves resources for infrequently used services.

Overview ​

GoDoxy puts containers to sleep after a period of inactivity and wakes them automatically when traffic arrives. This feature is ideal for development environments, staging servers, or services with unpredictable usage patterns.

Supported Platforms ​

  • Docker
  • Proxmox LXCs

Supported Protocols ​

ProtocolDescription
HTTPStandard web traffic
TCPGeneric TCP connections
UDPGeneric UDP connections

Quick Reference ​

PropertyDescriptionDefaultRequired
idle_timeoutInactivity before sleepDisabledYes
wake_timeoutWait time for wake30sNo
stop_methodContainer stop methodstopNo
stop_timeoutStop command timeout10sNo
stop_signalSignal for stop/killDocker defaultNo
start_endpointWake trigger endpointAnyNo
no_loading_pageDisable wake pagefalseNo

How It Works ​

Sleep Behavior ​

  1. Container receives no traffic for idle_timeout duration
  2. GoDoxy executes stop_method on the container
  3. Container dependencies are stopped in order
  4. Traffic to the route triggers wake-up sequence

Wake Behavior ​

  1. Request arrives for sleeping route
  2. Dependencies start first (if configured)
  3. Main container starts
  4. GoDoxy waits up to wake_timeout for readiness
  5. Request is proxied to the now-active container

Dependency Management ​

Containers with depends_on are managed as a group. This ensures related services start and stop together.

WARNING

Do not set idle_timeout on dependency containers.

Condition Types ​

Control when dependencies are considered ready:

ConditionDescription
service_startedDependency process started
service_healthyDependency healthcheck passes

Docker Compose Example ​

yaml
# Without conditions (implies service_started)
depends_on:
  - redis
  - postgres

# With explicit conditions
depends_on:
  redis:
    condition: service_healthy
  postgres:
    condition: service_started

Label Syntax ​

yaml
labels:
  proxy.depends_on: |
    - redis:service_healthy
    - postgres:service_started

Docker Configuration ​

Enable idle sleep by adding labels to your container:

yaml
services:
  app:
    image: nginx:latest
    container_name: my-app
    labels:
      # Required
      proxy.idle_timeout: 1h30s
      # Optional
      proxy.wake_timeout: 30s
      proxy.stop_method: stop
      proxy.stop_timeout: 10s
      proxy.stop_signal: SIGINT
      proxy.start_endpoint: /start
      proxy.no_loading_page: true
    depends_on:
      redis:
        condition: service_healthy
      postgres:
        condition: service_healthy

  redis:
    image: redis:alpine
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  postgres:
    image: postgres:16
    # Healthcheck configured via GoDoxy health monitoring

Proxmox LXC Configuration ​

See Proxmox Integration for detailed configuration options.

Property Reference ​

Core Properties ​

PropertyDescriptionDefaultAccepted Values
idle_timeoutInactivity before sleepDisabledDuration (1h30s, 15m)
wake_timeoutWait for wake completion30sDuration
start_endpointWake trigger pathAnyRelative URI

Stop Control ​

PropertyDescriptionDefaultAccepted Values
stop_methodContainer stop actionstopstop, pause, kill
stop_timeoutStop command wait time10sDuration
stop_signalSignal for stop/killDocker defaultSIGINT, SIGTERM, SIGQUIT, SIGKILL (with or without SIG prefix)

UI Options ​

PropertyDescriptionDefaultValues
no_loading_pageDisable wake loading pagefalseboolean

Duration Format ​

Use standard duration notation:

UnitDescriptionExample
sSeconds30s
mMinutes15m
hHours1h
h m sCombined1h30m15s

Examples ​

Development Environment ​

yaml
services:
  dev-api:
    image: myapp/api:latest
    labels:
      proxy.idle_timeout: 30m
      proxy.wake_timeout: 60s
      proxy.stop_method: kill
      proxy.stop_timeout: 5s
    depends_on:
      dev-db:
        condition: service_healthy
  dev-db:
    image: postgres:16
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 3s

Staging with Specific Wake Endpoint ​

yaml
services:
  staging-app:
    image: myapp/staging:latest
    labels:
      proxy.idle_timeout: 2h
      proxy.start_endpoint: /api/wake
      proxy.no_loading_page: false

Best Practices ​

  1. Use healthchecks with service_healthy condition for reliable dependencies
  2. Set appropriate timeouts based on your service startup time
  3. Test wake behavior before deploying to production
  4. Monitor container logs during initial setup
  5. Use consistent stop signals that match your application

Released under the MIT License.