Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rancher with postgresql

Tags:

docker

rancher

I'm trying to run Rancher as a container using a postgresql database, instead of the Rancher database. In the documentation (http://docs.rancher.com/rancher/installing-rancher/installing-server/) is written that you can use an external database but it mentions only mysql. I was wondering if it is possible to use another external database like postgresql. So, i tried starting the container with the below command pointing it to the postgresql database running on the same host as the container:

docker run -d --restart=always -p 8080:8080 -e CATTLE_DB_CATTLE_MYSQL_HOST=127.0.0.1 -e CATTLE_DB_CATTLE_MYSQL_PORT=5432 -e CATTLE_DB_CATTLE_MYSQL_NAME=db_name -e CATTLE_DB_CATTLE_USERNAME=db_user -e CATTLE_DB_CATTLE_PASSWORD=some_password rancher/server

The above results in the container starting up but without using the postgresql database which i'm telling it to use. It uses instead the Rancher database.

Tried also with the below but still the same results:

docker run -d --restart=always -p 8080:8080 -e CATTLE_DB_CATTLE_HOST=127.0.0.1 -e CATTLE_DB_CATTLE_PORT=5432 -e CATTLE_DB_CATTLE_NAME=db_name -e CATTLE_DB_CATTLE_USERNAME=db_user -e CATTLE_DB_CATTLE_PASSWORD=some_password rancher/server

I'm thinking that either the arguments that i've passed are wrong, or Rancher supports only mysql as an external database.

Any ideas/suggestions ?

Thank you,

like image 960
Pier Avatar asked Nov 08 '25 00:11

Pier


1 Answers

MySQL is the only supported database. (and H2, for integration tests)

All the database interaction is through abstractions that are theoretically database-agnostic, but we don't package the driver for or ever test against Postgres. According to this old PR there are a bunch of small issues with things like the the column type names that would have to be addressed. To attempt to use it you would have to set CATTLE_DB_CATTLE_DATABASE=postgres, what you're doing now is trying to connect the MySQL (actually MariaDB) client to a Postgres port and they have no idea how to talk to each other.

like image 113
Vincent Fiduccia Avatar answered Nov 10 '25 12:11

Vincent Fiduccia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!