mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
func: add python servers to raw exec workloads (#25230)
This commit is contained in:
committed by
GitHub
parent
b13132043b
commit
461d4268e2
@@ -12,24 +12,51 @@ job "batch-raw-exec" {
|
||||
group "batch-raw-exec" {
|
||||
count = var.alloc_count
|
||||
|
||||
network {
|
||||
port "server" {
|
||||
to = 0
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
provider = "consul"
|
||||
name = "batch-raw-exec"
|
||||
|
||||
check {
|
||||
name = "batch-raw-exec_probe"
|
||||
type = "http"
|
||||
path = "/index.html"
|
||||
interval = "10s"
|
||||
timeout = "1s"
|
||||
port = "server"
|
||||
}
|
||||
}
|
||||
|
||||
task "batch-raw-exec" {
|
||||
driver = "raw_exec"
|
||||
|
||||
config {
|
||||
command = "bash"
|
||||
args = ["-c", "./local/runme.sh"]
|
||||
command = "python3"
|
||||
args = ["-m", "http.server", "${NOMAD_PORT_server}", "--directory", "local"]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<EOH
|
||||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
sleep 30000
|
||||
done
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta ="UTF-8">
|
||||
<meta name="jobName" content="{{env "NOMAD_JOB_NAME"}}">
|
||||
<meta name="nodeID" content="{{env "node.unique.id"}}">
|
||||
<meta name="allocID" content="{{env "NOMAD_ALLOC_ID"}}">
|
||||
</head>
|
||||
<body>
|
||||
<h1>All good and running for {{env "NOMAD_JOB_NAME"}} at {{env "node.unique.id"}}!</h1>
|
||||
</body>
|
||||
</html>
|
||||
EOH
|
||||
destination = "local/runme.sh"
|
||||
perms = "755"
|
||||
destination = "local/index.html"
|
||||
perms = "0644"
|
||||
}
|
||||
|
||||
resources {
|
||||
|
||||
@@ -10,30 +10,52 @@ job "service-raw" {
|
||||
|
||||
group "service-raw" {
|
||||
count = var.alloc_count
|
||||
|
||||
network {
|
||||
port "server" {
|
||||
to = 0
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
provider = "consul"
|
||||
name = "service-raw-exec"
|
||||
|
||||
check {
|
||||
name = "service-raw-exec_probe"
|
||||
type = "http"
|
||||
path = "/index.html"
|
||||
interval = "10s"
|
||||
timeout = "1s"
|
||||
port = "server"
|
||||
}
|
||||
}
|
||||
|
||||
task "raw" {
|
||||
driver = "raw_exec"
|
||||
|
||||
config {
|
||||
command = "bash"
|
||||
args = ["-c", "./local/runme.sh"]
|
||||
command = "python3"
|
||||
args = ["-m", "http.server", "${NOMAD_PORT_server}", "--directory", "local"]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<EOH
|
||||
#!/bin/bash
|
||||
|
||||
sigkill_handler() {
|
||||
echo "Received SIGKILL signal. Exiting..."
|
||||
exit 0
|
||||
}
|
||||
|
||||
echo "Sleeping until SIGKILL signal is received..."
|
||||
while true; do
|
||||
sleep 300
|
||||
done
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta ="UTF-8">
|
||||
<meta name="jobName" content="{{env "NOMAD_JOB_NAME"}}">
|
||||
<meta name="nodeID" content="{{env "node.unique.id"}}">
|
||||
<meta name="allocID" content="{{env "NOMAD_ALLOC_ID"}}">
|
||||
</head>
|
||||
<body>
|
||||
<h1>All good and running for {{env "NOMAD_JOB_NAME"}} at {{env "node.unique.id"}}!</h1>
|
||||
</body>
|
||||
</html>
|
||||
EOH
|
||||
destination = "local/runme.sh"
|
||||
perms = "755"
|
||||
destination = "local/index.html"
|
||||
perms = "0644"
|
||||
}
|
||||
|
||||
resources {
|
||||
|
||||
@@ -11,24 +11,51 @@ job "system-raw-exec" {
|
||||
|
||||
group "system-raw-exec" {
|
||||
|
||||
network {
|
||||
port "server" {
|
||||
to = 0
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
provider = "consul"
|
||||
name = "system-raw-exec"
|
||||
|
||||
check {
|
||||
name = "system-raw-exec_probe"
|
||||
type = "http"
|
||||
path = "/index.html"
|
||||
interval = "10s"
|
||||
timeout = "1s"
|
||||
port = "server"
|
||||
}
|
||||
}
|
||||
|
||||
task "system-raw-exec" {
|
||||
driver = "raw_exec"
|
||||
|
||||
config {
|
||||
command = "bash"
|
||||
args = ["-c", "./local/runme.sh"]
|
||||
command = "python3"
|
||||
args = ["-m", "http.server", "${NOMAD_PORT_server}", "--directory", "local"]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<EOH
|
||||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
sleep 30000
|
||||
done
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta ="UTF-8">
|
||||
<meta name="jobName" content="{{env "NOMAD_JOB_NAME"}}">
|
||||
<meta name="nodeID" content="{{env "node.unique.id"}}">
|
||||
<meta name="allocID" content="{{env "NOMAD_ALLOC_ID"}}">
|
||||
</head>
|
||||
<body>
|
||||
<h1>All good and running for {{env "NOMAD_JOB_NAME"}} at {{env "node.unique.id"}}!</h1>
|
||||
</body>
|
||||
</html>
|
||||
EOH
|
||||
destination = "local/runme.sh"
|
||||
perms = "755"
|
||||
destination = "local/index.html"
|
||||
perms = "0644"
|
||||
}
|
||||
|
||||
resources {
|
||||
|
||||
Reference in New Issue
Block a user