Skip to content

Instantly share code, notes, and snippets.

@thuongnn
Last active June 22, 2021 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thuongnn/0bf1186c04e9d34ccf4f0bb815dabcfe to your computer and use it in GitHub Desktop.
Save thuongnn/0bf1186c04e9d34ccf4f0bb815dabcfe to your computer and use it in GitHub Desktop.
demo init config
job "http-echo" {
datacenters = ["dc1"]
group "echo" {
count = 1
task "server" {
driver = "docker"
config {
image = "hashicorp/http-echo:latest"
ports = [
"http"]
args = [
"-listen",
":8080",
"-text",
"Hello World!",
]
}
}
network {
mode = "bridge"
port "http" {
static = 8080
to = 8080
}
}
service {
name = "http-echo"
port = "http"
check {
type = "http"
path = "/health"
interval = "2s"
timeout = "2s"
}
}
}
}
job "http-echo" {
datacenters = [
"dc1"]
group "echo" {
count = 1
task "server" {
driver = "docker"
config {
image = "hashicorp/http-echo:latest"
ports = [
"http"]
args = [
"-listen",
":8080",
"-text",
"Hello World!",
]
}
artifact {
source = "http://127.0.0.1:8500/v1/kv/app/portal/nginx.conf?raw=true"
// headers {
// X-Consul-Token = "de62211f-db02-a0f5-9be1-a967cd46793b"
// }
}
template {
source = "local/nginx.conf"
destination = "local/test.conf"
}
}
network {
mode = "bridge"
port "http" {
static = 8080
to = 8080
}
}
service {
name = "http-echo"
port = "http"
check {
type = "http"
path = "/health"
interval = "2s"
timeout = "2s"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment