MySQL config.
This commit is contained in:
68
services/mysql.hcl
Normal file
68
services/mysql.hcl
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
job "mysql" {
|
||||||
|
datacenters = ["alo"]
|
||||||
|
|
||||||
|
group "db" {
|
||||||
|
network {
|
||||||
|
port "db" {
|
||||||
|
static = 3306
|
||||||
|
}
|
||||||
|
port "exporter" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "mysqld" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "mysql:8.1"
|
||||||
|
ports = ["db"]
|
||||||
|
volumes = [ "/data/compute/appdata/mysql:/var/lib/mysql" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
MYSQL_ROOT_PASSWORD = "${var.mysql_root_password}"
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "mysql"
|
||||||
|
port = "db"
|
||||||
|
check {
|
||||||
|
type = "tcp"
|
||||||
|
port = "db"
|
||||||
|
interval = "30s"
|
||||||
|
timeout = "2s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 1000
|
||||||
|
memory = 512
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "exporter" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "prom/mysqld-exporter"
|
||||||
|
ports = ["exporter"]
|
||||||
|
args = [
|
||||||
|
"--mysqld.address=mysql.service.consul:3306",
|
||||||
|
"--mysqld.username=exporter:Veeng0Yei5haesheagai",
|
||||||
|
"--web.listen-address=0.0.0.0:${NOMAD_PORT_exporter}",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "mysql-exporter"
|
||||||
|
port = "exporter"
|
||||||
|
tags = ["metrics"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "mysql_root_password" {
|
||||||
|
type = string
|
||||||
|
default = "wiochohv8foR9eDo5ol5"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user