Refactor Nomad job configuration for nomad-mcp service
This commit is contained in:
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
job "nomad-mcp" {
|
job "nomad-mcp" {
|
||||||
datacenters = ["dc1"]
|
datacenters = ["jm"]
|
||||||
type = "service"
|
type = "service"
|
||||||
namespace = "development"
|
namespace = "development"
|
||||||
|
|
||||||
@ -16,52 +16,43 @@ job "nomad-mcp" {
|
|||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "python:3.11-slim"
|
image = "registry.dev.meisheng.group/nomad_mcp:20250226"
|
||||||
ports = ["http"]
|
ports = ["http"]
|
||||||
command = "python"
|
command = "python"
|
||||||
args = ["-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
args = ["-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
}
|
||||||
mount {
|
|
||||||
type = "bind"
|
# Pull code from Gitea
|
||||||
source = "local/nomad_mcp"
|
artifact {
|
||||||
target = "/app"
|
source = "git::ssh://git@gitea.service.mesh:2222/Mei_Sheng_Textiles/nomad_mcp.git"
|
||||||
readonly = false
|
destination = "local/nomad_mcp"
|
||||||
|
options {
|
||||||
|
ref = "main" # or whichever branch/tag you want to use
|
||||||
|
sshkey = "LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0KYjNCbGJuTnphQzFyWlhrdGRqRUFBQUFBQkc1dmJtVUFBQUFFYm05dVpRQUFBQUFBQUFBQkFBQUFNd0FBQUF0emMyZ3RaVwpReU5UVXhPUUFBQUNBY01oYkNPVXhFOHBYQ3d5UEh0ZFR4aThHU0pzNEdTNXZ6ZTR6Tm1ueUYvUUFBQUtCQm5RZi9RWjBICi93QUFBQXR6YzJndFpXUXlOVFV4T1FBQUFDQWNNaGJDT1V4RThwWEN3eVBIdGRUeGk4R1NKczRHUzV2emU0ek5tbnlGL1EKQUFBRURreWwzQlZlek9YUWZUNzZac0NkYTZPNTFnMExsb25EMEd6L2Y4SHh3dzRCd3lGc0k1VEVUeWxjTERJOGUxMVBHTAp3WkltemdaTG0vTjdqTTJhZklYOUFBQUFHR1JsY0d4dmVTQnJaWGtnWm05eUlHNXZiV0ZrWDIxamNBRUNBd1FGCi0tLS0tRU5EIE9QRU5TU0ggUFJJVkFURSBLRVktLS0tLQo="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact {
|
|
||||||
source = "git::https://gitea.dev.meisheng.group/nkohl/nomad_mcp.git"
|
|
||||||
destination = "local/nomad_mcp"
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
env {
|
||||||
|
# Nomad connection settings
|
||||||
NOMAD_ADDR = "http://pjmldk01.ds.meisheng.group:4646"
|
NOMAD_ADDR = "http://pjmldk01.ds.meisheng.group:4646"
|
||||||
NOMAD_NAMESPACE = "development"
|
NOMAD_NAMESPACE = "development"
|
||||||
LOG_LEVEL = "DEBUG"
|
NOMAD_SKIP_VERIFY = "true"
|
||||||
PYTHONPATH = "/app"
|
|
||||||
|
# API settings
|
||||||
|
PORT = "8000"
|
||||||
|
HOST = "0.0.0.0"
|
||||||
|
|
||||||
|
# Logging level
|
||||||
|
LOG_LEVEL = "INFO"
|
||||||
|
|
||||||
|
# Enable to make development easier
|
||||||
|
RELOAD = "true"
|
||||||
|
|
||||||
|
# Set PYTHONPATH to include the app directory
|
||||||
|
PYTHONPATH = "/local/nomad_mcp"
|
||||||
STATIC_DIR = "/local/nomad_mcp/static"
|
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 {
|
resources {
|
||||||
cpu = 200
|
cpu = 200
|
||||||
memory = 256
|
memory = 256
|
||||||
@ -73,7 +64,8 @@ EOH
|
|||||||
tags = [
|
tags = [
|
||||||
"traefik.enable=true",
|
"traefik.enable=true",
|
||||||
"traefik.http.routers.nomad-mcp.entryPoints=https",
|
"traefik.http.routers.nomad-mcp.entryPoints=https",
|
||||||
"traefik.http.routers.nomad-mcp.rule=Host(`nomad_mcp.dev.meisheng.group`)"
|
"traefik.http.routers.nomad-mcp.rule=Host(`nomad_mcp.dev.meisheng.group`)",
|
||||||
|
"traefik.http.routers.nomad-mcp.middlewares=proxyheaders@consulcatalog"
|
||||||
]
|
]
|
||||||
|
|
||||||
check {
|
check {
|
||||||
@ -81,6 +73,11 @@ EOH
|
|||||||
path = "/api/health"
|
path = "/api/health"
|
||||||
interval = "10s"
|
interval = "10s"
|
||||||
timeout = "2s"
|
timeout = "2s"
|
||||||
|
|
||||||
|
check_restart {
|
||||||
|
limit = 3
|
||||||
|
grace = "60s"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user