{
  "name": "contextra-icerti",
  "networks": {
    "default": {
      "ipam": {},
      "name": "contextra-icerti_default"
    }
  },
  "services": {
    "ai-control-sidecar": {
      "cap_drop": [
        "ALL"
      ],
      "command": null,
      "cpus": 1,
      "entrypoint": null,
      "environment": {
        "AI_CONTROL_CERTIFICATE_FILE": "/run/bridge/control-tls.crt",
        "AI_CONTROL_EVENT_ENDPOINT": "https://manager.example.invalid/api/v1/events",
        "AI_CONTROL_LOGIN_BODY_FILE": "/run/bridge/login-body.json",
        "AI_CONTROL_MANAGER_BASE_URL": "https://manager.example.invalid",
        "AI_CONTROL_MANAGER_CA_FILE": "/run/bridge/manager-ca.crt",
        "AI_CONTROL_PASSWORD_FILE": "/run/bridge/password",
        "AI_CONTROL_RUNTIME_BASE_URL": "http://analytics:5000",
        "AI_CONTROL_SERVER_ID": "fixture-ai",
        "AI_CONTROL_SESSION_FILE": "/run/bridge-session/session.json",
        "CONTEXTRA_CONTROL_TOKEN_FILE": "/run/bridge/control-token",
        "CONTEXTRA_RELAY_TOKEN_FILE": "/run/bridge/relay-token"
      },
      "healthcheck": {
        "interval": "10s",
        "retries": 3,
        "start_period": "10s",
        "test": [
          "CMD",
          "python3",
          "-c",
          "import urllib.request; urllib.request.urlopen('http://localhost:8080/live',timeout=2)"
        ],
        "timeout": "3s"
      },
      "image": "sha256:c1e7891b0f6b301f347acf0ac13c755a9b525827060595caa7a830f79592d1be",
      "init": true,
      "mem_limit": "268435456",
      "networks": {
        "default": null
      },
      "pids_limit": 64,
      "read_only": true,
      "restart": "no",
      "security_opt": [
        "no-new-privileges:true"
      ],
      "tmpfs": [
        "/tmp:size=16m,mode=1777"
      ],
      "user": "10001:10001",
      "volumes": [
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/bridge",
          "target": "/run/bridge",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "source": "/data/contextra/site/bridge-session",
          "target": "/run/bridge-session",
          "type": "bind"
        }
      ]
    },
    "ai-gateway": {
      "cap_drop": [
        "ALL"
      ],
      "command": [],
      "cpus": 0.5,
      "depends_on": {
        "ai-control-sidecar": {
          "condition": "service_healthy",
          "required": true
        }
      },
      "entrypoint": [
        "/bin/sh",
        "/etc/bridge/entrypoint.sh"
      ],
      "environment": {
        "AI_ARTIFACT_ACCESS_POLICY": "lan_public",
        "AI_ARTIFACT_LAN_CIDR": "192.168.30.0/24",
        "AI_CONTROL_HOST_PORT": "38443"
      },
      "image": "sha256:ac8efec875ce36b619cb41f91d9db579487b9d45ed29393dc957a745b1e0024f",
      "init": true,
      "mem_limit": "134217728",
      "networks": {
        "default": null
      },
      "pids_limit": 32,
      "ports": [
        {
          "mode": "ingress",
          "protocol": "tcp",
          "published": "38443",
          "target": 38443
        }
      ],
      "read_only": true,
      "restart": "no",
      "security_opt": [
        "no-new-privileges:true"
      ],
      "tmpfs": [
        "/tmp:size=32m,mode=1777"
      ],
      "user": "10001:10001",
      "volumes": [
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/workspace/contextra-analytics-runtime-lifecycle-refactor/docker/secure-gateway-entrypoint.sh",
          "target": "/etc/bridge/entrypoint.sh",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/workspace/contextra-analytics-runtime-lifecycle-refactor/docker/secure-gateway.conf.template",
          "target": "/etc/bridge/nginx.conf.template",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/tls",
          "target": "/run/ai-tls",
          "type": "bind"
        }
      ]
    },
    "analytics": {
      "cap_add": [
        "SYS_NICE",
        "SYS_RESOURCE"
      ],
      "command": null,
      "depends_on": {
        "postgresql": {
          "condition": "service_healthy",
          "required": true
        },
        "redis": {
          "condition": "service_healthy",
          "required": true
        }
      },
      "deploy": {
        "placement": {},
        "resources": {
          "reservations": {
            "devices": [
              {
                "capabilities": [
                  "gpu"
                ],
                "device_ids": [
                  "0"
                ],
                "driver": "nvidia"
              }
            ]
          }
        }
      },
      "entrypoint": null,
      "environment": {
        "AI_CONTROL_SERVER_ID": "fixture-ai",
        "CAMERA_PTZ_CONFIG_PATH": "/etc/contextra/camera_ptz_config.yaml",
        "CONTEXTRA_ARTIFACT_DELIVERY_CAMERAS": "",
        "CONTEXTRA_ARTIFACT_HTTP_ENABLED": "1",
        "CONTEXTRA_ARTIFACT_PUBLIC_BASE": "https://192.168.30.70:38443/artifacts",
        "CONTEXTRA_ARTIFACT_ROOT": "/data/contextra/artifacts",
        "CONTEXTRA_CONTROL_TEMPLATE_FILE": "/run/bridge-config/camera-template.json",
        "CONTEXTRA_CONTROL_TOKEN_FILE": "/run/bridge/control-token",
        "CONTEXTRA_EVENT_ARTIFACT_ENABLED": "1",
        "CONTEXTRA_EVENT_ENDPOINT": "http://ai-control-sidecar:8080/internal/events",
        "CONTEXTRA_EVENT_TRANSPORT": "sidecar",
        "CONTEXTRA_METADATA_ACTIVE_WORKER_LIMIT": "16",
        "CONTEXTRA_METADATA_ENABLED": "true",
        "CONTEXTRA_METADATA_MAX_BYTES": "268435456",
        "CONTEXTRA_METADATA_MAX_MESSAGE_BYTES": "10485760",
        "CONTEXTRA_METADATA_REDIS_URL": "redis://fixture:fixture@redis:6379/0",
        "CONTEXTRA_METADATA_STREAM_LENGTH": "100",
        "CONTEXTRA_METADATA_WORKERS": "1",
        "CONTEXTRA_METADATA_WORKER_MODE": "channel",
        "CONTEXTRA_RELAY_TOKEN_FILE": "/run/bridge/relay-token",
        "CONTEXTRA_SECURE_CONTROL_ENABLED": "1",
        "CONTEXTRA_STREAM_EXECUTION_MODE": "process",
        "DATABASE_URL": "postgresql://contextra:fixture-not-a-real-credential@postgresql:5432/contextra",
        "DB_MAX_OVERFLOW": "10",
        "DB_POOL_SIZE": "20",
        "FRAME_RETENTION_DAYS": "30",
        "GPU_ID": "0",
        "LOG_FORMAT": "json",
        "LOG_LEVEL": "INFO",
        "MODEL_NAME": "RFDETRMedium",
        "MODEL_PRECISION": "fp16",
        "MODEL_RESOLUTION": "576x576",
        "OMP_NUM_THREADS": "1",
        "OPENBLAS_NUM_THREADS": "1",
        "PORT": "5000",
        "REDIS_STREAMS_ENABLED": "true",
        "REDIS_STREAM_MAXLEN": "100000",
        "REDIS_URL": "redis://fixture:fixture@redis:6379/0",
        "STREAMS_CONFIG_PATH": "/etc/contextra/streams.yaml",
        "STREAMS_RUNTIME_PATH": "/var/lib/contextra/runtime/streams_runtime.yaml",
        "SYSTEM_CONFIG_PATH": "/etc/contextra/system_config.yaml",
        "TRITON_GRPC_ENDPOINT": "localhost:8001",
        "TRITON_HTTP_ENDPOINT": "localhost:8000"
      },
      "healthcheck": {
        "interval": "30s",
        "retries": 3,
        "start_period": "2m0s",
        "test": [
          "CMD",
          "python3",
          "-c",
          "import urllib.request; urllib.request.urlopen('http://localhost:5000/ready', timeout=5)"
        ],
        "timeout": "10s"
      },
      "image": "sha256:918f66317b650c559bcc07e4b38d48820902c05233fb0298ac24b8fe7c963d6d",
      "init": true,
      "networks": {
        "default": null
      },
      "ports": [
        {
          "host_ip": "127.0.0.1",
          "mode": "ingress",
          "protocol": "tcp",
          "published": "35000",
          "target": 5000
        }
      ],
      "restart": "on-failure:3",
      "runtime": "nvidia",
      "stop_grace_period": "1m15s",
      "volumes": [
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/configs",
          "target": "/etc/contextra",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "source": "/data/contextra/runtime",
          "target": "/var/lib/contextra/runtime",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/training/contextra/models/active-medium",
          "target": "/opt/contextra/models/triton",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "source": "/backup/contextra/artifacts",
          "target": "/data/contextra/artifacts",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/bridge/control-token",
          "target": "/run/bridge/control-token",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/bridge/relay-token",
          "target": "/run/bridge/relay-token",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/camera-template.json",
          "target": "/run/bridge-config/camera-template.json",
          "type": "bind"
        }
      ]
    },
    "postgresql": {
      "command": null,
      "entrypoint": null,
      "environment": {
        "POSTGRES_DB": "contextra",
        "POSTGRES_PASSWORD": "fixture-not-a-real-credential",
        "POSTGRES_USER": "contextra"
      },
      "healthcheck": {
        "interval": "10s",
        "retries": 5,
        "start_period": "20s",
        "test": [
          "CMD-SHELL",
          "pg_isready -U \"$$$$POSTGRES_USER\" -d \"$$$$POSTGRES_DB\" || exit 1"
        ],
        "timeout": "5s"
      },
      "image": "postgres:16-alpine",
      "networks": {
        "default": null
      },
      "restart": "unless-stopped",
      "volumes": [
        {
          "source": "postgres_data",
          "target": "/var/lib/postgresql/data",
          "type": "volume",
          "volume": {}
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/workspace/contextra-analytics-runtime-lifecycle-refactor/docker/init-db.sql",
          "target": "/docker-entrypoint-initdb.d/01_init.sql",
          "type": "bind"
        }
      ]
    },
    "redis": {
      "command": [
        "redis-server",
        "/usr/local/etc/redis/redis.conf",
        "--maxmemory",
        "2gb",
        "--maxmemory-policy",
        "allkeys-lru",
        "--save",
        ""
      ],
      "entrypoint": null,
      "environment": {
        "REDIS_HEALTH_PASSWORD": "fixture-not-a-real-credential"
      },
      "healthcheck": {
        "interval": "10s",
        "retries": 5,
        "start_period": "10s",
        "test": [
          "CMD-SHELL",
          "REDISCLI_AUTH=\"$$$$REDIS_HEALTH_PASSWORD\" redis-cli --user contextra_health ping"
        ],
        "timeout": "5s"
      },
      "image": "redis:7-alpine",
      "networks": {
        "default": null
      },
      "ports": [
        {
          "host_ip": "192.168.30.70",
          "mode": "ingress",
          "protocol": "tcp",
          "published": "16379",
          "target": 6379
        }
      ],
      "restart": "unless-stopped",
      "volumes": [
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/redis/redis.conf",
          "target": "/usr/local/etc/redis/redis.conf",
          "type": "bind"
        },
        {
          "bind": {
            "create_host_path": false
          },
          "read_only": true,
          "source": "/data/contextra/site/redis/users.acl",
          "target": "/usr/local/etc/redis/users.acl",
          "type": "bind"
        }
      ]
    }
  },
  "volumes": {
    "postgres_data": {
      "name": "contextra-icerti_postgres_data"
    }
  }
}
