Bookstack: Always getting 504 Gateway time-out error

Hi there,
I’m totally new to this platform and I hope that someone can help me. I’m actually trying to install the bookstack application via docker-compose as described on hub-docker , but I always get a time-out error.

My environment:
Intel NUC, with Ubuntu 22.04.1 LTS (Codename „jammy“)

There is nothing else running on the NUC.

Error description
I always get a 504 Gateway time-out error:

thierry@HA:/opt$ curl -I http://192.168.0.42:6875
HTTP/1.1 504 Gateway Time-out
Server: nginx
Date: Mon, 03 Oct 2022 12:50:35 GMT
Content-Type: text/html
Content-Length: 160
Connection: keep-alive

LOG Entries
NGINX access.log
192.168.0.42 - - [03/Oct/2022:12:50:35 +0000] “HEAD / HTTP/1.1” 504 0 “-” "curl/7.81.0“

NGINX error.log
2022/10/03 12:50:35 [error] 249#249: *1 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 192.168.0.42, server
: _, request: “HEAD / HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: "192.168.0.42:6875“

APP log: /app/www/storage/logs/laravel.log
php_network_getaddresses: getaddrinfo failed: Try again at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70)
[stacktrace]

89 lines of trace

My docker-compose.yaml

version: ‘3.0’

services:
bookstack:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- DB_HOST=bookstack-db
- DB_USER=bookstack
- DB_PASS=VandoB45
- DB_DATABASE=bookstackapp
volumes:
- /opt/bookstack:/config
ports:
- 6875:80
restart: unless-stopped
depends_on:
- bookstack_db
bookstack_db:
image: linuxserver/mariadb
container_name: bookstack_db
environment:
- PUID=1000
- PGID=1000
- MYSQL_ROOT_PASSWORD=VandoB45
- TZ=Europe/Zurich
- MYSQL_DATABASE=bookstackapp
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=VandB45
volumes:
- /opt/bookstack/db:/config
restart: unless-stopped

All services are up and running without errors (except the one in laravel.log). I checked the PUID and PGID, they are correct for the user launching docker-compose.
I also tried the APP_URL configuration, but without success.

I tried every possible configuration like described on stackoverflow (nginx-close-upstream-connection-after-request or nginx-reverse-proxy-causing-504-gateway-timeout/36589120#36589120 and many more)

I’m at a loss. Any good advice?
Thanks in advance.
Thierry

it’s not starting up fully because of the database errors. I would go into your mariadb container and check 1) was the database created 2) was the user created 3) what host is the user allowed to come from

you could also stop and rm the mariadb, rm -rf /opt/bookstack/db/* and then redo it and see if it works .

HI driz,
thank you very much for your answer. I reinstalled the whole thing, even rewrote the docker-compose.yaml. The db is running, the users are installed:
MariaDB [(none)]> SELECT User FROM mysql.user;
±------------+
| User |
±------------+
| bookstack |
| root |
| mariadb.sys |
±------------+
3 rows in set (0.002 sec)

MariaDB [(none)]> SHOW GRANTS FOR bookstack;
±---------------------------------------------------------------------------------------------------------+
| Grants for bookstack@% |
±---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO bookstack@% IDENTIFIED BY PASSWORD '2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19’ |
| GRANT ALL PRIVILEGES ON bookstackapp.
TO bookstack@% |
±---------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)

MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> ‘localhost’;
±----------±-----+
| User | Host |
±----------±-----+
| bookstack | % |
| root | % |
±----------±-----+
2 rows in set (0.002 sec)

MariaDB [(none)]> SHOW GRANTS FOR root;
±-------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@% |
±-------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON . TO root@% IDENTIFIED BY PASSWORD ‘*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19’ WITH GRANT OPTION |
±-------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

MariaDB [(none)]> SHOW TABLES FROM bookstackapp;
±-----------------------+
| Tables_in_bookstackapp |
±-----------------------+
| activities |
| api_tokens |
| attachments |
| books |
| bookshelves |
| bookshelves_books |
| cache |
| chapters |
| comments |
| deletions |
| email_confirmations |
| entity_permissions |
| failed_jobs |
| favourites |
| images |
| jobs |
| joint_permissions |
| mfa_values |
| migrations |
| page_revisions |
| pages |
| password_resets |
| permission_role |
| references |
| role_permissions |
| role_user |
| roles |
| search_terms |
| sessions |
| settings |
| social_accounts |
| tags |
| user_invites |
| users |
| views |
| webhook_tracked_events |
| webhooks |
±-----------------------+
37 rows in set (0.001 sec)

I keep on digging…
Cheers
Thierry

Hi driz,

just got THE breakthrough. I put the APP_URL into the config with http://192.16…:6875 (in my former tests I didn’t write the http:// in front of it.
Phuu, this took me a long time. Thanks again for your help - it helped me digging :slight_smile:

Glad you got it sorted! I was going to say your db stuff looks perfect! Oddly enough you didn’t list an APP_URL in your compose above, which i should’ve caught since it’s a required var.

Have fun!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.