Support for Multiple Sites

sunsetsystems wrote on Thursday, June 17, 2010:

I have a project to support multiple independent OpenEMR sites from a single installation of OpenEMR.

That is, a single installation of the web scripts, but still supporting a separate database for each site. This is easier now that the global parameters and code types have been moved to the database.

Here are the things I can see that need to be done:

1. Create a “master” configuration file (this can be a flat file, something like /etc/openemr.conf).  The main purpose of this is to contain the database name/user/password for each database that is supported.

2. Create a master configuration GUI (web script).  This supports adding/deleting sites (and thereby modifying the master configuration file), and wraps the existing scripts used to set up and upgrade a site. Thus the GUI will display:

o A list of current sites, each with Upgrade and Delete buttons.
o An Add New Site button.

It would invoke setup.php, sql_upgrade.php, acl_upgrade.php, sl_convert.php as needed.

3. Modify the Login page to include a site selector and to not depend on globals.php prior to successful login.

4. Fix up sqlconf.php as needed.

5. There are still assorted lesser-used things in the “custom” directory like clickoptions, letter templates, the statement template, the fax cover sheet, etc. I think these are best transitioned to site-specific custom directories in the short term (don’t want to bite off too much too soon).  These should be created at setup time or upgrade time. Use directory names like custom_site/<databasename>/.  Move includes/config.php into there also.  This will require some simple changes in various places.

Comments?

Rod
www.sunsetsystems.com

stephen-smith wrote on Thursday, June 17, 2010:

That’s not how I would approach it.  I would borrow heavily from the Drupal 6 mutli-site design.  Each site would have a different URL, so they would not share a login page.  Configuration files would be stored in the heirachical directory structure that reflected the different URLs.

This style would not have a master configuration file or master GUI.  Creating a new site could be as easy as adding a new Apache VirtualHost/Directory section to serve the same files at a different URL.

That said, I’ve never had to work in Drupal 6 in mutli-site in production; it might be a nightmare.

Still, we aren’t the first PHP web application to want to support multiple storage back-ends on one set of scripts, so I think it would be a good idea to study what has come before so we don’t make the same mistakes.

sunsetsystems wrote on Thursday, June 17, 2010:

Thanks for the comments.  I’ll take a look at Drupal’s methods (I use Drupal for my own web site).  However I’d like to eliminate any need to manually change the Apache configuration when adding a site.

Rod
www.sunsetsystems.com

zhhealthcare wrote on Thursday, June 17, 2010:

Rod
This would be great, especially for people who host multiple providers on their Servers.  We would be happy to provide any assistance that you may need in implementing this.

Thanks
Sam

bradymiller wrote on Thursday, June 17, 2010:

Rod and Stephen,
This sounds pretty disruptive considering it’s gonna only be for a small minority of the userbase. Please ensure simple install and translation of login page (and translation options) are not disrupted (userbase is much larger that relies on these things). Wasn’t somebody previously simply using symbolic links etc. to support multiple sites.
-brady

sunsetsystems wrote on Thursday, June 17, 2010:

I would absolutely want to do this in a non-disruptive way.  I.e. if you don’t have multiple sites then there is no extra work and things would look about as they do now.  Don’t want to cause any grief for anyone!

And I did look briefly at Drupal 6.  What they do is have a “sites” directory off the installation base directory, which by default has a “default” subdirectory containing a configuration file and possibly more.  Then they have some rules for mapping the URL to possible alternate subdirectory names under sites/.  If there is no match then they revert to the default subdirectory.  There are no tools for automatically creating a new site, you have to manually create the directories and configuration files… so it’s not very friendly.

I think we could borrow from this scheme to avoid a “master configuration file”, but also adding some tools to automate the installation of additional sites.

Rod
www.sunsetsystems.com

saikensf wrote on Friday, June 18, 2010:

I’m intending to host multiple customers off a single server, but not have them share a URL.  That way they can run different revisions of the code as they like.

However, I would like to make upgrading easier.  Step one for that to me seemed to be taking globals.php and making it read a sysconfig table in the database rather than hardcode all the values.  It could pull the data initially then store it in session rather than taking a db hit for every page. 

From what you wrote in the original post can I infer this has already been done? 

stephen-smith wrote on Friday, June 18, 2010:

saikensf: Yes, somewhere in the existing 4.0.0 development line (not sure exactly where), the globals.php file was left as a stub/default and globals are now both editable via the GUI and stored in the database.

I don’t know if this is being stored in the session.

sunsetsystems wrote on Friday, June 18, 2010:

Globals are not stored in session variables, at least not any more than before.  I doubt that would be a noticeable optimization, if it is one at all.

Rod
www.sunsetsystems.com

saikensf wrote on Friday, June 18, 2010:

Not worth doing a patch for agreed, just something I was going to do while I was there. Since it is slightly better, easily done, and doesn’t obfuscate the code any.

Ok, next step was going to be taking files that differ from one installation to the next and isolating them in a top level directory.  So sql_conf.php, css files, anything else that I don’t know about, so that deployment automation can just ignore that folder when upgrading a site vs having to maintain a list of files to ignore.

So git is the most masterful master?  If I pull that I can see everything that has been done?

Thanks,
-Simone Aiken

saikensf wrote on Friday, June 18, 2010:

Sorry for the changing handles, when I made a real account instead of using the google global sign on it started using my username instead of my display name.

stephen-smith wrote on Friday, June 18, 2010:

CVS is still is official HEAD.  Brady and I are actively using Git to share code for review and comment, but when it is “ready” it gets committed to CVS.  CVS HEAD is also still used for the developer appliance and development demo.  I haven’t seen Andy talking up any of his branches, but the patches submitted by him are clearly from Git’s format-patch command, which makes them really easy to apply with Git’s am command.

If you prefer Git, CVS HEAD and rel-320 is mirrored to Git repositories on GitHub and Gitorious every half-hour or so.  I do all my work in Git, and use git cvsexportcommit when I want to push into CVS.

I think moving to Git would be possible in the future, but all of us have bigger bugs to squash and CVS works for now.

saikensf wrote on Friday, June 18, 2010:

I’m of the opinion that svn > cvs > git.  But after 3 years using telelogic synergy they are all amazingly awesome. 

Do you have a task list anywhere for the meaningful use effort that I could see?  I’d like to help I’m just not sure how to without stepping on toes.

-Simone

bradymiller wrote on Friday, June 18, 2010:

hey,

Here’s a MU project tracker on the wiki:
http://www.openmedsoftware.org/wiki/OpenEMR_Certification

Tony is the best to guide you to where the most help is needed. Hopefully he’ll chime in.

-brady

tmccormi wrote on Friday, June 18, 2010:

Simone,
   Drop me a line.  I’d be happy to help guide your efforts… :slight_smile:
-Tony 

tony —‘at’—  mi-squared.com

saikensf wrote on Friday, June 18, 2010:

Thanks!

Ahh, task 16 looks right up my ally.  One of the jobs I did for Healthtrans was a data dump of our eligibility information to a clearinghouse so that they could process eligibility requests from doctor’s offices.  Doing that one would be … symmetric. 

-Simone Aiken

hernanmy wrote on Wednesday, June 23, 2010:

Hi,

I have the openEMR v3.2.0,
I get the following error when downloading the icd9 data:

Error getting http://www.icd9data.com/2010/Volume1/001-139/030-041/035/default.htm: Status read failed: Unknown error at c:\xampp\htdocs\openemr\contrib\util\load_icd_desc.plx line 78

it happens when its already downloading the data but it interrupts it,
does someone have happen to have this error??? help please.

bradymiller wrote on Monday, June 28, 2010:

hi hernanmy,
Please don’t post in all forums (we monitor them all). This just will confuse future users that attempt to search through the forums. Place discussion of this topic here:
https://sourceforge.net/projects/openemr/forums/forum/202504/topic/3481029
-brady

allenluo wrote on Monday, July 19, 2010:

I found that the easiest way to do this was to do a fresh install (non-XAMPP version) somewhere in my htcdocs directory and go through the setup.php to let it add a new database and set up the permissions just right for me. Once the setup is done all you need to do is change the session_name to something different in globals.php and make sure it’s the same as $session_name in /openemr/phpmyadmin/libraries/sessions.inc.php

sunsetsystems wrote on Friday, July 30, 2010:

This screenshot of setup.php should give a pretty good idea of how I’m planning for this to work.  For users who do not care about the feature, this is the only extra thing they will see:

http://lh5.ggpht.com/_00bjhEGQiBg/TFNNUwkCqxI/AAAAAAAAACg/cVNlwfKPC3A/s800/siteid.jpg

Any objections?

Rod
www.sunsetsystems.com