# Docker Compose Platform Stack - Solo Mode
# Imports configuration from values/orchestrator.solo.ncl and control-center.solo.ncl
# Exports to JSON, then converted to YAML by render-docker-compose.nu
# Usage: nickel export --format json platform-stack.solo.yml.ncl | yq -P

{
  version = "3.8",

  services = {
    orchestrator = {
      image = "provisioning-orchestrator:latest",
      container_name = "orchestrator",
      ports = [
        "9090:9090",
      ],
      environment = {
        ORCHESTRATOR_MODE = "solo",
        ORCHESTRATOR_SERVER_HOST = "0.0.0.0",
        ORCHESTRATOR_SERVER_PORT = "9090",
        ORCHESTRATOR_STORAGE_BACKEND = "filesystem",
        ORCHESTRATOR_STORAGE_PATH = "/var/lib/provisioning/orchestrator/data",
        ORCHESTRATOR_LOG_LEVEL = "info",
      },
      volumes = [
        "orchestrator_data:/var/lib/provisioning/orchestrator/data",
        "orchestrator_logs:/var/log/provisioning/orchestrator",
      ],
      networks = ["provisioning"],
      restart = "unless-stopped",
      healthcheck = {
        test = ["CMD", "curl", "-f", "http://localhost:9090/health"],
        interval = "30s",
        timeout = "10s",
        retries = 3,
        start_period = "40s",
      },
    },

    control-center = {
      image = "provisioning-control-center:latest",
      container_name = "control-center",
      ports = [
        "8080:8080",
      ],
      environment = {
        CONTROL_CENTER_MODE = "solo",
        CONTROL_CENTER_SERVER_HOST = "0.0.0.0",
        CONTROL_CENTER_SERVER_PORT = "8080",
        CONTROL_CENTER_DATABASE = "rocksdb",
        CONTROL_CENTER_DATABASE_PATH = "/var/lib/provisioning/control-center/db",
        CONTROL_CENTER_LOG_LEVEL = "info",
      },
      volumes = [
        "control_center_data:/var/lib/provisioning/control-center/db",
        "control_center_logs:/var/log/provisioning/control-center",
      ],
      networks = ["provisioning"],
      restart = "unless-stopped",
      depends_on = {
        orchestrator = {
          condition = "service_healthy",
        },
      },
      healthcheck = {
        test = ["CMD", "curl", "-f", "http://localhost:8080/health"],
        interval = "30s",
        timeout = "10s",
        retries = 3,
        start_period = "40s",
      },
    },

    mcp-server = {
      image = "provisioning-mcp-server:latest",
      container_name = "mcp-server",
      ports = [
        "8888:8888",
      ],
      environment = {
        MCP_SERVER_MODE = "solo",
        MCP_SERVER_HOST = "0.0.0.0",
        MCP_SERVER_PORT = "8888",
        MCP_SERVER_PROTOCOL = "stdio",
        MCP_SERVER_LOG_LEVEL = "info",
      },
      volumes = [
        "mcp_server_logs:/var/log/provisioning/mcp-server",
      ],
      networks = ["provisioning"],
      restart = "unless-stopped",
      depends_on = ["orchestrator", "control-center"],
      healthcheck = {
        test = ["CMD", "curl", "-f", "http://localhost:8888/health"],
        interval = "30s",
        timeout = "10s",
        retries = 3,
        start_period = "40s",
      },
    },
  },

  volumes = {
    orchestrator_data = null,
    orchestrator_logs = null,
    control_center_data = null,
    control_center_logs = null,
    mcp_server_logs = null,
  },

  networks = {
    provisioning = {
      driver = "bridge",
    },
  },
}
