0

In the process of deploying multiple EC2 instances running a Rails app over Unicorn. I currently have a "front end" server running nginx with multiple "Unicorn" upstream providers.

At night, I'd like to turn off a few unicorn servers and in the morning boot them up again (which I have working fine).

Should I also be removing/commenting out the upstream providers in my nginx conf and then doing a nginx config load? (To stop nginx from trying to send clients to my switched-off ec2 instances).

Is there a better way to handle this? (HAproxy perhaps?)

1 Answer 1

0

I think one of the simplest ways to implement this, is to use LVS. With LVS you could create a virtual server to be the backend of your Nginx, possibly on the localhost of each Nginx itself. Then you just point the Nginx upstream to the LVS Virtual Server. The Unicorns are the backends of the LVS, defined as server-address.

That way it should be really easy to add/remove backends from the Virtual Server via some cronjob, because you can do these actiones via simple ipvsadm commands.

Of course it would also be possible to add/remove servers from the Nginx upstream definition via some scripts, but I would regard the LVS solution to be much easier to script and less likely to fail.

1
  • LVS seems overkill for what I'm trying to achieve. Cheers though.
    – James
    Feb 21, 2013 at 1:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .