1

First of all, I’m not an admin, so excuse me if my questions are kinda obvious/lame – I’m just a ruby programmer, which would like to host few apps on his server;)

Lets say, that I’ve got 3 applications, which I want to host on my VPS. I’d like to separate all of them as much as possible (separate ruby/postgres versions etc.).

Currently, I’m thinking about which design should I use to achieve this. Recently, I tried vagrant, and I really like an idea of having all application in separate VMs.

My question is, if it’s not overengineered to have this sites in different virtual machines? Could someone point out some main advantages/disadvantages of that approach vs. approach with just having 3 users, with ruby/postgres installed locally? I spotted this:

  • With VM approach, I have complete separation – I can reboot/reinstall one VM, without affecting another one.
  • If something goes wrong with one VM, it shouldn’t have performance impact on another VM
  • I can have exactly the same environment on both development and production env
  • VM approach takes much more ram/cpu just to run 3 OSes

My another question is about routing requests:

Lets say that I’ll install nginx on my VPS, and I’ve got 4 domains connected to this:

  • example.com and foo.com => App1
  • bar.com => App2
  • other.io => App2
  • asd.bar.com => App3

Is there any easy way to set up that routing? I’m dreaming about some kind of config file, where I can specify which domain should point to which app…

If not, could someone post some resources, where I can find something about that routing? (I’d really like to automate somehow this, so adding another site/VM should also setup that routing)

  • Rather than running VMs within VMs (which VPSes are), why not just purchase separate, smaller VPSes for each? – ceejayoz May 11 '13 at 12:06
  • 1
    I was going to mention the same thing. You are going to be doing nested virtualization, which is a really cool concept, but not highly supported. There are sites like lowendbox.com showing cheap VPS's are available. I pay something like $8 a month and have 4 VM's (atlanta, seattle, vancouver, chicago). They may not be production ready, but they really come in handy for development. – David Houde May 11 '13 at 12:11
  • Well, right, I also have an impression, that VMception isn’t the best thing. But why not separate VPSes? Short answer: I already have (relatively) strong VPS, plus this approach is quite portable – if someday I’ll get real server instead of having VPS, everything will be pretty much the same. – RubyProgrammer May 11 '13 at 12:28

1 Answers1

0

I would suggest taking a look at http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/

It uses Passenger standalone as reverse proxy to accomplish this.

There also seems to be some people accomplishing this using nginx and thin.

I wouldn't personally recommend VM's as RAM is usually the limiting factor, and most VPS's are short in that area already.

David Houde
  • 3,200
  • 1
  • 16
  • 19
  • OK, I considered this, and I agree that having this separation on VM level is a little bit overkill – I’ll go with separate user approach – thanks for comments! – RubyProgrammer May 12 '13 at 15:39