I am currently working on a Rails 3 project, which is divided into four parts:
- Public website
- Administration / Backend Website
- Models
- API for accessing third-party data
Since the models are shared between the three key components, I want them not to be in the same main project, however each part needs access to the models, but I do not want to repeat the code and have different versions everywhere.
I currently have the model code in the gem, and in every Gemfile project I refer to them with the following line:
gem "my_models", :path => "../my_models/"
However, when I deploy to our test servers for my employees to evaluate the system, I need to get the models out of the external repository, so I will change the line above as follows:
gem "my_models", :git => "git@private.repository.com:username/my_models.git"
This in itself works well, but its quite awkward in terms of “versions” (ie I need to have a version outlined every time I plan to deploy the changes to test servers), switch the line to using git instead of local and make sure i click the files correctly.
I used to use the generic git submodule, but it was just as inconvenient.
I would prefer not to build everything into one megaproject, as they tend to become monstrous and difficult to maintain, and I would also like to share the problems, if possible, so most of the changes that I made to the administration site do not have much chances to influence other components - it is obvious that models can create problems, but this is a risk that I have considered and understood.
What would people suggest there when it comes to something like that? Or, am I not mistaken about this?
Additional Information:
This application is a correspondence with an existing website that monitored the “all in one project” model - unfortunately, there are two problems here:
- The application was poorly developed - I inherited this project, and when I first took it, the loading time was ~ 2 minutes per page with one user - it has since been reduced, but still has problems in all
- We are currently at the limit of the capacity of the current site, and we expect that in the next 6 months we will need more workload. However, scaling with the all-in-one application means that we will spend resources when scaling the back end of a site that does not need it.
Essentially, there are two things I want to separate: the front end (which is a public website and API) and the back end - all I know about software development tells me that combining all of this is not an ideal solution (and past history shows me that separating the two is a good step in terms of ensuring front-end performance).
Perhaps I need to look at it from a different angle - to save models in each project and instead of sharing them between projects, have a reduced subset of functionality for each functional area (that is, the backend should know who created it but the front end doesn't really care about this, so omit this logic when reading in the model).