70 lines
1.1 KiB
HCL
70 lines
1.1 KiB
HCL
job "mysql-server" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
group "mysql-server" {
|
|
count = 1
|
|
# Some affinity to stateful hosts?
|
|
|
|
restart {
|
|
attempts = 10
|
|
interval = "5m"
|
|
delay = "25s"
|
|
mode = "delay"
|
|
}
|
|
|
|
network {
|
|
mode = "bridge"
|
|
port "db" {
|
|
static = 3306
|
|
}
|
|
}
|
|
|
|
volume "mysql-data" {
|
|
type = "host"
|
|
read_only = false
|
|
source = "mysql-data"
|
|
}
|
|
|
|
service {
|
|
name = "mysql-server"
|
|
port = "db"
|
|
|
|
connect {
|
|
sidecar_service {}
|
|
}
|
|
|
|
# check {
|
|
# type = "tcp"
|
|
# interval = "10s"
|
|
# timeout = "2s"
|
|
# }
|
|
}
|
|
|
|
task "mysql-server" {
|
|
driver = "docker"
|
|
|
|
volume_mount {
|
|
volume = "mysql-data"
|
|
destination = "/var/lib/mysql"
|
|
read_only = false
|
|
}
|
|
|
|
env = {
|
|
"MYSQL_ROOT_PASSWORD" = "supersecretpassword"
|
|
"MYSQL_ROOT_HOST" = "%"
|
|
}
|
|
|
|
config {
|
|
image = "mysql:8"
|
|
ports = ["db"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 500
|
|
memory = 1024
|
|
}
|
|
}
|
|
}
|
|
}
|