Deploying multiple instances of a Rails application - the same code, multiple

First of all, Happy New Year to all.

I'm new to Rails, so please tolerate any misuse of terminology ...

I developed a simple Rails application supported by a MySQL database.

Now I would like to deploy this application to several independent user groups (i.e. this is a club application, and I would like to deploy it to several completely independent clubs).

I would like to use the same Rails application code as much as possible and just have a separate database instance for each club.

Since each instance will run on the same server (as long as loading on the server proves to be a problem), I assume that I can use a different port for each Rails server to manage users in the correct group?

I would read that there are test and production modes, is it possible to have several [additional] instances of production modes, for example. club1, club2, all use the same code with unique databases?

My questions are: how to maintain multiple individual database instances, and also what is the best way to direct them?

Any advice on how to do this is greatly appreciated.

+6
ruby-on-rails
source share
1 answer

If you use Git (I suggest you be!), You can save the central version of your code in one place and then deploy it several times, changing only the database.yml file (it should not be registered in your Git repository in this case) . http://git-scm.com/

Say you put all your code on github.com with the username "snips" and the project is called "clubster". Using something like Heroku, then you do:

git clone https://github.com/snips/clubster.git cd clubster heroku create boxingclub 

Since Heroku automatically configures your database, there is no need for database.yml

 git push heroku master 

And you will have a version of your code deployed at boxingclub.heroku.com

When you make changes to your code, you simply go to each of your settings and do:

 git pull origin master git push heroku master 

Which updates your code in this particular instance of your application.

And if you are a little advanced, you will look at the chef to manage the entire setting for you. http://www.rubyinside.com/chef-tasty-server-configuraiton-2162.html

Another approach would be to have some kind of subdomain system, but I will leave it for others to cover.

+1
source share

All Articles