update deploy_nomad_mcp

This commit is contained in:
2025-02-26 16:10:35 +07:00
parent baf1723a50
commit 5c619e1f19
3 changed files with 49 additions and 3 deletions

View File

@ -52,8 +52,26 @@ def read_job_spec(file_path):
"image": "registry.dev.meisheng.group/nomad_mcp:20250226",
"ports": ["http"],
"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",
"source": "local/nomad_mcp",
"target": "/app",
"readonly": False
}
]
},
"Artifacts": [
{
"source": "git::ssh://git@gitea.service.mesh:2222/Mei_Sheng_Textiles/nomad_mcp.git",
"destination": "local/nomad_mcp",
"options": {
"ref": "main",
"sshkey": "LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0KYjNCbGJuTnphQzFyWlhrdGRqRUFBQUFBQkc1dmJtVUFBQUFFYm05dVpRQUFBQUFBQUFBQkFBQUFNd0FBQUF0emMyZ3RaVwpReU5UVXhPUUFBQUNBY01oYkNPVXhFOHBYQ3d5UEh0ZFR4aThHU0pzNEdTNXZ6ZTR6Tm1ueUYvUUFBQUtCQm5RZi9RWjBICi93QUFBQXR6YzJndFpXUXlOVFV4T1FBQUFDQWNNaGJDT1V4RThwWEN3eVBIdGRUeGk4R1NKczRHUzV2emU0ek5tbnlGL1EKQUFBRURreWwzQlZlek9YUWZUNzZac0NkYTZPNTFnMExsb25EMEd6L2Y4SHh3dzRCd3lGc0k1VEVUeWxjTEREOGUxMVBHTAp3WkltemdaTG0vTjdqTTJhZklYOUFBQUFHR1JsY0d4dmVTQnJaWGtnWm05eUlHNXZiV0ZrWDIxamNBRUNBd1FGCi0tLS0tRU5EIE9QRU5TU0ggUFJJVkFURSBLRVktLS0tLQo="
}
}
],
"Env": {
"NOMAD_ADDR": "http://pjmldk01.ds.meisheng.group:4646",
"NOMAD_NAMESPACE": "development",
@ -61,7 +79,8 @@ def read_job_spec(file_path):
"PORT": "8000",
"HOST": "0.0.0.0",
"LOG_LEVEL": "INFO",
"RELOAD": "true"
"RELOAD": "true",
"PYTHONPATH": "/app"
},
"Resources": {
"CPU": 200,

View File

@ -43,7 +43,8 @@ def main():
"PORT": "8000",
"HOST": "0.0.0.0",
"LOG_LEVEL": "INFO",
"RELOAD": "true"
"RELOAD": "true",
"PYTHONPATH": "/app"
},
# Note: The Claude API doesn't directly support command and args,
# so we'll need to add a note about this limitation
@ -82,6 +83,11 @@ def main():
print(" You need to update the job manually to add the following:")
print(" - command: python")
print(" - args: [\"-m\", \"uvicorn\", \"app.main:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]")
print("\n3. The Claude API doesn't support Gitea artifact configuration.")
print(" You need to update the job manually to add the following:")
print(" - artifact source: git::ssh://git@gitea.service.mesh:2222/Mei_Sheng_Textiles/nomad_mcp.git")
print(" - artifact destination: local/nomad_mcp")
print(" - mount configuration to bind local/nomad_mcp to /app")
else:
print("\n❌ Failed to deploy Nomad MCP service.")
print(f"Message: {result.get('message', 'Unknown error')}")

View File

@ -20,6 +20,24 @@ job "nomad-mcp" {
ports = ["http"]
command = "python"
args = ["-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
# Mount the local directory containing the code
mount {
type = "bind"
source = "local/nomad_mcp"
target = "/app"
readonly = false
}
}
# Pull code from Gitea
artifact {
source = "git::ssh://git@gitea.service.mesh:2222/Mei_Sheng_Textiles/nomad_mcp.git"
destination = "local/nomad_mcp"
options {
ref = "main" # or whichever branch/tag you want to use
sshkey = "LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0KYjNCbGJuTnphQzFyWlhrdGRqRUFBQUFBQkc1dmJtVUFBQUFFYm05dVpRQUFBQUFBQUFBQkFBQUFNd0FBQUF0emMyZ3RaVwpReU5UVXhPUUFBQUNBY01oYkNPVXhFOHBYQ3d5UEh0ZFR4aThHU0pzNEdTNXZ6ZTR6Tm1ueUYvUUFBQUtCQm5RZi9RWjBICi93QUFBQXR6YzJndFpXUXlOVFV4T1FBQUFDQWNNaGJDT1V4RThwWEN3eVBIdGRUeGk4R1NKczRHUzV2emU0ek5tbnlGL1EKQUFBRURreWwzQlZlek9YUWZUNzZac0NkYTZPNTFnMExsb25EMEd6L2Y4SHh3dzRCd3lGc0k1VEVUeWxjTEREOGUxMVBHTAp3WkltemdaTG0vTjdqTTJhZklYOUFBQUFHR1JsY0d4dmVTQnJaWGtnWm05eUlHNXZiV0ZrWDIxamNBRUNBd1FGCi0tLS0tRU5EIE9QRU5TU0ggUFJJVkFURSBLRVktLS0tLQo="
}
}
env {
@ -37,6 +55,9 @@ job "nomad-mcp" {
# Enable to make development easier
RELOAD = "true"
# Set PYTHONPATH to include the app directory
PYTHONPATH = "/app"
}
resources {