96 lines
2.1 KiB
HCL
96 lines
2.1 KiB
HCL
job "nomad-mcp" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
namespace = "development"
|
|
|
|
group "app" {
|
|
count = 1
|
|
|
|
network {
|
|
port "http" {
|
|
to = 8000
|
|
}
|
|
}
|
|
|
|
task "nomad-mcp" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "python:3.11-slim"
|
|
ports = ["http"]
|
|
command = "python"
|
|
args = ["-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
mount {
|
|
type = "bind"
|
|
source = "local/nomad_mcp"
|
|
target = "/app"
|
|
readonly = false
|
|
}
|
|
}
|
|
|
|
artifact {
|
|
source = "git::https://gitea.dev.meisheng.group/nkohl/nomad_mcp.git"
|
|
destination = "local/nomad_mcp"
|
|
}
|
|
|
|
env {
|
|
NOMAD_ADDR = "http://pjmldk01.ds.meisheng.group:4646"
|
|
NOMAD_NAMESPACE = "development"
|
|
LOG_LEVEL = "DEBUG"
|
|
PYTHONPATH = "/app"
|
|
STATIC_DIR = "/local/nomad_mcp/static"
|
|
}
|
|
|
|
# Add a template to create the static directory if it doesn't exist
|
|
template {
|
|
data = <<EOH
|
|
#!/bin/bash
|
|
echo "Ensuring static directory exists at ${STATIC_DIR}"
|
|
mkdir -p ${STATIC_DIR}
|
|
chmod -R 755 ${STATIC_DIR}
|
|
echo "Static directory setup complete"
|
|
EOH
|
|
destination = "local/setup_static.sh"
|
|
perms = "755"
|
|
}
|
|
|
|
# Run the setup script before starting the application
|
|
lifecycle {
|
|
hook = "prestart"
|
|
command = "/bin/bash"
|
|
args = ["local/setup_static.sh"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 200
|
|
memory = 256
|
|
}
|
|
|
|
service {
|
|
name = "nomad-mcp"
|
|
port = "http"
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.nomad-mcp.entryPoints=https",
|
|
"traefik.http.routers.nomad-mcp.rule=Host(`nomad_mcp.dev.meisheng.group`)"
|
|
]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/api/health"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Define update strategy
|
|
update {
|
|
max_parallel = 1
|
|
min_healthy_time = "30s"
|
|
healthy_deadline = "5m"
|
|
auto_revert = true
|
|
}
|
|
} |