Created
July 30, 2020 23:39
-
-
Save codyde/f82015c03997704f546628ef5f6a1085 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
job "frontend" { | |
datacenters = ["humblelabvm"] | |
group "frontend" { | |
network { | |
mode = "bridge" | |
port "web" { | |
to = 80 | |
} | |
} | |
service { | |
name = "frontend" | |
port = "web" | |
connect { | |
sidecar_service { | |
proxy { | |
upstreams { | |
destination_name = "api" | |
local_bind_port = 5000 | |
} | |
} | |
} | |
} | |
} | |
update { | |
max_parallel = 2 | |
min_healthy_time = "30s" | |
healthy_deadline = "9m" | |
} | |
count = 3 | |
task "server" { | |
driver = "docker" | |
config { | |
image = "codydearkland/frontend-v4:latest" | |
volumes = [ | |
"local2:/etc/nginx/conf.d", | |
] | |
} | |
template { | |
data = <<EOF | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name localhost; | |
#charset koi8-r; | |
#access_log /var/log/nginx/host.access.log main; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
location /api { | |
proxy_pass http://localhost:5000/api; | |
proxy_read_timeout 300s; | |
proxy_connect_timeout 75s; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $http_connection; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
location /socket.io { | |
proxy_http_version 1.1; | |
proxy_buffering off; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "Upgrade"; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
proxy_pass http://localhost:5000/socket.io; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} | |
EOF | |
destination = "local2/load-balancer.conf" | |
change_mode = "signal" | |
change_signal = "SIGHUP" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment