Question

I have a Rails app running on AWS elastic beanstalk on a web tier. I want to send email notifications to users so I'm using sqs to send messages to a queue:

sqs = AWS::SQS.new
sqs.queues.named("messaging_queue").send_message("HELLO") 

and then I would like to take these messages off the queue using a worker tier instance.

My issues is that when I create the worker tier instance from the console it asks for the application version which defaults to the latest deployed version to my web tier. I don't want to upload my entire web application to the worker, just the code responsible for performing the emailing.

What's the best way to do this? I could upload a zip but I would like to just use git

Was it helpful?

Solution

Can you refactor the code that is responsible for sending emails into a separate library? That way you can create a new web app which just wraps around the email functionality in your library and runs on a worker tier environment. The worker daemon will post messages to your new worker tier app which will then send the email. That way you do not have to deploy your entire code base to your worker tier environment.

You can use git and eb to achieve this. Your worker tier application version and webapp application version can be managed in different branches or in your case it seems better to keep them in different git repositories. If you wish to use branches then you can read about the eb command "eb branch", it may be useful.

Read more about eb here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top