lorisleiva / laravel-docker

🐳 Generic docker image for Laravel Applications
MIT License
934 stars 314 forks source link

[Vote] Redis extension #10

Closed itguest closed 1 year ago

itguest commented 6 years ago

Hi,

Thank you for great job.

Could you add mongodb and PHPREDIS extensions as well?

Cheers.

lorisleiva commented 5 years ago

Hi there 👋

Sorry about the late reply, I was just observing whether this addition would get some upvote.

I'm trying to keep this generic image as small as possible whist covering 80% of Laravel use cases.

I'm going to leave this issue open and let people vote with thumbs up. If I see that this is popular and necessary for most projects, I'll add it to this DockerFile. Otherwise it is difficult for me to draw the line.

In the meantime you can fork this repository and upload your own DockerFile to Docker Hub.

youyi1314 commented 5 years ago

I need this too, now i facing this error when using phpredis

image

is there any temporary fix for this? Thanks

lorisleiva commented 5 years ago

@youyi1314 Did you recently upgrade to Laravel 6 by any chance? (Laravel docs)

youyi1314 commented 5 years ago

@youyi1314 Did you recently upgrade to Laravel 6 by any chance? (Laravel docs)

Problem fixed. the php-redis fixed by install using pecl install redis

lorisleiva commented 5 years ago

Now that Laravel defaults to this Redis client, we should probably add it to the docker image.

dakira commented 4 years ago

I'm against adding mongodb but for adding phpredis.

Fogest commented 4 years ago

Here is what I did to try and add the redis support however it does not seem to work for me: https://github.com/Fogest/laravel-docker/commit/5b00611c41acc692a8cd55f6e92e14db20d0bb4e

I get the following error:

$ php artisan key:generate
    LogicException 
   Please make sure the PHP Redis extension is installed and enabled.
   at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:76
     72|     protected function createClient(array $config)
     73|     {
     74|         return tap(new Redis, function ($client) use ($config) {
     75|             if ($client instanceof RedisFacade) {
   > 76|                 throw new LogicException(
     77|                         extension_loaded('redis')
     78|                                 ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
     79|                                 : 'Please make sure the PHP Redis extension is installed and enabled.'
     80|                 );
       +22 vendor frames 
   23  [internal]:0
       Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Laravel\Telescope\TelescopeServiceProvider))
       +5 vendor frames 
   29  artisan:37
       Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

@lorisleiva Did you have any luck adding this to this docker image as predis is now considered an "abandoned" package and suggests phpredis.

I am pretty new to both docker as well as redis so I am probably not the best candidate for debugging this and trying to figure out why my changes aren't working.

lorisleiva commented 4 years ago

Hi there 👋

Thanks for sharing @Fogest.

Still struggling to find some time to work on this. A PR would be most welcome. 🙇

EDIT: Also, I've updated the issue since we're only going to tackle Redis for now. For those who need MongoDB, feel free to open a new issue and start voting with "👍". 🙂

Fogest commented 4 years ago

@lorisleiva I'd love to submit a pull request however I am not sure if I actually got it working correctly or not. I will do some testing and see if my solution works or not. I was finding a lot of problems with it.

lorisleiva commented 1 year ago

Just realised this issue was not closed like 2 years ago haha. Redis is now available on the Dockerfiles.