nomad to the max
This commit is contained in:
45
test/demo-webapp.hcl
Normal file
45
test/demo-webapp.hcl
Normal file
@@ -0,0 +1,45 @@
|
||||
job "demo-webapp" {
|
||||
datacenters = ["dc1"]
|
||||
|
||||
group "demo" {
|
||||
count = 3
|
||||
|
||||
network {
|
||||
port "http"{
|
||||
to = -1
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "demo-webapp"
|
||||
port = "http"
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"#traefik.http.routers.http.rule=Path(`/myapp`)",
|
||||
"traefik.http.routers.http.rule=Host(`test.lan`)",
|
||||
]
|
||||
|
||||
check {
|
||||
type = "http"
|
||||
path = "/"
|
||||
interval = "2s"
|
||||
timeout = "2s"
|
||||
}
|
||||
}
|
||||
|
||||
task "server" {
|
||||
env {
|
||||
PORT = "${NOMAD_PORT_http}"
|
||||
NODE_IP = "${NOMAD_IP_http}"
|
||||
}
|
||||
|
||||
driver = "podman"
|
||||
|
||||
config {
|
||||
image = "docker.io/hashicorp/demo-webapp-lb-guide"
|
||||
ports = ["http"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
test/nfs-volume.hcl
Normal file
18
test/nfs-volume.hcl
Normal file
@@ -0,0 +1,18 @@
|
||||
type = "csi"
|
||||
id = "test"
|
||||
name = "test"
|
||||
plugin_id = "nfsofficial"
|
||||
external_id = "testid"
|
||||
capability {
|
||||
access_mode = "multi-node-multi-writer"
|
||||
attachment_mode = "file-system"
|
||||
}
|
||||
context {
|
||||
server = "192.168.10.3"
|
||||
share = "/srv/pub/Music"
|
||||
mountPermissions = "0"
|
||||
}
|
||||
mount_options {
|
||||
fs_type = "nfs"
|
||||
mount_flags = [ "timeo=30", "intr", "vers=3", "_netdev" , "nolock" ]
|
||||
}
|
||||
55
test/nginx-lb.hcl
Normal file
55
test/nginx-lb.hcl
Normal file
@@ -0,0 +1,55 @@
|
||||
job "nginx" {
|
||||
datacenters = ["dc1"]
|
||||
|
||||
group "nginx" {
|
||||
count = 1
|
||||
|
||||
network {
|
||||
port "http" {
|
||||
static = 80
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "nginx"
|
||||
port = "http"
|
||||
}
|
||||
|
||||
task "nginx" {
|
||||
driver = "podman"
|
||||
|
||||
config {
|
||||
image = "docker.io/nginx"
|
||||
|
||||
ports = ["http"]
|
||||
|
||||
volumes = [
|
||||
"local:/etc/nginx/conf.d",
|
||||
]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<EOF
|
||||
upstream backend {
|
||||
{{ range service "demo-webapp" }}
|
||||
server {{ .Address }}:{{ .Port }};
|
||||
{{ else }}server 127.0.0.1:65535; # force a 502
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
destination = "local/load-balancer.conf"
|
||||
change_mode = "signal"
|
||||
change_signal = "SIGHUP"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user