job "mysql-server" { datacenters = ["dc1"] type = "service" priority = 80 group "mysql-server" { count = 1 restart { attempts = 10 interval = "5m" delay = "25s" mode = "delay" } network { mode = "bridge" port "db" { host_network = "loopback" to = 3306 } port "envoy_metrics" { to = 9123 } } volume "mysql-data" { type = "host" read_only = false source = "mysql-data" } service { name = "mysql-server" port = "db" connect { sidecar_service { proxy { local_service_port = 3306 config { envoy_prometheus_bind_addr = "0.0.0.0:9123" } } } sidecar_task { resources { cpu = 50 memory = 50 } } } meta { envoy_metrics_addr = "${NOMAD_ADDR_envoy_metrics}" } } task "mysql-server" { driver = "docker" config { image = "mariadb:10" ports = ["db"] args = ["--innodb-buffer-pool-size=1G"] } vault { policies = [ "access-tables", "nomad-task", ] } volume_mount { volume = "mysql-data" destination = "/var/lib/mysql" read_only = false } env = { # Allow connections from any host "MYSQL_ROOT_HOST" = "%" } template { data = <