zf-fr / zfr-eb-worker

ZfrEbWorker is a thin layer to simplify the usage of SQS queues and Elastic Beanstalk environments
MIT License
8 stars 2 forks source link

Just some questions... #49

Closed wysow closed 7 years ago

wysow commented 7 years ago

Hello,

First thanks for this useful library.

I'm wondering how you use it on EB as only php7.0 is officially supported? Maybe with docker... Can you share a configuration example or something?

And I'm wondering how Diactoros can be used here https://github.com/zf-fr/zfr-eb-worker/blob/master/src/Listener/SilentFailingListener.php#L8 as it does not seems to be in the composer.json file? I guess that this library should be used in a Zend Expressive project or something similar right?

bakura10 commented 7 years ago

Hi,

Thanks for your comment. We indeed maybe went a bit too far by setting 7.1 as minimum dependency, sorry :(.

Indeed, we are using multi container docker here which allows us to use 7.1 (or any other version). We are using our own, super light image here: https://github.com/maestrooo/eb-docker-php7

You can see an example on how we use it here: https://github.com/maestrooo/eb-multi-container-skeleton

Note this repo has not been updated for long but it's roughly the same code. You can just specify a tagged version of our docker image here: https://github.com/maestrooo/eb-multi-container-skeleton/blob/master/Dockerrun.aws.json#L20 to make sure you do not have any breaking issue.

For the Diactoros issue, that's a very good point! @danizord do you have any idea on how we could maybe remove this dependency? Or should we add Diactoros here?

danizord commented 7 years ago

@bakura10 indeed that's an implicit dependency. We can make the dependency optional by allowing to inject a custom response prototype in SilentFailingListener constructor.

@wysow care to provide a PR? :)

bakura10 commented 7 years ago

Let's keep that simple and just introduce a dependency of Diactoros then :p..

wysow commented 7 years ago

Sure adding Diactoros as an explicit dependency seems to be the fastest way to go... ;) @bakura10 thanks for the explanation. We started to use your "package", seems promising so far so thank you.

wysow commented 7 years ago

Reopening this thread as I'm wondering how do you handle Elastic Beanstalk worker environments with a multi-container docker setup?? I mean how can Elastic Beanstalk know that it must use the cron.yaml file for example?

I'm not really sure my question is clear though...

bakura10 commented 7 years ago

Hi !

We're using this library in multi-container Docker but I'm not sure to understand the question. As soon as you include a cron.yaml file at the root of your deployed zip, Elastic Beanstalk will start reading it and will do POST request at the requested interval to your app.

wysow commented 7 years ago

Sure it's working now, seems like the "worker" environment must be launched from the web console initially and not from the EB cli...