linuxserver / docker-bookstack

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

500 Internal Server Error #212

Open Angeemg opened 1 month ago

Angeemg commented 1 month ago

Is there an existing issue for this?

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
github-actions[bot] commented 1 month ago

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

Seryta commented 1 month ago

Having the same issue, any progress?

j0nnymoe commented 1 month ago

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.

LouieLightning commented 1 month ago

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:

icodetea commented 3 weeks ago

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?

leeavital commented 2 weeks ago

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>';
aptalca commented 2 weeks ago

Does your password contain the character $ ?

icodetea commented 1 week ago

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

leeavital commented 1 week ago

@aptalca it did not

aptalca commented 1 week ago

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).

Lx commented 4 hours ago

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.