Multiple Redmine instances with one codebase?

Added by Felix Schäfer over 11 years ago

Hello,

I'm running a somewhat patched redmine trunk with passenger on a.some.domain, and I'd like to use the same codebase for a second redmine instance on say b.some.domain. If I understand the environment concept well, I would have to:
- copy config/environments/production.rb to config/environments/other_env.rb,
- configure another db for other_env in config/database.yml, same for config/email.yml,
- do the whole installation shebang (install migrations, populate the db, ...) for other_env,
- configure passenger to use RAILS_ENV="other_env" on b.some.domain.

Did I miss something? Does anyone have a good argument why I shouldn't be doing this?

Thanks.

Replies (7)

RE: Multiple Redmine instances with one codebase? - Added by Eric Davis over 11 years ago

Felix Schäfer wrote:

Did I miss something? Does anyone have a good argument why I shouldn't be doing this?

  1. Your file uploads will be shared and could be overwritten (unlikely but it's possible)
  2. Sessions might be shared if you are not using cookie session (default in trunk). So User 13 in one might be able to login to the other install and gain access.
  3. I'm not sure if passenger can have two sites using different environments using the same path. You'd have to try it.

What's the reason you don't want to just have two separate installs?

Eric Davis

RE: Multiple Redmine instances with one codebase? - Added by Felix Schäfer over 11 years ago

It was more of an intellectual exercise than something I'd really need. I was thinking about it, because I don't see how I could get my LDAP groups into redmine, and as I don't have that many groups, just giving them each a redmine instance seemed like a possibility, but having explored redmine a little bit more, I'll just stick with one redmine and manage the users/group in the redmine from hand and independently of the LDAP.

Thanks for the insight.

RE: Multiple Redmine instances with one codebase? - Added by Matthew Connerton over 10 years ago

I understand this is an old post, but I am looking to do something similar, that is a multi site install of redmine so a.example.com, b.example.com, and c.example.com can all have the same code base, but independent databases.

Now I am a lamp developer and can only read ruby, never mind write it, but I liken this to possibly how drupal does its multi site.

There configuration is run under a /sites/ folder. So by default you have /sites/default/ and /sites/all/

then for multi site you would create /sites/a.example.com/ and /sites/b.example.com/

So in redmine case there could be /sites/default/database.yml and /sites/a.example.com/database.yml

Now before people start yelling at me, I understand this is not how redmine is designed, I'm just trying to make an analogy from my language to yours.

Another idea I had was to set RAILS_ENV to whatever the hostname was, and then just create the connections in the database.yml file.

This feature would be useful if you have a single codebase, with a wildcard dns, you could quickly create new instances of redmine with a few shell commands versus trying to automate creating an entire subdomain, hosting, etc

My two cents :-)

RE: Multiple Redmine instances with one codebase? - Added by Felix Schäfer over 10 years ago

Matthew Connerton wrote:

Another idea I had was to set RAILS_ENV to whatever the hostname was, and then just create the connections in the database.yml file.

That would be the way to go, though you would need to duplicate the config/environments/production.rb file to an accordingly-named one. The other 2 things you would need to change would be the path uploaded files are saved to (currently files/ whatever environment you are in), and everything that might write to tmp/, which IIRC isn't environment-aware and might have one environment hit the cache from another or as Eric said have sessions from one used in another and so on.

RE: Multiple Redmine instances with one codebase? - Added by cheshirekow . over 9 years ago

Ok, I'm a bit confused by all this. If I have redmine extract at /path/to/redmine, and I want two instances in /path/to/a and /path/to/b, can I not just symlink everything in /path/to/redmine/* into the two sites except files/, tmp/, and config, and then create these directories (i.e. not symlinked) in /path/to/a and /path/to/b?

RE: Multiple Redmine instances with one codebase? - Added by Felix Schäfer over 9 years ago

cheshirekow . wrote:

Ok, I'm a bit confused by all this. If I have redmine extract at /path/to/redmine, and I want two instances in /path/to/a and /path/to/b, can I not just symlink everything in /path/to/redmine/* into the two sites except files/, tmp/, and config, and then create these directories (i.e. not symlinked) in /path/to/a and /path/to/b?

You will need to at least add logs/ and public/plugin_assets/ (and vendor/plugins if you don't want to share plugins) to your list, I don't guarantee it's complete though. Also note that to upgrade that installation, you will still need to shut both instances down, go to both to perform DB updates and all necessary stuff, and so on, the gain of "just symlinking" Redmine installation is a few MB at most, and in my opinion not worth the risks/maintenance pain involved.

Regarding your confusion: the point here was to differentiate instances based on their environment. In rails apps, you can differentiate rails environments through the environment variable RAILS_ENV, each with its own DB, config and whatnot parameters, and run multiple instances of an app with different settings from the same codebase (without symlinking), Redmine's got too many places not "respecting" that scheme though, so it's not recommended to serve multiple instances with this pattern either.

RE: Multiple Redmine instances with one codebase? - Added by Stéphane Gourichon about 8 years ago

FWIW,

Redmine packages in Debian (and therefore derivatives, like Ubuntu) are patched for multi-site by Jérémy Lal.

I've been using them on Ubuntu via https://launchpad.net/~ondrej/+archive/redmine (because it was more up-to-date than stock packages).

It works well for me, expect one site (which is not very different from the others) that has troubles when writing to it via the https frontend. But it might actually be unrelated (like bad https frontend configuration).

These URLs are on similar topics :
http://www.redmine.org/projects/redmine/wiki/Sub_URI_for_multisites_at_one_domain
http://www.redmine.org/boards/2/topics/23491
http://www.redmine.org/boards/2/topics/7494?r=15761

(1-7/7)