Hi there !
I have a MariaDB database installed directly on a host and a Nomad cluster hosting a phpMyAdmin. Both hosts are inside the same Consul cluster.
I’m having some issues trying to connect the phpMyAdmin to my database.
phpMyAdmin returns the error:
mysqli::real_connect(): Error while reading greeting packet. PID=26
Here’s the config file for the phpMyAdmin job
job "pma" {
datacenters = ["nomeau"]
region = "OVH"
type = "service"
group "pma"{
count = 1
network {
mode = "bridge"
port "http" {
static = 8083
to = 80
}
}
service {
name = "pma"
port = "http"
connect {
sidecar_task {
config {
#Have to st privileged true to avoid crashes and error
#su: cannot set groups: Operation not permitted at envoy setup
privileged = true
args = [
"-c",
"${NOMAD_SECRETS_DIR}/envoy_bootstrap.json",
"-l",
"debug",
"--concurrency",
"${meta.connect.proxy_concurrency}",
"--disable-hot-restart"
]
}
}
sidecar_service {
proxy {
upstreams {
destination_name = "bdd"
local_bind_port = 3306
}
}
}
}
}
task "phpMyAdmin" {
driver = "docker"
env = {
PMA_HOST = "127.0.0.1"
}
config {
image = "phpmyadmin/phpmyadmin:latest"
ports = ["http"]
privileged = true
}
}
}
}
Here’s the bdd.hcl defining the database’s service
service {
name = "bdd"
id = "bdd"
port = 3006
connect {
sidecar_service {}
}
}
To start the envoy sidecar for the database, I used the following command
consul connect envoy -sidecar-for bdd -- -l debug --log-path logs/envoy.log
And you’ll find the envoy logs from the database sidecar proxy on gist here.
I think I’m just missing a simple config option but I have no idea which one.