NathanVaughn / webtrees-docker

Up-to-date Docker image for webtrees with all the bells and whistles.
https://hub.docker.com/r/nathanvaughn/webtrees
MIT License
64 stars 15 forks source link

Docker-Compuse Up not working, potentiol problem with start of apache2 #134

Closed PeSalomon closed 11 months ago

PeSalomon commented 11 months ago

I'm struggling installing and starting webtrees with the given docker-compose.yml file. Installation is on a Raspberri Pi 4 with an fresh installed Raspberry OS revision bookworm.

Docker log contains the following messages: [NV_INIT] Starting Apache AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message [Sun Dec 10 21:11:11.931452 2023] [mpm_prefork:notice] [pid 37] AH00163: Apache/2.4.57 (Debian) PHP/8.1.25 OpenSSL/3.0.11 configured -- resuming normal operations Sun Dec 10 21:11:11.931579 2023] [core:notice] [pid 37] AH00094: Command line: 'apache2 -D FOREGROUND' webtrees:80 127.0.0.1 - - [10/Dec/2023:21:11:41 +0000] "GET / HTTP/1.1" 500 4549 "-" "curl/7.88.1" webtrees:80 127.0.0.1 - - [10/Dec/2023:21:12:11 +0000] "GET / HTTP/1.1" 500 4549 "-" "curl/7.88.1"

My docker-compose.yml is: version: "3" services: app: depends_on:

volumes: db_data: driver: local app_data: driver: local

Opening "http;//127.0.0.1/webtrees" in a browser returns: RuntimeException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for webttees_db failed: Name or service not known in /var/www/webtrees/app/Http/Middleware/UseDatabase.php:119 Stack trace:

0 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDatabase->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

1 /var/www/webtrees/app/Http/Middleware/BadBotBlocker.php(293): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

2 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BadBotBlocker->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

3 /var/www/webtrees/app/Http/Middleware/CompressResponse.php(71): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

4 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CompressResponse->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

5 /var/www/webtrees/app/Http/Middleware/ContentLength.php(40): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

6 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ContentLength->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

7 /var/www/webtrees/vendor/middlewares/client-ip/src/ClientIp.php(65): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

8 /var/www/webtrees/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

9 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ClientIp->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

10 /var/www/webtrees/app/Http/Middleware/HandleExceptions.php(89): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

11 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\HandleExceptions->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

12 /var/www/webtrees/app/Http/Middleware/BaseUrl.php(73): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

13 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BaseUrl->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

14 /var/www/webtrees/app/Http/Middleware/ReadConfigIni.php(68): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

15 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ReadConfigIni->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

16 /var/www/webtrees/app/Http/Middleware/SecurityHeaders.php(48): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

17 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\SecurityHeaders->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

18 /var/www/webtrees/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

19 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

20 /var/www/webtrees/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

21 /var/www/webtrees/app/Webtrees.php(275): Middleland\Dispatcher->dispatch(Object(Nyholm\Psr7\ServerRequest))

22 /var/www/webtrees/app/Webtrees.php(262): Fisharebest\Webtrees\Webtrees::dispatch(Object(Nyholm\Psr7\ServerRequest), Array)

23 /var/www/webtrees/index.php(51): Fisharebest\Webtrees\Webtrees->httpRequest()

24 {main}

I saw found some reported issues pointing in the same direction. A suggested workaround was: "run the setup wizard manually". Can anybody explain to me how to translate "docker-compse up" into a manual setup wizard? Any help is really appreciated.

Best regards Peter

NathanVaughn commented 11 months ago

I think you may have a typo in your environment variables.

getaddrinfo for webttees_db failed

You can confirm by looking/editing the contents of /var/www/webtrees/data/config.ini.php

NathanVaughn commented 11 months ago

In terms of manually running the setup wizard, remove all of the DB_ and WT_ environment variables and make sure the data directory is empty. When you do that and open a web browser, webtrees will walk you through a setup wizard.

PeSalomon commented 11 months ago

Hi Nathan, thank you for your reply. The typo in my environment variables must have been a left over from an earlier version of my docker-compose.yml file. I have made a fresh installation of Raspbian OS on my Pi4 and with this the start of the containers with the docker-compose.yml above worked without any errors. Unfortunately I'm now getting an error when trying to create the data base: SQLSTATE[HY000] [2002] Connection refused (SQL: CREATE DATABASE IF NOT EXISTS Stelzig COLLATE utf8_unicode_ci) I've seen that others got this error as well and will follow their solutions. Thanks for your help. Best regards Peter

NathanVaughn commented 11 months ago

Sorry I didn't get back earlier. Yeah, there's a lot of things that could cause that. Permissions issues, access control issues, networking issues, database issues, etc. I think the best place to start is to just try attaching a terminal to the database and logging in on the command line. Then try from the webtrees container, etc.

PeSalomon commented 11 months ago

Hi Nathan,

thank you for your reply. I did manage to get webtrees started in the container.

Solution was:

Add two user/groups to my Raspian OS: www-data/www-data and mysql/mysql

Than creating the directory /var/www/ and made the ower www-data with the permissions View: Anyone, Change: Only owner and Access: Anyone

Than creating the same with the directory /var/lib/mysql/ and made the owenr mysql/mysql with the permissions View: Anyone, Change: Only owner and Access: Anyone

When these directories were existing, I could configure webtrees at the first start up and everything went smooth.

Also a load of my family tree using a GEDCOM flie that I created on my old Raspberry pi3 went without any problems.

The only problem that is remaining ist that webtrees does not find the media files that I copies fromm y old pi3 and stord the in /var/www/webtrees/data/media. I always get error 404 file does not exist.

I than created a new media file and found out that webtrees stored that file inside the container in the directory /var/www/webtrees/data/media/.

So somehow the volumes definition - app_media:/var/www/webtrees/data/media/ seams not to work.

A dir inside the container returned:

@.***:/var/www/webtrees# dir

CONTRIBUTING.md README.md app data index.php public vendor

LICENSE.md SECURITY.md apple-touch-icon.png favicon.ico modules_v4 resources

And a dir in data:

@.***:/var/www/webtrees# cd data

@.***:/var/www/webtrees/data# dir

cache config.ini.php index.php media

@.***:/var/www/webtrees/data# cd media

@.***:/var/www/webtrees/data/media# dir

1914-18\ Hermann\ als\ Soldat.jpg This is the new added media file!!!

So it looks like the volume definition

-app_data:/var/www/webtrees/data/

is not working fort he media directory in it.

Also placing the media directory with a separate app-media:/var/www/webtrees/media outside the data directory does not.

I always get error 404 file not found except for the one that I added inside the container.

Do you have any hint how I cat track the root cause of this error?

Best regards and any help is really appreciated

Peter

Von: Nathan Vaughn @. Gesendet: Dienstag, 19. Dezember 2023 03:39 An: NathanVaughn/webtrees-docker @.> Cc: PeSalomon @.>; Author @.> Betreff: Re: [NathanVaughn/webtrees-docker] Docker-Compuse Up not working, potentiol problem with start of apache2 (Issue #134)

Sorry I didn't get back earlier. Yeah, there's a lot of things that could cause that. Permissions issues, access control issues, networking issues, database issues, etc. I think the best place to start is to just try attaching a terminal to the database and logging in on the command line. Then try from the webtrees container, etc.

— Reply to this email directly, view it on GitHub https://github.com/NathanVaughn/webtrees-docker/issues/134#issuecomment-1862011283 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ASMTUPY4DCGCUIDWNNN4P7TYKD45NAVCNFSM6AAAAABAO3N57CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRSGAYTCMRYGM . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ASMTUP5QKOSJRLWZYWYC6RLYKD45NA5CNFSM6AAAAABAO3N57CWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTO7QEZG.gif Message ID: @. @.> >

NathanVaughn commented 11 months ago

Interesting, I'm the most proficient at Linux file system permissions. On my own setup, I run everything with bind mounts, and really only test the docker compose file with volume mounts on my Windows desktop.

It also sounds like it was related to #131 then. I have updated the docker-compose file to reflect this, maybe you had an old version.