CanastaWiki / Canasta

MediaWiki Docker image for Canasta, an all-in-one MediaWiki stack for easy deployment and management of enterprise-ready MediaWiki on production environments.
https://www.canasta.wiki
MIT License
36 stars 27 forks source link

Cannot Conncect to Database Host during setup #29

Closed irwando closed 2 years ago

irwando commented 2 years ago

I'm attempting to run this on my Synology Diskstation. I'm getting the following error during MediaWiki Setup:

Cannot access the database: :real_connect(): (HY000/1130): Host '172.24.0.4' is not allowed to connect to this MySQL server. Check the host, username and password and try again. If using "localhost" as the database host, try using "127.0.0.1" instead (or vice versa).

Notes from my install:

Is there any additional configuration needed? I believe typically mySQL does disallow remote connections by default and they need to be enabled. Is that needed here?

jeffw16 commented 2 years ago

What did you place in the _initdb directory before the first run? Did you add things to it after the first run?

irwando commented 2 years ago

I didn't put anything into it, I just created the directory. If I didn't then the container wouldn't start.

Here's my end-end process:

Irwin@DiskStation:/volume1/docker/docker-compose$ git clone https://github.com/WikiWorks/Canasta.git ./canasta/ Cloning into './canasta'... remote: Enumerating objects: 371, done. remote: Counting objects: 100% (371/371), done. remote: Compressing objects: 100% (279/279), done. remote: Total 371 (delta 204), reused 189 (delta 80), pack-reused 0 Receiving objects: 100% (371/371), 133.57 KiB | 432.00 KiB/s, done. Resolving deltas: 100% (204/204), done. Irwin@DiskStation:/volume1/docker/docker-compose$ cd canasta/ Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ ls total 116 drwxrwxrwx+ 12 Irwin users 4096 Feb 1 18:44 . drwxrwxrwx+ 16 Irwin users 4096 Feb 1 18:44 .. drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 backups drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 backup_scripts drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 config -rwxrwxrwx+ 1 Irwin users 1671 Feb 1 18:44 docker-compose.yml -rwxrwxrwx+ 1 Irwin users 36437 Feb 1 18:44 Dockerfile -rwxrwxrwx+ 1 Irwin users 158 Feb 1 18:44 .env.example drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 extensions drwxrwxrwx+ 8 Irwin users 4096 Feb 1 18:44 .git drwxrwxrwx+ 3 Irwin users 4096 Feb 1 18:44 .github -rwxrwxrwx+ 1 Irwin users 160 Feb 1 18:44 .gitignore -rwxrwxrwx+ 1 Irwin users 127 Feb 1 18:44 hadolint.yaml drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 images drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 kubernetes -rwxrwxrwx+ 1 Irwin users 11748 Feb 1 18:44 README.md drwxrwxrwx+ 2 Irwin users 4096 Feb 1 18:44 skins drwxrwxrwx+ 7 Irwin users 4096 Feb 1 18:44 _sources Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ mkdir _initdb Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ cp .env.example .env Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ vi .env Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ docker-compose pull Pulling db ... done Pulling elasticsearch ... done Pulling web ... done Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ docker-compose up -d Creating network "canasta_default" with the default driver Recreating canasta_db_1 ... done Recreating canasta_elasticsearch_1 ... done Recreating canasta_web_1 ... done Irwin@DiskStation:/volume1/docker/docker-compose/canasta$ more .env PORT=8083 MYSQL_PASSWORD=mediawiki PHP_UPLOAD_MAX_FILESIZE=10M PHP_POST_MAX_SIZE=10M PHP_MAX_INPUT_VARS=1000 MW_SITEMAP_SUBDIR= MW_SITEMAP_IDENTIFIER=mediawiki MW_SITE_SERVER=Diskstation.local Irwin@DiskStation:/volume1/docker/docker-compose/canasta$

jeffw16 commented 2 years ago

Thanks for that info. Did you change the Docker Compose file?

irwando commented 2 years ago

Nope, I left that alone. Only touched the .env file and created an empty _initdb

I am running this on a Synology Diskstation if that makes a difference. I am running about 12 other Docker containers successfully, but perhaps there is something specific to that environment?

jeffw16 commented 2 years ago

It sounds like there was a custom bridge network constructed for this, done via the CLI perhaps, since there were no modifications made to the Docker Compose manifest. Canasta can't guaranteed to run successfully if that is the case.

If there are 12 other containers already running, it may be that they are interfering with the operation of Canasta somehow.

irwando commented 2 years ago

For this instance there was no other network. The exact docker-compose is:

version: '3.1' services: db: image: mysql:8.0 command: --default-authentication-plugin=mysql_native_password --expire_logs_days=3 --secure-file-priv="" cap_add:

volumes: mysql-data-volume: elasticsearch: sitemap:

jeffw16 commented 2 years ago

Hmm, one thought I had: are you running as root or prepending each command with sudo? Such as, when you start the Canasta stack, do you use:

sudo docker-compose up -d

Because _initdb/ is a bind mount and should be owned by root.

irwando commented 2 years ago

I am yes.

Should i need to manually create the _initdb directory? Or is that a file actually?

amalpaul54111 commented 2 years ago

Actually, I encountered a similar issue with Canasta in my local environment, and that was just due to a low disk space. Finding more space in my disk fixed the issue. Try to make sure that the disk where docker saves the images and containers have enough space. Even though I have a separate partition for my home directory, docker defaults to save the containers in /var/lib/docker