-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommended workflow for Elastic Beanstalk #169
Comments
I'm also interested in this! The Deployment page on the wiki explains things very well for Heroku, but I am unsure about how to do something similar for AWS EB. |
I'm not sure what exactly you're asking.
Why not load the daemon within the environment of your application? Similar to how delayed job or resque works. |
Trying to use Shoryuken to process jobs coming from the webhook is probably not the right strategy. The Shoryuken server and the EB worker daemon are both trying to accomplish the same thing, so using both really isn't a great idea. You can still use Shoryuken to create the SQS message, but no matter what you do after that Shoryuken isn't natively going to be designed to handle messages coming off the queue through EB. How you set things up will depend on what kind of app you have, but assuming it's a Rails app on the web environment, a good way to approach it would be to just add a controller that is specifically used in the worker environment, and deploy the same app to both. Have the daemon hit that endpoint with the webhook, and then have the controller action do the little bit of work necessary to construct and The way EB is set up currently, it's really just not a good place to deploy a Shoryuken server. If you want to deploy your web app on EB, it may make more sense to use ECS to handle the Shoryuken servers. Those containers end up being fairly simple (they don't really have any other container dependencies), so it's easy to configure their task definitions, and also handle the load balancing and auto-scaling if that's something you need. |
I'll answer how we do this. eb deploy - deploy to default web tier env In order to know when code is inside worker/web env we have an environment variable defined in each configuration like so: WORKER_MODE=0 |
Thanks all for the answers. Sorry for my late reply. [1] @Senjai I meant how could shoryuken transform the SQS message, received on my worker http endpoint, into a job that could be performed? @farski to me indeed shoryuken sounds like to much code for little benefit. I guess I should my make own ActiveJob adapter for just serializing the jobs as SQS messages and some middleware that catches the SQS message on the worker side, deserialize it and process it. @dyatlov if I understand you well this means I should spawn a shoryuken worker process? (bundle exec shoryuken -r worker.rb ....). I think EB has no documented features for starting worker processes after deploy. So then I would still end up with a hacky solution ? [1] I had a filter in Gmail configured that skips my inbox when i'm not @mentioned |
@ruuts right, it means that you have to run the process manually. but you would anyway need to do it, that's the way how worker env is designed. This is my config: https://gist.github.com/dyatlov/4ca6ab8eb291d520036e It's copied from current project so it has some unneeded info, im lazy :)
|
@dyatlov Thanks! I see what you mean. But it uses the /opt/elasticbeanstalk/hooks/appdeploy/post/ directory. As far as I know it's undocumented and thus has an unreliable future. Therefore I would not use this in production. Correct me if i'm wrong. |
Correcting: https://forums.aws.amazon.com/thread.jspa?messageID=493887 Directories and all the things are @ruuts ^^ |
@dyatlov thanks. The post by Kenta@AWS is correct by David@AWS saying:
Therefore I think it's not wise to use the hooks directory before Amazon documented it themselves. Anyways I think I will make a custom ActiveJob adapter and middleware that responds to the endpoint. |
https://github.com/tawan/active-elastic-job seems to be the correct solution |
Hi!
We are about to switch over to Elastic Beanstalk.
Currently we use delayed_job with a hacky method to instantiate workers.
You don't know when Amazon drops the (undocumented) support for post deploy scripts.
The right solution would be deploying a separate worker environment alongside the web environment.
Another important factor is that workers processes can auto scale separate from the web processes.
The worker environment works by:
How should the web server process the SQS message?
I can imagine instantiating Shoryuken manually and feeding it the message.
An alternative could be using the AWS sdk but I like a more abstracted version so that we are less tied to Amazon.
Thanks for helping out!
The text was updated successfully, but these errors were encountered: