mriedmann / humhub-docker

Alpine-based PHP-FPM and NGINX HumHub docker-container
MIT License
95 stars 79 forks source link

Unable to connect to 'db' #302

Closed GregLeonhardt closed 1 year ago

GregLeonhardt commented 1 year ago

I attempted to change the database server name from 'db:' to something else. At startup the humhub container would fail to establish communications to 'db'. This was curious since the docker-compose.yml file contained absolutely no references to 'db'. I am guessing it is hard coded somewhere else.

mriedmann commented 1 year ago

Hi!

Not hardcoded but defined using defaults: https://github.com/mriedmann/humhub-docker/blob/master/docker-entrypoint.sh

Just add the right env variables and you should be good to go.

HUMHUB_DB_NAME=${HUMHUB_DB_NAME:-"humhub"}
HUMHUB_DB_HOST=${HUMHUB_DB_HOST:-"db"}
HUMHUB_DB_PORT=${HUMHUB_DB_PORT:-3306}
GregLeonhardt commented 1 year ago

I set the database host, password etc. during initial configuration. I should also point out that the database is being initialized with tables etc. The problem is that after initialization the application attempts to connect to 'db' when it should be connecting to 'HumHub_db'.

The following is the the docker-compose.yml file that fails.

version: '3.1' services:

HumHub_db: container_name: HumHub_db restart: unless-stopped image: mariadb:10.9.4 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: HumHub MYSQL_USER: HumHub MYSQL_PASSWORD: {REDACTED} volumes:

r4nc0r commented 1 year ago

I think you need to add the environment Variable: HUMHUB_DB_HOST=HumHub_db for the humhub service, because the default value is HUMHUB_DB_HOST=db

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.