docker-hashtopolis-server icon indicating copy to clipboard operation
docker-hashtopolis-server copied to clipboard

Database Connections Fails

Open nonlinearsugar opened this issue 3 years ago • 1 comments

I wasn't able to connect to my database with my docker compose file. I received the error: "php_network_getaddresses: getaddrinfo failed: Name or service not known"

I ended up having to hard code my database parameters into /var/www/html/inc/conf.php and setting the INSTALL mode to false. Following this I was able to establish a DB connection and complete setup.

Here's the compose file (usernames and passwords intentionally blanked out):

version:  '3.3' services:    hashtopolis:        container_name:  hashtopolis        image:  kpeiruza/hashtopolis:latest        restart:  unless-stopped        environment:            MYSQL_HOST:  mariadb10            MYSQL_PORT:  3306            MYSQL_DB:  hashtopolis            MYSQL_USER:  <REDACTED>            MYSQL_PASSWORD:  <REDACTED>            H8_USER:  <REDACTED>            H8_PASS:  <REDACTED>            H8_EMAIL:  root@localhost        volumes:            -  hashtopolis_import:/var/www/html/import            -  hashtopolis_files:/var/www/html/files            -  hashtopolis_inc:/var/www/html/inc            -  hashtopolis_locks:/var/www/html/inc/utils/locks        expose:            -  '80/tcp' volumes:    hashtopolis_import:        name:  hashtopolis_import    hashtopolis_files:        name:  hashtopolis_files    hashtopolis_inc:        name:  hashtopolis_inc    hashtopolis_locks:        name:  hashtopolis_locks networks:    default:        external:            name:  nginx-proxy

nonlinearsugar avatar Aug 27 '22 21:08 nonlinearsugar

I ended up having to hard code my database parameters into /var/www/html/inc/conf.php and setting the INSTALL mode to false. Following this I was able to establish a DB connection and complete setup.

Hardcoding the variables isn't necessary. The real fix is switching to MariaDB, which solves all the MySQL problems. You'll have to wait a little after initial startup (up to a few minutes, depending on your system) for it to create the initial DB and prune the /install folder. After that, you're golden.

You should be able to monitor progress with docker logs <HTP CONTAINER NAME> -f. It'll tell you when it's pruned the /install folder. Not need for hardcoding anything. You'll need to change some permissions on your mapped volumes, though, or else it might not let you upload files.

I've put in a PR with some changes (including some additional environment parameters) to get a working setup.

ETA: PR was merged. The docker-compose.yaml as is now should work just fine, without any workarounds. This issue can probably be closed.

Gitoffomalawn avatar May 05 '23 10:05 Gitoffomalawn