LycheeOrg / Lychee-Docker

Docker image for Lychee
https://lycheeorg.github.io/
166 stars 55 forks source link

ERROR: FPM initialization failed #28

Closed brentkearney closed 4 years ago

brentkearney commented 4 years ago

When I first start this container, it creates tables in the database, but then reports some errors and exits:

...

lychee    | Migrated:  2019_10_11_093442_config_check_update_every (0 seconds)
lychee    | **** Create user and use PUID/PGID ****
lychee    | -e      User UID :  1000
lychee    | -e      User GID :  1000
lychee    | **** Set Permissions ****
lychee    | **** Setup complete, starting the server. ****
lychee    | [12-Feb-2020 01:00:54] ERROR: failed to open configuration file '/etc/php/7.3/fpm/php-fpm.conf': No such file or directory (2)
lychee    | [12-Feb-2020 01:00:54] ERROR: failed to load configuration file '/etc/php/7.3/fpm/php-fpm.conf'
lychee    | [12-Feb-2020 01:00:54] ERROR: FPM initialization failed

Is there a default php-fpm.conf file that you recommend?

d7415 commented 4 years ago

If you're using the provided image (or generating from the files here) that file should exist, provided by the Debian php7.3-fpm package.

brentkearney commented 4 years ago

It doesn't.

d7415 commented 4 years ago

How are you loading the image?

brentkearney commented 4 years ago

I used a docker-compose file, based on the example one. It pulls bigrob8181/lychee-laravel-docker.

I have since deleted it because I wanted to get some gallery software up and running by the weekend, and spent too much time without success on Lychee-Laravel. I ended up going with Chevereto.

d7415 commented 4 years ago

That may be your problem - the file you linked pulls from bigrob8181/lychee-laravel. bigrob8181/lychee-laravel-docker was last updated a year ago and was marked "testing". When I pulled a version earlier to check and then rebuilt it from scratch just now, the files were present.

As it looks like it's fine in the current version and you've moved to different software, I'm going to close this issue.

d7415 commented 4 years ago

The file I linked is the one given in your README.md, in the Docker section. It would be helpful for future users if you updated that to reference the working image.

It does. I'm not sure whether you were remembering wrong or got to bigrob8181/lychee-laravel-docker some other way, but the file you linked points at the correct image (bigrob8181/lychee-laravel).

I've just had a quick look through all 3 relevant repos for any errors on this subject, but found none - If I missed any, please do let me know.

brentkearney commented 4 years ago

You are right; I deleted that comment after double checking the example file. Although the docker-compose.yml I used is no longer available, I checked my server, and it's the lychee-laravel image.

$ docker image ls | grep -i lychee
linuxserver/lychee                       latest              9886d5c37212        2 weeks ago         220MB
bigrob8181/lychee-laravel                latest              f3319be27e88        3 months ago        339MB

Inside the container, I recall there were two php.ini files, one with -production in the name, and another with -development in the name, and in my fidgeting I copied the production one to php.ini. But I couldn't make it work. I may try again, because I now realize Chevereto doesn't support videos, which would be really nice to have.

d7415 commented 4 years ago

Ok. That's more interesting. Also note that the error was not for a php.ini file.

Either way, I extracted the image downloaded from Docker Hub just in case, and

$ ls etc/php/7.3/fpm/
conf.d  php-fpm.conf  php.ini  pool.d

Both files are present at their expected locations, without even running the image. Are you mounting an alternative /etc/?

brentkearney commented 4 years ago

I decided to take another kick at it. Again, missing php-fpm.conf:

$ docker-compose up -d
Pulling lychee (lycheeorg/lychee-laravel:latest)...
latest: Pulling from lycheeorg/lychee-laravel
bc51dd8edc1b: Already exists
c204ec40a579: Pull complete
eeb3df492676: Pull complete
7bf96bb66e6c: Pull complete
746f3365839c: Pull complete
d5ab9d4ad59e: Pull complete
Digest: sha256:b10d5173fffbd098c0094fa5bfa33f170408a5c0d56805b0ea9cd101c4ab141b
Status: Downloaded newer image for lycheeorg/lychee-laravel:latest
Starting hb_db
Starting hb
Recreating lychee

$ docker logs -f lychee

-------------------------------------
  _               _                
 | |   _   _  ___| |__   ___  ___  
 | |  | | | |/ __|  _ \ / _ \/ _ \ 
 | |__| |_| | (__| | | |  __/  __/ 
 |_____\__, |\___|_| |_|\___|\___| 
 | |   |___/ _ __ __ ___   _____| |
 | |   / _' | '__/ _' \ \ / / _ \ |
 | |__| (_| | | | (_| |\ V /  __/ |
 |_____\__,_|_|  \__,_| \_/ \___|_|

-------------------------------------
Latest Commit: bae5f2b
https://github.com/LycheeOrg/Lychee-Laravel/commit/bae5f2bbea823f5b0bfc154464dbf16e86ddb7db
-------------------------------------
**** Make sure the /conf and /uploads folders exist ****
**** Create the symbolic link for the /uploads folder ****
**** Copy the .env to /conf ****
**** Inject .env values ****
**** Generate the key (to make sure that cookies cannot be decrypted etc) ****
Application key set successfully.
**** Migrate the database ****

In Connection.php line 669:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known (SQL: select * from information_schema.tables where tab  
  le_schema = lychee_db and table_name = migrations and table_type = 'BASE TA  
  BLE')                                                                        

In PDOConnection.php line 31:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          

In PDOConnection.php line 27:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          

In PDOConnection.php line 27:

  PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or s  
  ervice not known                                                             

**** Create user and use PUID/PGID ****
-e      User UID :  1000
-e      User GID :  1000
**** Set Permissions ****
**** Setup complete, starting the server. ****

It stopped outputting there, and I stopped the container to add a new DNS entry for it. Upon restarting it:


-------------------------------------
  _               _                
 | |   _   _  ___| |__   ___  ___  
 | |  | | | |/ __|  _ \ / _ \/ _ \ 
 | |__| |_| | (__| | | |  __/  __/ 
 |_____\__, |\___|_| |_|\___|\___| 
 | |   |___/ _ __ __ ___   _____| |
 | |   / _' | '__/ _' \ \ / / _ \ |
 | |__| (_| | | | (_| |\ V /  __/ |
 |_____\__,_|_|  \__,_| \_/ \___|_|

-------------------------------------
Latest Commit: bae5f2b
https://github.com/LycheeOrg/Lychee-Laravel/commit/bae5f2bbea823f5b0bfc154464dbf16e86ddb7db
-------------------------------------
**** Make sure the /conf and /uploads folders exist ****
**** Create the symbolic link for the /uploads folder ****
**** Copy the .env to /conf ****
**** Inject .env values ****
**** Generate the key (to make sure that cookies cannot be decrypted etc) ****
Application key set successfully.
**** Migrate the database ****

In Connection.php line 669:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known (SQL: select * from information_schema.tables where tab  
  le_schema = lychee_db and table_name = migrations and table_type = 'BASE TA  
  BLE')                                                                        

In PDOConnection.php line 31:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          

In PDOConnection.php line 27:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          

In PDOConnection.php line 27:

  PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or s  
  ervice not known                                                             

**** Create user and use PUID/PGID ****
-e      User UID :  1000
-e      User GID :  1000
**** Set Permissions ****
**** Setup complete, starting the server. ****

-------------------------------------
  _               _                
 | |   _   _  ___| |__   ___  ___  
 | |  | | | |/ __|  _ \ / _ \/ _ \ 
 | |__| |_| | (__| | | |  __/  __/ 
 |_____\__, |\___|_| |_|\___|\___| 
 | |   |___/ _ __ __ ___   _____| |
 | |   / _' | '__/ _' \ \ / / _ \ |
 | |__| (_| | | | (_| |\ V /  __/ |
 |_____\__,_|_|  \__,_| \_/ \___|_|

-------------------------------------
Latest Commit: bae5f2b
https://github.com/LycheeOrg/Lychee-Laravel/commit/bae5f2bbea823f5b0bfc154464dbf16e86ddb7db
-------------------------------------
**** Make sure the /conf and /uploads folders exist ****
**** Create the symbolic link for the /uploads folder ****
**** Copy the .env to /conf ****
**** Inject .env values ****
**** Generate the key (to make sure that cookies cannot be decrypted etc) ****
PHP Fatal error:  Interface 'JsonSerializable' not found in /var/www/html/Lychee-Laravel/vendor/laravel/framework/src/Illuminate/Support/Enumerable.php on line 11

In LogManager.php line 416:

  Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_  
  SLASHES' (this will throw an Error in a future version of PHP)               

**** Create user and use PUID/PGID ****
-e      User UID :  1000
-e      User GID :  1000
**** Set Permissions ****
**** Setup complete, starting the server. ****
[21-Feb-2020 02:49:58] ERROR: failed to open configuration file '/etc/php/7.3/fpm/php-fpm.conf': No such file or directory (2)
[21-Feb-2020 02:49:58] ERROR: failed to load configuration file '/etc/php/7.3/fpm/php-fpm.conf'
[21-Feb-2020 02:49:58] ERROR: FPM initialization failed

-------------------------------------
  _               _                
 | |   _   _  ___| |__   ___  ___  
 | |  | | | |/ __|  _ \ / _ \/ _ \ 
 | |__| |_| | (__| | | |  __/  __/ 
 |_____\__, |\___|_| |_|\___|\___| 
 | |   |___/ _ __ __ ___   _____| |
 | |   / _' | '__/ _' \ \ / / _ \ |
 | |__| (_| | | | (_| |\ V /  __/ |
 |_____\__,_|_|  \__,_| \_/ \___|_|

-------------------------------------
Latest Commit: bae5f2b
https://github.com/LycheeOrg/Lychee-Laravel/commit/bae5f2bbea823f5b0bfc154464dbf16e86ddb7db
-------------------------------------
**** Make sure the /conf and /uploads folders exist ****
**** Create the symbolic link for the /uploads folder ****
**** Copy the .env to /conf ****
**** Inject .env values ****
**** Generate the key (to make sure that cookies cannot be decrypted etc) ****
PHP Fatal error:  Interface 'JsonSerializable' not found in /var/www/html/Lychee-Laravel/vendor/laravel/framework/src/Illuminate/Support/Enumerable.php on line 11

In LogManager.php line 416:

  Use of undefined constant JSON_UNESCAPED_SLASHES - assumed 'JSON_UNESCAPED_  
  SLASHES' (this will throw an Error in a future version of PHP)               

**** Create user and use PUID/PGID ****
-e      User UID :  1000
-e      User GID :  1000
**** Set Permissions ****
**** Setup complete, starting the server. ****
[21-Feb-2020 02:49:59] ERROR: failed to open configuration file '/etc/php/7.3/fpm/php-fpm.conf': No such file or directory (2)
[21-Feb-2020 02:49:59] ERROR: failed to load configuration file '/etc/php/7.3/fpm/php-fpm.conf'
[21-Feb-2020 02:49:59] ERROR: FPM initialization failed
brentkearney commented 4 years ago

I was posting my docker-compose.yml here, and noticed that my DB_HOST environment variable was wrong. After changing it to the correct hostname, and running the container again, it ran the migrations to create the database tables, and is now running without errors.

When I first posted on this issue, I had already setup lychee, the non-laravel version, first. So perhaps it was a database issue that time as well. I wonder how a misconfigured database results in the php-fpm.conf error. Weird!

Sorry to trouble you, and thanks for bearing with me. Hopefully the dialog might help someone else who runs into this in the future.

d7415 commented 4 years ago

Thanks for the update! That is indeed strange.

brentkearney commented 4 years ago

The strangeness continues: I uploaded photos, setup galleries, and noticed that *.mp4 files were not selectable in the upload dialog, even though they were smaller files than some of the .jpg files I uploaded. Curious, I logged into the running container to look at the php.ini, and the only thing in /etc/php/7.3 was a "cli" directory.

When I restart the container, it is back to the same issue:

[21-Feb-2020 07:55:40] ERROR: failed to open configuration file '/etc/php/7.3/fpm/php-fpm.conf': No such file or directory (2)

scratches head

Deleting the container, and recreating it worked. I used docker cp to copy /etc/php/7.3/fpm out of the container, for next time. Also, when it was broken I used docker inspect to be sure there were no volumes mounted that I wasn't aware of; the only ones were /conf and /uploads as per example. It seems like something is actually deleting the /etc/php/7.3/fpm directory during runtime.

The new container is running, but many of the 400 photos I had uploaded are now missing. Either thumbnails, or medium or full size images have a question mark icon instead of an image. The Info pane still works, showing the missing photo's metadata. I checked a few minutes later with a different browser, and many of the missing images have returned. I guess it rebuilds an index or something like that?

brentkearney commented 4 years ago

A large number of the photos never re-appeared. Something happened when a new container was created that caused many of them to disappear. They are host mounted on the /uploads volume, as per example. Also oddly, none of the photos appear when I access the gallery with my phone.

brentkearney commented 4 years ago

I fixed the "missing images" issue by changing the Settings -> Symbolic Link -> SL_enable from 1 to 0. This indicates to me that symlinks, or something relevant to them, are being created inside the container, since the missing images problem occurred after a new container was instantiated.

brentkearney commented 4 years ago

I have run into 4 issues, and I should probably open 3 new ones. I think the first 2 belong in this repo, but maybe the other 2 should be in either the Lychee-Laravel repo, or the main Lychee repo. Where do you think they should go?

  1. The disappearing directories in /etc/php/7.3, which is the subject of the current issue.

  2. When the docker container is recreated, many photos (thumbnails, medium size, etc) disappear. Disabling the SL_enable option brings them back. Are symlinks created inside the container?

  3. Video files (*.mp4) cannot be selected for upload. It is not a size limit issue. I verified ffmpeg is installed in the container, and Lychee's "Diagnostics" page says has_ffmpeg: 1.

  4. On a password protected album, after logging in with an iPhone, an infinite loop of posts begins. Mobile Safari and Chrome both end it with an error message, but Brave endlessly reloads. Hitting refresh in any of those browsers "fixes" it.

Thanks again.

d7415 commented 4 years ago

Sorry. I was going to investigate and come back to this, especially as (as you pointed out) they're not all really for here.

1. The disappearing directories in /etc/php/7.3, which is the subject of the current issue.

That's really weird. That's all I've got.

2. When the docker container is recreated, many photos (thumbnails, medium size, etc) disappear. Disabling the SL_enable option brings them back. Are symlinks created inside the container?

Yes. I've opened a PR that should rectify that, and SL_enable is default off in Lychee now. :+1:

3. Video files (*.mp4) cannot be selected for upload. It is not a size limit issue. I verified ffmpeg is installed in the container, and Lychee's "Diagnostics" page says has_ffmpeg: 1.

Could this be https://github.com/LycheeOrg/Lychee-front/issues/179?

4. On a password protected album, after logging in with an iPhone, an infinite loop of posts begins. Mobile Safari and Chrome both end it with an error message, but Brave endlessly reloads. Hitting refresh in any of those browsers "fixes" it.

You've already opened this as https://github.com/LycheeOrg/Lychee-Laravel/issues/446.

d7415 commented 4 years ago

No response and unable to reproduce. Closing.