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?)

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.
    – Jamsi
    Feb 21 '13 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.