Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 Internal Server Error #212

Open
1 task done
Angeemg opened this issue May 28, 2024 · 14 comments
Open
1 task done

500 Internal Server Error #212

Angeemg opened this issue May 28, 2024 · 14 comments

Comments

@Angeemg
Copy link

Angeemg commented May 28, 2024

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.
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
Copy link

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

@Seryta
Copy link

Seryta commented Jun 2, 2024

Having the same issue, any progress?

@j0nnymoe
Copy link
Member

j0nnymoe commented Jun 2, 2024

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
Copy link

LouieLightning commented Jun 3, 2024

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
`

@icodetea
Copy link

icodetea commented Jun 11, 2024

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
Copy link

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
Copy link
Member

aptalca commented Jun 23, 2024

Does your password contain the character $ ?

@icodetea
Copy link

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
Copy link

@aptalca it did not

@aptalca
Copy link
Member

aptalca commented Jun 23, 2024

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
Copy link

Lx commented Jul 7, 2024

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.

@SamiAouad
Copy link

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.

@jcobol
Copy link

jcobol commented Aug 4, 2024

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.

@LinuxServer-CI
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Issues
Development

No branches or pull requests