Created
June 1, 2019 10:48
-
-
Save darkslategrey/6b131bbea2924c7b74a3557806abd811 to your computer and use it in GitHub Desktop.
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
job "api" { | |
datacenters = ["dc1"] | |
type = "service" | |
update { | |
max_parallel = 1 | |
min_healthy_time = "10s" | |
healthy_deadline = "3m" | |
progress_deadline = "10m" | |
auto_revert = false | |
canary = 0 | |
} | |
migrate { | |
max_parallel = 1 | |
health_check = "checks" | |
min_healthy_time = "10s" | |
healthy_deadline = "5m" | |
} | |
group "api" { | |
count = 1 | |
restart { | |
attempts = 2 | |
interval = "30m" | |
delay = "15s" | |
mode = "fail" | |
} | |
ephemeral_disk { | |
size = 300 | |
} | |
task "api" { | |
driver = "docker" | |
# | |
config { | |
image = "app" | |
dns_servers = ["172.17.0.1"] | |
port_map { | |
api = 3000 | |
} | |
} | |
template { | |
data = <<EOH | |
DB_HOST="{{ range service "db" }}{{ .Address }}{{ end }}" | |
DB_PORT="{{ range service "db" }}{{ .Port }}{{ end }}" | |
EOH | |
destination = "postgresql-server.env" | |
env = true | |
} | |
env { | |
POSTGRES_DB = "app" | |
POSTGRES_TEST_DB = "app_test" | |
POSTGRES_USER = "postgres" | |
POSTGRES_PASSWORD = "secret" | |
DOCKER = "true" | |
LANG = "C.UTF-8" | |
} | |
resources { | |
network { | |
mbits = 10 | |
port "api" { } | |
} | |
} | |
service { | |
name = "api" | |
tags = ["api"] | |
port = "api" | |
check { | |
name = "alive" | |
type = "tcp" | |
interval = "10s" | |
timeout = "2s" | |
} | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment