I am running Ruby on Rails 3, and I have an application that uses namespaces to handle more "internal concepts." With “internal concepts,” I mean that every namespace is used to process a specific resource of my application. For example, the namespace is “users” and it is used to process user sessions and authorization, the other is “blogs” and it is used to process all posts and comments.
I think this is a “convenient” solution to avoid a lot of problems, but not the best.
My RoR application currently consists of this file system structure:
# "users" and "blogs" are namespaces RAILS_ROOT/app/controllers/users RAILS_ROOT/app/controllers/blogs RAILS_ROOT/app/models/users RAILS_ROOT/app/models/blogs RAILS_ROOT/app/views/users RAILS_ROOT/app/views/blogs ...
I would like to switch the namespace “users” and “blogs” in the two RoR applications using subdomains to have something like this:
http://main.com
In a few words, I think I'm trying to scale Out * my application or maybe create a Web service for each RoR application, but my problems are:
1. What problems can I encounter?
I noticed problems with session support (in my case I process cookies) between applications, but I think this is not the only problem.
2. How to handle the communication between the three RoR applications in my case?
I noticed that I can use ActiveResource to exchange information, but I have to pay attention to information such as user authentication.
Should I implement the OpenID / Oauth protocol to support user authentication?
I think that I should provide authentication of the user using an HTTPS connection, if there is a connection between subdomains. It's true?
3. How do I organize work and resources?
With all that said , I would not use (absolutely) plugins or gems, but if I need to, I would like to implement my own strong> handler .
In the end, I would like to have 3 RoRs of “simple” and separate applications without using namespaces in each of them and which can communicate with each other:
# "Main" application for http://main.com ROOT_MAIN/app/controllers/ ROOT_MAIN/app/models/ ROOT_MAIN/app/views/users ... # "Users" application for http://users.main.com ROOT_USERS/app/controllers/ ROOT_USERS/app/models/ ROOT_USERS/app/views/users ... # "Blogs" application for http://blogs.main.com ROOT_BLOGS/app/controllers/ ROOT_BLOGS/app/models/ ROOT_BLOGS/app/views/users ...
By the way: a good approach to using namespaces that I do?
PS: If you need other information, let me know and I will update the question.
* From the O2 Software Process : “Scale Out” refers to the concept of adding more servers to an existing fleet, as opposed to “Scale Out,” which means replacing existing (slow) servers with new (and faster) servers.