I am looking to create a shared hosting environment allowing for multiple RoR apps to be running well isolated from one another (and the underlying os), running different versions of RoR as required.
My question is can this be done without having to resort to OpenVZ/Virtualisation?
If so, would the following approach be suitable - what would be required to make apps well isolated from each other and the OS?
NGinx, single instance for load balancing
Unicorn, multiple instances started by NGinx to handle requests (capable of running different versions of RoR
(Rbenv or RVM) and Bundler allow to isolate gems of different Rails applications.
So there will be no troubles with that.
Each rails app will have its own instance of Unicorn(puma, thin, whatever).
Nginx will have separate domain name based virtual host for each rails app, and will forward requests to upstream(Unicorn/Puma).
Each rails app should have separate database at db server too.
So I don't see any problems with isolating multiple rails apps.
For additional isolation you can use Docker, so each app will be running in separate container.
Related
I have a rails application that is currently hosted on Heroku. It is used on our local network only, and my boss does not want a 3rd party hosting our data. I convinced IT to set me up a virtual windows server to deploy my app on. However, it has been very difficult to set up for production.
Is there anyway that I can use a hosting service for my application, but have the database reside on our local network?
Or is there an easier way to deploy a rails app on a windows server? I have been looking into using the Linux Subsystem for Windows.
If your app is used on your local network only, why not ditch Heroku and host your Rails app locally as well? What benefit is a scalable cloud hosting provider giving you? Especially since it seems your boss has security concerns about remote hosting of a database. Bringing the entire thing in house may be the best solution.
Simple answer is yes you can, but why would you. It's simpler to run your application locally than connecting your remote app to a local database.
Your best bet is to use a Linux virtual machine instead of Windows, usually there is to much hassle to get rails application to work on windows, especially compiling native gems.
I suggest that you get a CentOS VM, and install Nginx with passenger gem using rbenv or rvm.
Digital Ocean has a nice guide that explains this process in details:
How To Deploy Rails Apps Using Passenger With Nginx on CentOS 6.5
I am working on an open source project and there is an issue where an upload error only seems to occur on the production side that is running apache and unicorn.
Due to privacy issues and risks, I am unable to mess around in the actual production side (such as creating a temp id for myself with various privileges.
Is there anyway that I can quickly create a VM with such setup in my own computer that would mirror the live site?
The site is running in RoR 4, latest unicorn, and latest stable version of apache.
There are a couple of ways you can be able to accomplish this. You can use vagrant and also with the rising popularity of Docker containers, you can easily model production environment on your computer. Since you indicated a faster way to get the VM up and running, I would recommend using railsbox.io. Its amazing and it saves you a lot of time. According to their webiste -
Fast and easy Ruby on Rails virtual machines. Streamline your
development workflow in no time by creating production-like virtual
machine with your development environment. Try this extremely simple
to use VM configuration tool to create new Ruby on Rails server using
vagrant and ansible.
The app helps you setup a VM with ease.
I have several Rails apps running by Passenger+nginx 1.2.
I need to add some Comet features to one of them, but i don't want to add any tcp_module and rebuild nginx, i just need separate Faye+Thin instance running on subdomain of my app http://faye.myapp.com:9292 (on the same Ubuntu machine) and listening clients directly.
Is there elegant solution of that problem?
I've just finished setting up my server with phusion passenger and nginx, complete with ruby on rails that are all running swimmingly. Now I can and I have deployed an application with capistrano and I got that working right.
My issue is that I want to host several applications on different domains and deploy them with capistrano on the same server. Is this even possible or am I just hoping for too much? I couldn't seem to find anything on this so any help is appreciated.
If your applications are just standalone applications that don't have dependencies on each other (i.e. you deploy them individually) then just deploy them with capistrano as you normally would.
By default capistrano will deploy to a folder such as /var/www/app_name so as long as all of the apps have a different name configured in their app_name.rb they will be blissfully unaware of each other.
You may need to be a little bit more careful with some of the services you may use, e.g. you may wish to namespace your memcache keys (or run separate memcache instances) so as to avoid clashes between apps.
What are the useful gems or softwares that will help deployment of RoR 3.2 application on the clouds?
There is no specific requirements since I just want to get experience with it. But I am thinking of Amazon EC2 as a primary environment to test the application. The goal is to deploy it in the multiple servers.
I guess the most naive way would be launching the same application on multiple servers at the same time, but that will requires a lot of manual restart/reboot which requires a lot of human resources.
Is a single application of ruby on rails just not suited well for deployment on multiple servers?
We use Capistrano (https://github.com/capistrano/capistrano) to communicate with multiple EC2 instances on AWS.
We use Chef (https://github.com/opscode/chef) to do the system management configuration.
You can get cookbooks for various applications that you want to install (eg nginx, monit, logrotate...) from Opscode (http://community.opscode.com/cookbooks)
You will need both Capistrano and Chef to setup and deploy to AWS.
Puppet is another system management configuration that you can use too. (https://github.com/puppetlabs/puppet)
This is what Capistrano is for.
https://github.com/capistrano/capistrano/wiki/