linuxserver / docker-bookstack

A Docker container for the BookStack documentation wiki
GNU General Public License v3.0
797 stars 109 forks source link

For Raspberry Pi armv7 -env should be DB_PASSWORD not DB_PASS #87

Closed spudsmac closed 3 years ago

spudsmac commented 3 years ago

New to github but I spent hours racking my brain over getting the application to be able to log in to the database. Turns out the image for the database for raspberry pi armv7 should be mariadb and the env variable for password should be DB_PASSWORD not DB_PASS. Figured I would pass along this information in case other people are having this issue. Sorry it's not in the right format but if you close out this issue it should be searchable.

This is the error I was getting before making the change.

Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'bookstack.bookstack_default' (using password: YES) (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE')

at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669

665|         // If an exception occurs when attempting to run a query, we'll format the error

666|         // message to include the bindings with SQL, which will make this exception a

667|         // lot more helpful to the developer instead of just the database's errors.

668|         catch (Exception $e) {

669| throw new QueryException(

670|                 $query, $this->prepareBindings($bindings), $e

671|             );

672|         }

673|

Exception trace:

1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'bookstack.bookstack_default' (using password: YES)")

  /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31

2 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'bookstack.bookstack_default' (using password: YES)")

  /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27

Please use the argument -v to see more details.

github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

aptalca commented 3 years ago

The vars are DB_USER and DB_PASS as listed in the readme https://github.com/linuxserver/docker-bookstack/blob/master/root/etc/cont-init.d/50-config#L51

PerryCodekies commented 3 years ago

According the issue here: https://discourse.linuxserver.io/t/bookstack-database-issues/1421

This seems to be not only happening in Rasberry Pi.

I am able to fix the issue by changing the environment variable DB_PASS to DB_PASSWORD.

Anything thing to point out: I wasn't able to connect to the DB via 127.0.0.1 or localhost, instead the internal IP of the docker host is used.

aptalca commented 3 years ago

If you fill out the issue template, we can take a look. Otherwise, we can't help

ssddanbrown commented 3 years ago

DB_PASS should work for first boot as that value will be used in the copied/generated .env file. If you then need to use a different (Non-database_user_password-default) value then the DB_PASS value won't take affect since the .env file has already been created (Assuming the config path is passed as a persistent volume which will be most cases) and since the script looks for the old default value.

Setting DB_PASSWORD works around this by overriding the .env file value from BookStack's perspective. Alternatively you could instead directly alter the .env file as documented in the readme.

Can't immediately think of a way to alter the script without breaking someone's setup, No rush to do so though since it can be worked around.

Either way, Always remember to follow the issue template.

JC5 commented 3 years ago

I am embarrassed, but not too not embarrassed to bring up my own two issues in which I angrily argued the exact same thing.

They may shed some light on this issue.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.