Example of Running A Containerized Health Service

Placeholder notes for running a containerized instance.

Here’s a docker-compose.yml:

services:
  health:
    image: dashboard-v3-python:0.224.dev3213
    container_name: dashboard-health
    environment:
      - FLASK_ENV=production
    command: gunicorn -c /etc/dashboard/gunicorn.conf
    # command: tail -f /dev/null
    ports:
      - "4443:4443"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4443/version"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    volumes:
       - ./container-config:/etc/dashboard
  redis:
    image: redis
    container_name: redis

and add these files in ./container-config/:

health.json:

{
  "rmq": {
    "brokers": [
      "rmq01.domain",
      "rmq02.domain",
      "rmq03.domain"
    ],
    "username": "username",
    "password": "*****",
    "vhost": "/vhost"
  },
  "health-checks": {
    "trap_health_warning_threshold_s": 60,
    "trap_health_error_threshold_s": 120,
    "expected_num_classifier_nodes": 3,
    "inventory_pending_error_threshold_s": 300,
    "polling_frequency_s": 10
  },
  "inventory-version-uris": [
    "https://inprov01.domain/version",
    "https://inprov02.domain/version",
    "https://inprov03.domain/version"
  ],
  "redis": {
    "hostname": "redis",
    "port": 6379,
    "socket_timeout": 2.5,
    "database": 4
  }
}

and this gunicorn.conf:

capture_output = False
workers = 4
bind = '0.0.0.0:4443'
pidfile = '/var/run/dashboard-health.pid'
raw_env = [ 'CONFIG_FILENAME=/etc/dashboard/health.json' ]
wsgi_app = "dashboard.health:create_app()"