Hi Carsten, With regards to multi-tenancy I have done and do the following:
- I have setup my db backend to postgresql as well as per description above - Before doing a tenant deployment I create a db on postgresql with their admin client. - After that I run (on a dedicated admin client with a local installation of OFBiz pointing to the db's on postgresql) a special ant build routine that I built. This routine creates the tenant entry in the master db and also creates the admin for the tenant. The adjustments I have uploaded as an improvement into jira. See OFBIZ-3971 https://issues.apache.org/jira/browse/OFBIZ-3971 - Subsequently I load seed data and more via the webbrowser and the framework tools to the instance of the tenant. - . - Above process will ensure that I don't have to bring down my OFBIZ server. Regards, Pierre 2010/10/23 Carsten Schinzer <[email protected]> > Yup, It's runnign here and soon for some customers. > But you're right: I am not intending to do much of dynamic, self-service > stuff since my offer looks more after "managed services" including data > loads, configuration help etc. > That's why I can still afford to have "maintenance windows" and my > customers > are local shops who mostly don't care when they can't access their tools > during weekend-eve's (and we're all one single timeezone as well). > > So forgive me if I have messed up anything in the documentation, but maybe > it's worth we describe both ways in the online documentation? > > Regards > > > Carsten > > 2010/10/22 BJ Freeman <[email protected]> > > > just a thought, you can use a schedule service to export entities like is > > done by webtools. > > this gives you your data that has been added. > > a timed service or cron job can run a svn update for your local svn. > > this gives you versoning, as well a reload abiliity, if necessary > > > > > > So your documentation of using the entityengine.xml and Ant for tenant > says > > that the whole tenant systems has to be shutdown, every time you add a > > tenant. i can see that for a intranet type of website, but not for and > > internet type of website. For an internet type you would have to have > > scheduled maintainence, which mean the new client has to wait, or daily > > maintainence that means the other tenants are interrupted a lot. > > > > I have not looked at the code, but I don't think that those loaded from > the > > entityengine.xml for tenants are access by the tenant code, since it is > not > > loaded into the cache for the entity TenantDataSource. > > Have you run the setup you documented? > > > > > > > > > > ========================= > > BJ Freeman > > Strategic Power Office with Supplier Automation < > > http://www.businessesnetwork.com/automation/viewforum.php?f=52> > > Specialtymarket.com <http://www.specialtymarket.com/> > > Systems Integrator-- Glad to Assist > > > > Chat Y! messenger: bjfr33man > > > > Carsten Schinzer sent the following on 10/22/2010 6:39 AM: > > > > > > > > Hm seems like I'm a console freak then ;-) > >> > >> I prefer controlled initial dataloads from a repository (to have version > >> history). And I do a lot of catalogue management actually using XSLT and > >> XML > >> loads / uploads. > >> > >> Well, too much operations minded from may day-job I guess. > >> > >> Thanks for the hint. Maybe also something that needs to be added to the > >> wiki > >> page? > >> > >> Regards > >> > >> > >> Carsten > >> > >> > >> 2010/10/22 BJ Freeman<[email protected]> > >> > >> the concept I went with more self service. > >>> DB assignment in the TenantDataSource is created in a setup from the > Base > >>> (default) DB. A script is run that actually creates the DB based on the > >>> System setup, then added to the TenantDataSource. At this point the > >>> script > >>> is not configurable and has to be modified based on how the provider > has > >>> their DB server set up. > >>> > >>> The Seed data is loaded on the fly, not using Ant. > >>> they are then switched to their DB > >>> they are then sent to setup to build their system. > >>> This includes providing images for logos and other parameters to make > >>> their > >>> Themes, and that is loaded on the fly into their DB. this is similar to > >>> the > >>> products Images but instead creates a theme for this tenant. > >>> > >>> Based on the above the Tenant DB is stored in the TenantDataSource DB, > >>> instead of the entityengine.xml, as it was originally designed to do. > So > >>> no > >>> restart of ofbiz is necessary. > >>> > >>> the ant configuration, in my opinion should only be used to setup the > >>> basic > >>> Tenant system. > >>> > >>> ========================= > >>> BJ Freeman > >>> > >>> Strategic Power Office with Supplier Automation< > >>> http://www.businessesnetwork.com/automation/viewforum.php?f=52> > >>> Specialtymarket.com<http://www.specialtymarket.com/> > >>> Systems Integrator-- Glad to Assist > >>> > >>> Chat Y! messenger: bjfr33man > >>> > >>> > >>> Carsten Schinzer sent the following on 10/22/2010 12:30 AM: > >>> > >>> All, > >>> > >>>> > >>>> > >>>> I've done some extended research and have played around with the > >>>> configuration. I have taken the liberty to add my findings in a > section > >>>> on > >>>> Multitenant Configuraiton at: > >>>> > https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support > >>>> > >>>> Please review and let me know your comments if there are any. > >>>> I guess with this we can close the issue and make life easier for the > >>>> next > >>>> multitenant users. > >>>> > >>>> Regards > >>>> > >>>> > >>>> Carsten > >>>> > >>>> 2010/10/21 Scott Gray<[email protected]> > >>>> > >>>> I really don't know much about the multi tenant functionality, it's > new > >>>> > >>>>> and > >>>>> I haven't used it. But yeah you do need that tenant group mapped to > a > >>>>> datasource, it contains a set of tables that are needed in addition > to > >>>>> the > >>>>> separate tenant databases (I think). > >>>>> > >>>>> Regards > >>>>> Scott > >>>>> > >>>>> On 21/10/2010, at 11:57 PM, Carsten Schinzer wrote: > >>>>> > >>>>> Well, so possibly a mistake in the documents as the multitenant > >>>>> > >>>>>> > >>>>>> datasources > >>>>> > >>>>> would be defined in the config file placed on data/... (as mentioned > >>>>>> > >>>>>> above). > >>>>> > >>>>> Using your aproach, I would be using the entityengine.xml to define > any > >>>>>> datasource required? > >>>>>> > >>>>>> Then for data loading: How do I address a certain datasource? > >>>>>> > >>>>>> I had the idea to use defined readers like e.g. > >>>>>> <entity-data-reader name="ext-tenant1"/> > >>>>>> > >>>>>> and define those readers only for the respective data sources. > >>>>>> > >>>>>> Does that make sense? > >>>>>> Thanks for the tip! > >>>>>> I'll play around a little with this idea. > >>>>>> > >>>>>> Just one last question: What is the dedicated TenantDatasources.xml > >>>>>> file > >>>>>> then used for at all? To map the datasource to the respective tenant > >>>>>> > >>>>>> logins? > >>>>> > >>>>> Because irritatingly, this file also references jdbcUri, jdbcUsername > >>>>>> and > >>>>>> jdbcPassword. But all that I would have specified in > entityengine.xml > >>>>>> as > >>>>>> well. > >>>>>> > >>>>>> Well, it looks like I'd update some documents once I found my way > >>>>>> through > >>>>>> this. Stay tuned :) > >>>>>> > >>>>>> Regards > >>>>>> > >>>>>> > >>>>>> Carsten > >>>>>> > >>>>>> > >>>>>> 2010/10/21 Scott Gray<[email protected]> > >>>>>> > >>>>>> OOTB in 10.04 the delegator definition looks like this: > >>>>>> > >>>>>>> <delegator name="default" entity-model-reader="main" > >>>>>>> entity-group-reader="main" entity-eca-reader="main" > >>>>>>> distributed-cache-clear-enabled="false"> > >>>>>>> <group-map group-name="org.ofbiz" > >>>>>>> datasource-name="localderby"/> > >>>>>>> <group-map group-name="org.ofbiz.olap" > >>>>>>> datasource-name="localderbyolap"/> > >>>>>>> <group-map group-name="org.ofbiz.tenant" > >>>>>>> datasource-name="localderbytenant"/> > >>>>>>> </delegator> > >>>>>>> > >>>>>>> Your one appears to be missing the last group-map for > >>>>>>> org.ofbiz.tenant > >>>>>>> > >>>>>>> and > >>>>>> > >>>>> > >>>>> I'm guessing that is the problem. I have no idea why you and BJ were > >>>>>> > >>>>>>> missing that entry though, it was there before 10.04 existed. > >>>>>>> > >>>>>>> Regards > >>>>>>> Scott > >>>>>>> > >>>>>>> HotWax Media > >>>>>>> http://www.hotwaxmedia.com > >>>>>>> > >>>>>>> On 21/10/2010, at 9:42 PM, Carsten Schinzer wrote: > >>>>>>> > >>>>>>> Hi Scott, > >>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> well, I digged out this old thread as the very same seemed > happening > >>>>>>>> to > >>>>>>>> > >>>>>>>> BJ > >>>>>>> > >>>>>>> as well. Here's a little context: > >>>>>>>> > >>>>>>>> I am aiming at multitenant along with PostGreSQL database, i.e. I > >>>>>>>> have > >>>>>>>> created the DB for each tenant. > >>>>>>>> > >>>>>>>> I changed entityengine.xml to use the localpostnew DataSource in > the > >>>>>>>> > >>>>>>>> default > >>>>>>> > >>>>>>> delegator: > >>>>>>>> <delegator name="default" entity-model-reader="main" > >>>>>>>> entity-group-reader="main" entity-eca-reader="main" > >>>>>>>> distributed-cache-clear-enabled="false"> > >>>>>>>> <group-map group-name="org.ofbiz" > >>>>>>>> > >>>>>>>> datasource-name="localpostnew"/> > >>>>>>> > >>>>>> > >>>>> <group-map group-name="org.ofbiz.olap" > >>>>>> > >>>>>>> datasource-name="localderbyolap"/> > >>>>>>>> </delegator> > >>>>>>>> > >>>>>>>> of course localpostnew is updated with connection string info as > >>>>>>>> usual > >>>>>>>> > >>>>>>>> and > >>>>>>> > >>>>>>> the respective postgres drivers are placed in > >>>>>>>> > >>>>>>>> {ofbiz-home}\framework\entity\lib\jdbc > >>>>>>>> > >>>>>>>> Now the multitenant info, i.e. the datasource setup for each > >>>>>>>> Tenant's > >>>>>>>> database, went to the xml file in > >>>>>>>> {ofbiz-home}\framework\entity\data\TenantDataSources.xml > >>>>>>>> (the filename is different and is updated accordingly in > >>>>>>>> {ofbiz-home}\framework\entity\ofbiz-component.xml > >>>>>>>> > >>>>>>>> If I choose the localderby datasource, everything goes just nice > and > >>>>>>>> > >>>>>>>> the > >>>>>>> > >>>>>> > >>>>> databases are generated, data loaded etc. > >>>>>> > >>>>>>> > >>>>>>>> If I change to the above configuration, i.e. using localpostnew, > >>>>>>>> ofbiz > >>>>>>>> throws an exception as follows > >>>>>>>> * > >>>>>>>> COMMAND ISSUED:* > >>>>>>>> D:\__eclipse\ofbiz-multitenant>java -Xmx512m -XX:MaxPermSize=128m > >>>>>>>> -jar > >>>>>>>> ofbiz.jar -install -readers=seed-initial -delegator=default > >>>>>>>> > >>>>>>>> *CONSOLE OUTPUT:* > >>>>>>>> Set OFBIZ_HOME to - D:/__eclipse/ofbiz-multitenant > >>>>>>>> (...) > >>>>>>>> 2010-10-20 18:28:34,283 (main) [ ModelReader.java:389:INFO > ] > >>>>>>>> > >>>>>>>> FINISHED > >>>>>>> > >>>>>>> LOADING ENTITIES - ALL FILES; #Entities=849 #ViewEntities=267 > >>>>>>>> > >>>>>>>> #Fields=8870 > >>>>>>> > >>>>>>> #Relationships=2925 #AutoRelationships=2157 > >>>>>>>> 2010-10-20 18:28:34,392 (main) [ GenericDelegator.java:244:INFO > ] > >>>>>>>> > >>>>>>>> Doing > >>>>>>> > >>>>>> > >>>>> entity definition check... > >>>>>> > >>>>>>> 2010-10-20 18:28:34,408 (main) [ ModelEntityChecker.java:502:INFO ] > >>>>>>>> [initReservedWords] array length=1023 > >>>>>>>> Exception in thread "main" java.lang.NullPointerException > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> > org.ofbiz.entity.GenericDelegator.getEntityFieldType(GenericDelegator.java:555) > >>>>>>> > >>>>>> > >>>>> at > >>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> > org.ofbiz.entity.model.ModelEntityChecker.checkEntities(ModelEntityChecker.java:101) > >>>>>>> > >>>>>> > >>>>> at > >>>>>> > >>>>>>> org.ofbiz.entity.GenericDelegator.<init>(GenericDelegator.java:245) > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> > org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:33) > >>>>>>> > >>>>>> > >>>>> at > >>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> > org.ofbiz.entity.DelegatorFactoryImpl.getInstance(DelegatorFactoryImpl.java:25) > >>>>>>> > >>>>>> > >>>>> at > >>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > org.ofbiz.base.util.UtilObject.getObjectFromFactory(UtilObject.java:202) > >>>>>>>> > >>>>>>> > >>>>> at > >>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > org.ofbiz.entity.DelegatorFactory.getDelegator(DelegatorFactory.java:47) > >>>>>>>> > >>>>>>> > >>>>> at > >>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> > org.ofbiz.entityext.data.EntityDataLoadContainer.start(EntityDataLoadContainer.java:230) > >>>>>>> > >>>>>> > >>>>> at > >>>>>> > >>>>>>> > >>>>>>>> > >>>>>>>> > org.ofbiz.base.container.ContainerLoader.start(ContainerLoader.java:100) > >>>>>>>> > >>>>>>> > >>>>> at org.ofbiz.base.start.Start.startStartLoaders(Start.java:272) > >>>>>> > >>>>>>> at org.ofbiz.base.start.Start.startServer(Start.java:322) > >>>>>>>> at org.ofbiz.base.start.Start.start(Start.java:326) > >>>>>>>> at org.ofbiz.base.start.Start.main(Start.java:411) > >>>>>>>> 2010-10-20 18:28:34,627 (OFBiz_Shutdown_Hook) [ > >>>>>>>> ContainerLoader.java:113:INFO ] Shutting down containers > >>>>>>>> > >>>>>>>> > >>>>>>>> I would like to understand the following: > >>>>>>>> > >>>>>>>> - what is going wrong? OFBIZ seems to have issues with the > >>>>>>>> entityfieldtypes for postnew. This is not observed for single > >>>>>>>> tenant > >>>>>>>> > >>>>>>>> OFBIZ > >>>>>>> > >>>>>>> setups -- or no-one out there is using single instances on > postgres > >>>>>>>> > >>>>>>>> with > >>>>>>> > >>>>>>> release 10.04 or later. > >>>>>>>> - how can I dig deeper into the issue? Reviewing the classes I do > >>>>>>>> see > >>>>>>>> sporadic log statement which I do not find back on the console, > >>>>>>>> hence: > >>>>>>>> > >>>>>>>> where > >>>>>>> > >>>>>>> can I switch log levels for a component or the entire ofbiz > >>>>>>>> instance? > >>>>>>>> > >>>>>>>> Hint for any of these two are much appreciated. > >>>>>>>> And thanks for focussing back on the topic :-) > >>>>>>>> > >>>>>>>> Regards > >>>>>>>> > >>>>>>>> > >>>>>>>> Carsten > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> 2010/10/21 Scott Gray<[email protected]> > >>>>>>>> > >>>>>>>> Sorry my bad. > >>>>>>>> > >>>>>>>>> > >>>>>>>>> Could you explain what changes you've made to the > entityengine.xml > >>>>>>>>> > >>>>>>>>> that > >>>>>>>> > >>>>>>> > >>>>> got > >>>>>> > >>>>>>> > >>>>>>> you to the point of something not working? > >>>>>>>> > >>>>>>>>> > >>>>>>>>> Thanks > >>>>>>>>> Scott > >>>>>>>>> > >>>>>>>>> HotWax Media > >>>>>>>>> http://www.hotwaxmedia.com > >>>>>>>>> > >>>>>>>>> On 21/10/2010, at 6:04 PM, Carsten Schinzer wrote: > >>>>>>>>> > >>>>>>>>> Hmmm. Again this has gone off towards debugging/logging (just > like > >>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> the > >>>>>>>>> > >>>>>>>> > >>>>> older > >>>>>> > >>>>>>> > >>>>>>>>> thread from June). > >>>>>>>>>> > >>>>>>>>>> Anyone with proposals on how to include the Tenant datasources > >>>>>>>>>> into > >>>>>>>>>> entityengine.xml as BJ indicated he had found a workaround for > >>>>>>>>>> this > >>>>>>>>>> > >>>>>>>>>> issue > >>>>>>>>> > >>>>>>>> > >>>>>>> that involves this? BJ? > >>>>>>>> > >>>>>>>>> > >>>>>>>>>> Thanks > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> Carsten > >>>>>>>>>> > >>>>>>>>>> 2010/10/21 David E Jones<[email protected]> > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> On Oct 20, 2010, at 4:39 PM, Scott Gray wrote: > >>>>>>>>>>> > >>>>>>>>>>> On 21/10/2010, at 10:39 AM, James McGill wrote: > >>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> On Mon, Jun 14, 2010 at 11:08 AM, BJ Freeman< > >>>>>>>>>>>> [email protected] > >>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>> wrote: > >>>>>> > >>>>>>> > >>>>>>>>>>> > >>>>>>>>>>>> Not sure why it worked in derby mode but not in postgresql. > >>>>>>>>>>>>> > >>>>>>>>>>>>>> but it hung up on the tenant entity. > >>>>>>>>>>>>>> but adding the tenant stuff into the entityengine.xml it no > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> longer > >>>>>>>>>>>>> > >>>>>>>>>>>> > >>>>> errors. > >>>>>> > >>>>>>> > >>>>>>>>>>> I am such a slouch I used one line of debug.loginfo to find the > >>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>>> problem. > >>>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>> someday I will put energy into the remote debugging. > >>>>>>>>>>>> > >>>>>>>>>>>>> :D > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> I find remote debugging is extremely easy, using Eclipse. > If > >>>>>>>>>>>>> only > >>>>>>>>>>>>> > >>>>>>>>>>>>> there > >>>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>> was > >>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> a way to step into minilang services -- they make remote > >>>>>>>>>>>> debugging > >>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>> pretty > >>>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> frustrating, especially if you want to breakpoint an ECA. > >>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>> You can cheat a little sometimes with that. I regularly drop > in > >>>>>>>>>>>> > >>>>>>>>>>>> this: > >>>>>>>>>>> > >>>>>>>>>> > >>>>>>> <log level="always" message="${someVar}"/> > >>>>>>>> > >>>>>>>>> <transaction-rollback/> > >>>>>>>>>>>> > >>>>>>>>>>>> Obviously not as good as breakpoints but you can move it > around > >>>>>>>>>>>> and > >>>>>>>>>>>> > >>>>>>>>>>>> just > >>>>>>>>>>> > >>>>>>>>>> > >>>>>>>>> keep refreshing the browser to continually execute the method and > >>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> never > >>>>>>>>>> > >>>>>>>>> > >>>>>>> commit the changes. > >>>>>>>> > >>>>>>>>> > >>>>>>>>>>> Actually, IMO, when you don't have to worry about compile/run > >>>>>>>>>>> cycles > >>>>>>>>>>> > >>>>>>>>>>> I > >>>>>>>>>> > >>>>>>>>> > >>>>> like > >>>>>> > >>>>>>> > >>>>>>>>> logging better than break points and variable inspection. It > >>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> requires > >>>>>>>>>> > >>>>>>>>> > >>>>> a > >>>>>> > >>>>>>> > >>>>>>> little more typing, but a LOT less clicking and watching and > >>>>>>>> > >>>>>>>>> > >>>>>>>>>>> browsing > >>>>>>>>>> > >>>>>>>>> > >>>>> through data. In fact, IMO logging is faster when you don't have to > >>>>>> > >>>>>>> > >>>>>>>>>>> worry > >>>>>>>>>> > >>>>>>>>> > >>>>>>>>> about compilation making things intolerably slow. It's kind of > like > >>>>>>>>>> > >>>>>>>>>>> command-line versus a purely graphical way of doing things. > >>>>>>>>>>> > >>>>>>>>>>> Of course, to each their own... most programmers can't seem to > >>>>>>>>>>> > >>>>>>>>>>> handle > >>>>>>>>>> > >>>>>>>>> > >>>>> something that they aren't used and/or wasn't their idea... ;) > >>>>>> > >>>>>>> > >>>>>>>>>>> -David > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>> -- > >>>>>>>>>> > >>>>>>>>>> Best > >>>>>>>>>> > >>>>>>>>>> Carsten Schinzer > >>>>>>>>>> > >>>>>>>>>> Waisenhausstr. 53a > >>>>>>>>>> 80637 München > >>>>>>>>>> Germany > >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>> -- > >>>>>>>> > >>>>>>>> Best > >>>>>>>> > >>>>>>>> Carsten Schinzer > >>>>>>>> > >>>>>>>> Waisenhausstr. 53a > >>>>>>>> 80637 München > >>>>>>>> Germany > >>>>>>>> > >>>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>> -- > >>>>>> > >>>>>> Best > >>>>>> > >>>>>> Carsten Schinzer > >>>>>> > >>>>>> Waisenhausstr. 53a > >>>>>> 80637 München > >>>>>> Germany > >>>>>> > >>>>>> > >>>>> > >>>>> > >>>>> > >>>> > >>>> > >>> > >> > >> > > > -- > > Best > > Carsten Schinzer > > Waisenhausstr. 53a > 80637 München > Germany >
