LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.42k stars 303 forks source link

How can Redis be used? #601

Closed vorlif closed 2 years ago

vorlif commented 4 years ago

Detailed description of the problem [REQUIRED]

I have installed Redis and use it with other projects. So I wanted to use it with Lychee as well and expected a little better performance from it.

Unfortunately I always get an error message when I set the 'CACHE_DRIVER' to 'redis'.

production.ERROR: Redis connection [cache] not configured. {"exception":"[object] (InvalidArgumentException(code: 0): Redis connection [cache] not configured. at /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php:119)

Steps to reproduce the issue

Steps to reproduce the behavior:

  1. Open the .env-File with an editor
  2. Set CACHE_DRIVER=redis
  3. Save the file

    Output of the diagnostics [REQUIRED]

Diagnostics

Info: Latest version of PHP is 7.4 Warning: Using 32 bit PHP, recommended upgrade to 64 bit Warning: Dropbox import not working. dropbox_key is empty.

System Information

Lychee Version (git): master (0e3289c) - Probably more than 30 commits behind master DB Version: 4.0.6

composer install: --no-dev APP_ENV: production APP_DEBUG: false

System: Linux PHP Version: 7.3 PostgreSQL Version: PostgreSQL 11.7 (Raspbian 11.7-0+deb10u1) on arm-unknown-linux-gnueabihf, compiled by gcc (Raspbian 8.3.0-6+rpi1) 8.3.0, 32-bit

Imagick: 1 Imagick Active: 1 Imagick Version: 1690 GD Version: 2.2.5

Config Information

Mod_Frame_refresh: 30 sorting_Albums_col: max_takestamp sorting_Albums_order: ASC SL_enable: 0 SL_for_admin: 0 check_for_updates: 0 sorting_Photos_col: takestamp sorting_Photos_order: ASC imagick: 1 skip_duplicates: 0 lang: en layout: 1 image_overlay: 1 default_license: none small_max_width: 0 small_max_height: 360 full_photo: 1 delete_imported: 0 Mod_Frame: 1 image_overlay_type: desc compression_quality: 90 landing_page_enable: 0 landing_owner: John Smith landing_title: John Smith landing_subtitle: Cats, Dogs & Humans Photography landing_facebook: https://www.facebook.com/JohnSmith landing_flickr: https://www.flickr.com/JohnSmith landing_twitter: https://www.twitter.com/JohnSmith landing_instagram: https://instagram.com/JohnSmith landing_youtube: https://www.youtube.com/JohnSmith landing_background: dist/cat.jpg thumb_2x: 1 small_2x: 1 medium_2x: 1 site_title: Lychee v4 site_copyright_begin: 2019 site_copyright_end: 2019 additional_footer_text:
display_social_in_gallery: 0 public_recent: 0 site_copyright_enable: 0 public_search: 1 medium_max_height: 1440 medium_max_width: 2560 version: 040006 recent_age: 1 public_starred: 0 downloadable: 0 photos_wraparound: 1 zip64: 1 map_provider: Wikimedia force_32bit_ids: 0 share_button_visible: 0 update_check_every_days: 3 has_exiftool: 1 import_via_symlink: 0 location_decoding_timeout: 30 location_show: 1 location_show_public: 0 rss_enable: 0 rss_recent_days: 7 rss_max_items: 100 prefer_available_xmp_metadata: 0 location_decoding: 1 map_include_subalbums: 1 has_ffmpeg: 1 map_display: 1 map_display_public: 1


### Browser and system
System: `Arch Linux`
Browser: `Firefox 76.0.1 (64-Bit)`
Server-System: ` Raspbian GNU/Linux 10 (buster)`
d7415 commented 4 years ago

Did you also set these?

vorlif commented 4 years ago

Yes, that is set and also correct.

Here the full stacktrace, if its help:

[2020-05-26 13:22:32] production.ERROR: Redis connection [cache] not configured. {"exception":"[object] (InvalidArgumentException(code: 0): Redis connection [cache] not configured. at /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php:119)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(90): Illuminate\\Redis\\RedisManager->resolve('cache')
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(242): Illuminate\\Redis\\RedisManager->connection('cache')
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(54): Illuminate\\Cache\\RedisStore->connection()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(97): Illuminate\\Cache\\RedisStore->get('http://api.gith...')
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(383): Illuminate\\Cache\\Repository->get('http://api.gith...')
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\\Cache\\CacheManager->__call('get', Array)
#6 /var/www/html/app/ModelFunctions/JsonRequestFunctions.php(26): Illuminate\\Support\\Facades\\Facade::__callStatic('get', Array)
#7 /var/www/html/app/Metadata/GitRequest.php(18): App\\ModelFunctions\\JsonRequestFunctions->__construct('http://api.gith...', 3)
#8 [internal function]: App\\Metadata\\GitRequest->__construct()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(845): ReflectionClass->newInstanceArgs(Array)
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(261): Illuminate\\Container\\Container->build('App\\\\Metadata\\\\Gi...')
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(801): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build(Object(Closure))
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Metadata\\\\Gi...', Array, true)
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Metadata\\\\Gi...', Array)
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Metadata\\\\Gi...', Array)
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(955): Illuminate\\Foundation\\Application->make('App\\\\Metadata\\\\Gi...')
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(875): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(836): Illuminate\\Container\\Container->resolveDependencies(Array)
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(261): Illuminate\\Container\\Container->build('App\\\\Metadata\\\\Gi...')
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(801): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build(Object(Closure))
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Metadata\\\\Gi...', Array, true)
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Metadata\\\\Gi...', Array)
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Metadata\\\\Gi...', Array)
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(955): Illuminate\\Foundation\\Application->make('App\\\\Metadata\\\\Gi...')
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(875): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(836): Illuminate\\Container\\Container->resolveDependencies(Array)
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\\Container\\Container->build('App\\\\Http\\\\Contro...')
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Contro...', Array, true)
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\\Foundation\\Application->resolve('App\\\\Http\\\\Contro...', Array)
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make('App\\\\Http\\\\Contro...', Array)
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(253): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Contro...')
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(960): Illuminate\\Routing\\Route->getController()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(921): Illuminate\\Routing\\Route->controllerMiddleware()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(702): Illuminate\\Routing\\Route->gatherMiddleware()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(678): Illuminate\\Routing\\Router->gatherRouteMiddleware(Object(Illuminate\\Routing\\Route))
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(628): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(617): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#42 /var/www/html/vendor/bepsvpt/secure-headers/src/SecureHeadersMiddleware.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Bepsvpt\\SecureHeaders\\SecureHeadersMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /var/www/html/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#56 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#57 /var/www/html/public/index.php(74): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#58 {main}
"} 
d7415 commented 4 years ago

Interesting. I'm not sure where it's getting "cache" from. It looks like we set "default" and that the function throwing the error will use "default" unless told otherwise.

Unfortunately I don't think anyone on the team uses redis, so this doesn't get much testing. It has definitely worked for other users though.

d7415 commented 4 years ago

Do you have predis or php-redis installed?

vorlif commented 4 years ago

Do you have predis or php-redis installed?

php-redis is installed.

I am not a PHP developer, but I have tried the following: I have changed this line to default. Then I get a new error message:

[2020-05-26 14:14:26] production.ERROR: Class 'Predis\Client' not found {"exception":"[object] (Error(code: 0): Class 'Predis\\Client' not found at /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php:29)

I think I could install Predis via composer now - but then I wouldn't be able to get updates via git because the composer.json file has changed, right?

d7415 commented 4 years ago

php-redis is installed. :+1:

I have changed this line to default.

That'll be where it gets "cache" from then!

Then I get a new error message:

[2020-05-26 14:14:26] production.ERROR: Class 'Predis\Client' not found {"exception":"[object] (Error(code: 0): Class 'Predis\\Client' not found at /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php:29)

Ok. That's the error message encountered here, but that was fixed by installing php-redis...

I think I could install Predis via composer now - but then I wouldn't be able to get updates via git because the composer.json file has changed, right?

I wouldn't recommend it - php-redis should replace predis.

vorlif commented 4 years ago

Interesting, thanks for your help. After changing the client here to 'phpredis' it works. Was lychee designed to change files in the `config' folder?

d7415 commented 4 years ago

After changing the client here to 'phpredis' it works.

Yay!

Was lychee designed to change files in the `config' folder?

No. by the sound of it we should either change that to an environment variable like the other items or, with the "Predis has been abandoned by the package's original author and may be removed from Laravel in a future release." message, just change the default.

@ildyria ?

ildyria commented 4 years ago

No clue.

nagmat84 commented 2 years ago

As there has been no post to this issue for the last two years, I am closing this issue.