linuxserver / docker-bookstack

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

[BUG] Database Access Denied when binding to local volumes #161

Closed Zenthae closed 1 year ago

Zenthae commented 1 year ago

Is there an existing issue for this?

Current Behavior

The app is stuck on a blank pages and an error is thrown in nginx logs :

#5 /app/www/vendor/laravel/framework/src/Illumina...PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'forge'@'bookstack-application-1.bookstack' (using password: NO) in /app/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Stack trace:
#0 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(70): PDO->__construct()
#1 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector->createPdoConnection()
#2 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection()
#3 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect()
#4 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
#5 /

Expected Behavior

The app should open and not throw a database connection error

Steps To Reproduce

  1. Run the docker compose example but remove the volumes bindings (everything works fine)
  2. Run the docker compose example with volume bindings (error when accessing database)

what i don't understand is that migrations are applied, it just stop to work when you try to access the web interface

Environment

- OS: Linux
- How docker service was installed: distro's packagemanager

CPU architecture

x86-64

Docker creation

version: "3"

services:
  application:
    image: linuxserver/bookstack:latest
    env_file:
      - bookstack.env
    expose:
      - 80
    volumes:
      - $DOCKER_HOME/bookstack/application:/config
    networks:
      - bookstack
      - traefik
    depends_on:
      - database
    labels:
      # Enable auto update
      com.centurylinklabs.watchtower.enable: true

      # Proxy config
      traefik.enable: true

  database:
    image: linuxserver/mariadb:latest
    env_file:
      - bookstack.env
    volumes:
      - $DOCKER_HOME/bookstack/database:/config
    networks:
      - bookstack

networks:
  traefik:
    name: traefik
    external: true
  bookstack:
    name: bookstack

Container logs

2023-02-23T20:03:15.680706391Z [migrations] started
2023-02-23T20:03:15.686521325Z [migrations] 01-nginx-site-confs-default: skipped
2023-02-23T20:03:15.688619148Z [migrations] 02-default-location: skipped
2023-02-23T20:03:15.688746634Z [migrations] done
2023-02-23T20:03:15.931500911Z 
2023-02-23T20:03:15.931669823Z -------------------------------------
2023-02-23T20:03:15.931701441Z           _         ()
2023-02-23T20:03:15.931731497Z          | |  ___   _    __
2023-02-23T20:03:15.931761660Z          | | / __| | |  /  \
2023-02-23T20:03:15.931786938Z          | | \__ \ | | | () |
2023-02-23T20:03:15.931826175Z          |_| |___/ |_|  \__/
2023-02-23T20:03:15.931852219Z 
2023-02-23T20:03:15.931875890Z 
2023-02-23T20:03:15.931899163Z Brought to you by linuxserver.io
2023-02-23T20:03:15.931937415Z -------------------------------------
2023-02-23T20:03:15.931961685Z 
2023-02-23T20:03:15.931984820Z To support LSIO projects visit:
2023-02-23T20:03:15.932016793Z https://www.linuxserver.io/donate/
2023-02-23T20:03:15.932046248Z -------------------------------------
2023-02-23T20:03:15.932070313Z GID/UID
2023-02-23T20:03:15.932097211Z -------------------------------------
2023-02-23T20:03:15.933807588Z 
2023-02-23T20:03:15.933860795Z User uid:    1027
2023-02-23T20:03:15.933894884Z User gid:    100
2023-02-23T20:03:15.933923127Z -------------------------------------
2023-02-23T20:03:15.933951722Z 
2023-02-23T20:03:15.983718630Z using keys found in /config/keys
2023-02-23T20:03:16.025427320Z App Key found - setting variable for seds
2023-02-23T20:03:16.027225886Z Running config - DB_HOST set
2023-02-23T20:03:16.036508528Z Waiting for DB to be available
2023-02-23T20:03:21.664309692Z Nothing to migrate.
2023-02-23T20:03:21.705196288Z [custom-init] No custom files found, skipping...
2023-02-23T20:03:21.721656296Z [ls.io-init] done.
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

Zenthae commented 1 year ago

to fix it i had to replace DB_USER by DB_USERNAME and DB_PASS by DB_PASSWORD and my password is alphanumeric, nothing to escape

homerr commented 1 year ago

Need to correct the docker cli arguments in readme to avoid confusion in deployment

github-actions[bot] commented 1 year ago

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

github-actions[bot] commented 1 year ago

This issue is locked due to inactivity