docker-bookstack icon indicating copy to clipboard operation
docker-bookstack copied to clipboard

500 Internal Server Error

Open Angeemg opened this issue 1 year ago • 14 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

I used Docker-Compose to start Bookstack but got 500 error. image in /log/nginx/error.log I don't have any entries.

Expected Behavior

Open bookstack configuration home page

Steps To Reproduce

use docker-compose file, I have changed only file ports in docker hub

Environment

- OS: Centos 7
- How docker service was installed:

CPU architecture

x86-64

Docker creation

version: "3"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=https://bookstack.mydomain.com
      - DB_HOST=bookstack_db
      - DB_PORT=3307
      - DB_USER=root
      - DB_PASS=secret
      - DB_DATABASE=bookstack
    volumes:
      - ./bookstack_app_data:/config
    ports:
      - 8080:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=password
      - TZ=America/Lima
      - MYSQL_DATABASE=bookstack
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=password
    volumes:
      - ./bookstack_db_data:/config
    ports:
      - 3307:3306
    restart: unless-stopped

Container logs

using keys found in /config/keys
App Key found - setting variable for seds
Running config - DB_HOST set
Waiting for DB to be available

   Illuminate\Database\QueryException

  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'bookstack' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

  at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
    828▕
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

      +39 vendor frames

  40  /app/www/artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

[custom-init] No custom files found, skipping...
[ls.io-init] done.
-----------------------------------

I have connection to DB from external computer

Angeemg avatar May 28 '24 01:05 Angeemg

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

github-actions[bot] avatar May 28 '24 01:05 github-actions[bot]

Having the same issue, any progress?

Seryta avatar Jun 02 '24 10:06 Seryta

OP has used the incorrect port in their compose, as they're using docker networking, they should be using the container port 3306 and not the bridged port on 3307.

j0nnymoe avatar Jun 02 '24 10:06 j0nnymoe

I'm also having the same issue with the default yaml provided. I only altered the password for the database. `

version: "2" services: bookstack: image: lscr.io/linuxserver/bookstack container_name: bookstack environment: - PUID=1000 - PGID=1000 - APP_URL=https://bookstack.example.com - DB_HOST=bookstack_db - DB_PORT=3306 - DB_USER=bookstack - DB_PASS=mypassword - DB_DATABASE=bookstackapp volumes: - ./bookstack_app_data:/config ports: - 6875:80 restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: lscr.io/linuxserver/mariadb container_name: bookstack_db environment: - PUID=1000 - PGID=1000 - MYSQL_ROOT_PASSWORD=mypassword - TZ=Europe/London - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=mypassword volumes: - ./bookstack_db_data:/config restart: unless-stopped `

LouieLightning avatar Jun 03 '24 14:06 LouieLightning

I have similar error: here my error in laravel.log:

[2024-06-11 18:19:30] production.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_type' in 'where clause' (SQL: select * from `activities` where ((`entity_type` = bookshelf and `entity_id` in (2))) order by `created_at` desc limit 20 offset 0) {"userId":3,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_type' in 'where clause' (SQL: select * from `activities` where ((`entity_type` = bookshelf and `entity_id` in (2))) order by `created_at` desc limit 20 offset 0) at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760)

the weird thing is: I could not find a hint about a failed migration?

icodetea avatar Jun 11 '24 18:06 icodetea

I was able to get past this issue by manually setting the mysql user password. It looks like the docker compose example in the readme doesn't correctly set the mysql_user's password.

docker exec -it bookstack_db mysql -u root -p
# type in your mysql root password
ALTER USER bookstack IDENTIFIED BY '<put your password here>';

leeavital avatar Jun 23 '24 15:06 leeavital

Does your password contain the character $ ?

aptalca avatar Jun 23 '24 15:06 aptalca

I have similar error: here my error in laravel.log:

[2024-06-11 18:19:30] production.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_type' in 'where clause' (SQL: select * from `activities` where ((`entity_type` = bookshelf and `entity_id` in (2))) order by `created_at` desc limit 20 offset 0) {"userId":3,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_type' in 'where clause' (SQL: select * from `activities` where ((`entity_type` = bookshelf and `entity_id` in (2))) order by `created_at` desc limit 20 offset 0) at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760)

the weird thing is: I could not find a hint about a failed migration?

sorry in my case false alarm, happened because watchtower messed something up and ran older version of bookstack app container. Which then make sence i no more compatible to the Database

icodetea avatar Jun 23 '24 17:06 icodetea

@aptalca it did not

leeavital avatar Jun 23 '24 17:06 leeavital

Then please post your password (change it in your system afterwards) so we can try and reproduce.

Last I looked into it, we had sanitization in place for every special character and they all worked (with the exception of the $ in compose yaml which needs to be escaped in compose and not something we can fix inside the container).

aptalca avatar Jun 23 '24 17:06 aptalca

I experienced the same issue. The solution in my case was to tear down the containers and bring them up again, which was enough to trigger the migrations to occur. I'm not sure why they didn't run the first time by themselves.

Lx avatar Jul 07 '24 11:07 Lx

I experienced the same issue, I updated MYSQL_PASSWORD and forgot to update DB_PASS (it is used by bookstack to connect to the DB), which seems to be the same case for your compose file.

SamiAouad avatar Jul 17 '24 09:07 SamiAouad

I had the same problem. It appears that the bookstack_db container can take too long to do its initialization which causes the bookstack container to fail. Perhaps the bookstack container needs to try longer before giving up.

Two workarounds that worked for me:

  1. docker-compose stop, then docker-compose up -d. Things should work the second time around.
  2. Or, you can bring the database up first, then the application. docker-compose up -d bookstack_db, then docker-compose up -d.

jcobol avatar Aug 04 '24 04:08 jcobol

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.

LinuxServer-CI avatar Sep 03 '24 09:09 LinuxServer-CI

This issue is locked due to inactivity

github-actions[bot] avatar Dec 03 '24 09:12 github-actions[bot]