-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nginx): initial commit of nginx job fix(nginx): add migrate and update stanzas --------- Signed-off-by: Bruce Becker <[email protected]>
- Loading branch information
1 parent
221383a
commit 5fcf07d
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
job "nginx" { | ||
datacenters = ["dc1"] | ||
update { | ||
max_parallel = 2 | ||
health_check = "checks" | ||
min_healthy_time = "10s" | ||
healthy_deadline = "5m" | ||
progress_deadline = "10m" | ||
auto_revert = true | ||
auto_promote = true | ||
canary = 1 | ||
stagger = "30s" | ||
} | ||
migrate { | ||
max_parallel = 1 | ||
health_check = "checks" | ||
min_healthy_time = "10s" | ||
healthy_deadline = "5m" | ||
} | ||
group "nginx" { | ||
count = 1 | ||
|
||
network { | ||
mode = "bridge" | ||
port "http" { static = 80 } | ||
} | ||
|
||
service { | ||
name = "nginx" | ||
port = "http" | ||
// connect { | ||
// sidecar_service { | ||
// disable_default_tcp_check = true | ||
// } | ||
// } | ||
check { | ||
name = "nginx_alive" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "1s" | ||
} | ||
|
||
check { | ||
name = "nginx_http_alive" | ||
type = "http" | ||
port = "http" | ||
path = "/nginx_status" | ||
interval = "5s" | ||
timeout = "2s" | ||
} | ||
} | ||
|
||
task "nginx" { | ||
driver = "docker" | ||
resources { | ||
cpu = 1000 | ||
memory = 512 | ||
} | ||
config { | ||
image = "nginx:stable-alpine-slim" | ||
// privileged = true | ||
ports = ["http"] | ||
network_mode = "bridge" | ||
volumes = [ | ||
"local:/etc/nginx/conf.d", | ||
] | ||
} | ||
|
||
template { | ||
data = <<EOF | ||
upstream backend { | ||
{{ range service "promtail" }} | ||
server {{ .Address }}:{{ .Port }}; | ||
{{ else }}server 127.0.0.1:65535; # force a 502 | ||
{{ end }} | ||
} | ||
server { | ||
listen 80; | ||
location /nginx_status { | ||
stub_status on; | ||
allow 127.0.0.1; | ||
} | ||
location /promtail { | ||
proxy_pass http://backend; | ||
} | ||
} | ||
EOF | ||
destination = "local/load-balancer.conf" | ||
change_mode = "signal" | ||
change_signal = "SIGHUP" | ||
} | ||
} | ||
} | ||
} |