500 Internal Server Error
Angeemg opened this issue · 15 comments
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I used Docker-Compose to start Bookstack but got 500 error.

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-stoppedContainer 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 computerThanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.
Having the same issue, any progress?
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.
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
`
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?
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>';
Does your password contain the character $ ?
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
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).
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.
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.
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:
docker-compose stop, thendocker-compose up -d. Things should work the second time around.- Or, you can bring the database up first, then the application.
docker-compose up -d bookstack_db, thendocker-compose up -d.
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.
This issue is locked due to inactivity