Multi Tenant

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Multi Tenant

Stefan Badenhorst
Good day.

I hope someone can help me setting up an additional tenant.
I'm having trouble logging in as the administrator.

I have downloaded OfBiz 13.07.02 and changed the configuration to connect
to Postgres 9.4.

Now I have it working with the demo data loaded.
I want to add a new tenant with no demo data loaded.

I heave read many articles and tried the suggestions, the furthest I have
gotten is to run this at the command line:

ant create-tenant

At first I got errors using this and I realized that it could not create
the databases that I was specifying.
I manually created the databases with my chosen tenant id '10001'.
So now I have 2 additional databases ofbiz_10001 and ofbizolap_10001.

At the point where it asks me what data to install I have tried both 'Seed'
and 'seed-initial'. I must confess that I'm not sure what this means.

I ran the create-tenant again and this time it created 833 tables in the
main database and 6 tables in the olap database.

At the end it tells me the following:
 [echo] Delegator = default#10001
 [echo] Tenant admin = '10001-admin'
 [echo] Password for tenant admin is 'ofbiz' must change on first login

I have also update the global config to show the tenant input on the login
screen.

When I try to login with the above user, it tells me that the user does not
exist.


Kind regards.
Stefan Badenhorst.

--


*Email Disclaimer*

This email message (and or any attachments) is proprietary to MI-C3, and is
intended for the original addressee/nominated recipient only and/or
otherwise authorized personnel. The information contained herein and
attached is confidential. If you are not the intended recipient, please be
advised that viewing this message and any attachments, as well as copying,
forwarding, printing and disseminating any information related to this
email is prohibited, and that you should not take any action based on the
content of the email and/or attachments. If you received this email in
error, please contact the sender and destroy all copies on this email and
any attachments. The views and opinion expressed in this message are those
of the individual sender of this message and do not necessarily represent
the views and opinion of MI-C3. We cannot ensure or guarantee that the
integrity of this communication has been maintained or that it is secure or
error free as information can be intercepted, corrupted, lost and or
subject to interference. MI-C3 does not accept liability for any errors or
omissions in the contents of this message or for any damage resulting from
the opening of this message should it contain a virus.
Reply | Threaded
Open this post in threaded view
|

Re: Multi Tenant

Gavin Mabie-2
Hi Stefan

Have you tried logging on with the normal "admin" uid;

Gavin

On Fri, Sep 25, 2015 at 10:17 AM, Stefan Badenhorst <
[hidden email]> wrote:

> Good day.
>
> I hope someone can help me setting up an additional tenant.
> I'm having trouble logging in as the administrator.
>
> I have downloaded OfBiz 13.07.02 and changed the configuration to connect
> to Postgres 9.4.
>
> Now I have it working with the demo data loaded.
> I want to add a new tenant with no demo data loaded.
>
> I heave read many articles and tried the suggestions, the furthest I have
> gotten is to run this at the command line:
>
> ant create-tenant
>
> At first I got errors using this and I realized that it could not create
> the databases that I was specifying.
> I manually created the databases with my chosen tenant id '10001'.
> So now I have 2 additional databases ofbiz_10001 and ofbizolap_10001.
>
> At the point where it asks me what data to install I have tried both 'Seed'
> and 'seed-initial'. I must confess that I'm not sure what this means.
>
> I ran the create-tenant again and this time it created 833 tables in the
> main database and 6 tables in the olap database.
>
> At the end it tells me the following:
>  [echo] Delegator = default#10001
>  [echo] Tenant admin = '10001-admin'
>  [echo] Password for tenant admin is 'ofbiz' must change on first login
>
> I have also update the global config to show the tenant input on the login
> screen.
>
> When I try to login with the above user, it tells me that the user does not
> exist.
>
>
> Kind regards.
> Stefan Badenhorst.
>
> --
>
>
> *Email Disclaimer*
>
> This email message (and or any attachments) is proprietary to MI-C3, and is
> intended for the original addressee/nominated recipient only and/or
> otherwise authorized personnel. The information contained herein and
> attached is confidential. If you are not the intended recipient, please be
> advised that viewing this message and any attachments, as well as copying,
> forwarding, printing and disseminating any information related to this
> email is prohibited, and that you should not take any action based on the
> content of the email and/or attachments. If you received this email in
> error, please contact the sender and destroy all copies on this email and
> any attachments. The views and opinion expressed in this message are those
> of the individual sender of this message and do not necessarily represent
> the views and opinion of MI-C3. We cannot ensure or guarantee that the
> integrity of this communication has been maintained or that it is secure or
> error free as information can be intercepted, corrupted, lost and or
> subject to interference. MI-C3 does not accept liability for any errors or
> omissions in the contents of this message or for any damage resulting from
> the opening of this message should it contain a virus.
>
Reply | Threaded
Open this post in threaded view
|

AW: Multi Tenant

iwolf
In reply to this post by Stefan Badenhorst
Hi Stefan,

this is what I do to create a new tenant (in the command line - linux): f.ex. tenant "demo"

1) create databases
2) Update /framework/entity/config/entityengine.xml

./ant create-tenant --> follow instructions

Load seed:
java \-Xmx512m \-XX:MaxPermSize=128m \-jar ofbiz.jar \load-data \-readers=seed \-delegator=default#demo

I assume that is what your missing:
Create admin user:
./ant load-tenant-admin-user-login -DdelegatorId=default#demo -DuserLoginId=admin-demo

If you take a look at for example /applications/accounting/ofbiz-component.xml you will find multiple enity-resources with a reader-name defined.

from framework/entity/config/entityengine.xml:
    <!-- defining:
        tenant       = OFBiz and External Tenant Data
        seed         = OFBiz and External Seed Data - to be maintained along with source and updated whenever a system deployment is updated
        seed-initial = OFBiz and External Seed Data - to be maintained along with source like other seed data, but only loaded initially and not updated when a system is updated except manually reviewing each line
        demo         = OFBiz Only Demo Data
        ext          = External General Data (custom)
        ext-test     = External Test Data (custom)
        ext-demo     = External Demo Data (custom)
    -->

Hope that helps.

Best regards,
Ingo



-----Ursprüngliche Nachricht-----
Von: Stefan Badenhorst [mailto:[hidden email]]
Gesendet: Freitag, 25. September 2015 10:18
An: [hidden email]
Betreff: Multi Tenant

Good day.

I hope someone can help me setting up an additional tenant.
I'm having trouble logging in as the administrator.

I have downloaded OfBiz 13.07.02 and changed the configuration to connect to Postgres 9.4.

Now I have it working with the demo data loaded.
I want to add a new tenant with no demo data loaded.

I heave read many articles and tried the suggestions, the furthest I have gotten is to run this at the command line:

ant create-tenant

At first I got errors using this and I realized that it could not create the databases that I was specifying.
I manually created the databases with my chosen tenant id '10001'.
So now I have 2 additional databases ofbiz_10001 and ofbizolap_10001.

At the point where it asks me what data to install I have tried both 'Seed'
and 'seed-initial'. I must confess that I'm not sure what this means.

I ran the create-tenant again and this time it created 833 tables in the main database and 6 tables in the olap database.

At the end it tells me the following:
 [echo] Delegator = default#10001
 [echo] Tenant admin = '10001-admin'
 [echo] Password for tenant admin is 'ofbiz' must change on first login

I have also update the global config to show the tenant input on the login screen.

When I try to login with the above user, it tells me that the user does not exist.


Kind regards.
Stefan Badenhorst.

--


*Email Disclaimer*

This email message (and or any attachments) is proprietary to MI-C3, and is intended for the original addressee/nominated recipient only and/or otherwise authorized personnel. The information contained herein and attached is confidential. If you are not the intended recipient, please be advised that viewing this message and any attachments, as well as copying, forwarding, printing and disseminating any information related to this email is prohibited, and that you should not take any action based on the content of the email and/or attachments. If you received this email in error, please contact the sender and destroy all copies on this email and any attachments. The views and opinion expressed in this message are those of the individual sender of this message and do not necessarily represent the views and opinion of MI-C3. We cannot ensure or guarantee that the integrity of this communication has been maintained or that it is secure or error free as information can be intercepted, corrupted, lost and or subject to interference. MI-C3 does not accept liability for any errors or omissions in the contents of this message or for any damage resulting from the opening of this message should it contain a virus.
Reply | Threaded
Open this post in threaded view
|

Re: Multi Tenant

Pierre Smits
In reply to this post by Stefan Badenhorst
Hi Stefan,

When having setup the connection to the RDBMS and multi tenant setting
correctly, the ./ant create-tenant command should work fine re initiating
the tenant and creating the <tenantId>-admin user login for the tenant.

When having provided the data set to load (seed, seed-initial, etc), the
process will perform the following actions/functions:
1 create the entity records for the tenant in the Tenant and associated
entities.
2 instantiate the tenant delegator
3 setup the connection to the databases for the tenant in the RDBMS
4 create the tables and indexes in the tenant databases
5 seed the data in the databases and create the indexes

The second phase of the process creates the <tenantId>-admin user login and
set the initial password and permissions.

After completion of the process, you should be able to log in to the tenant
instance (providing username (<tenantId>-admin), initial password
(ofbiz) and the tenant code (<tenantId>) in the login screen.

If you feel that there is something wrong with the process in your OFBiz
version (r13.07.x, if I recall correctly) please register a JIRA issue and
attach a log file.

Best regards,

Pierre

Op vrijdag 25 september 2015 heeft Stefan Badenhorst <
[hidden email]> het volgende geschreven:

> Good day.
>
> I hope someone can help me setting up an additional tenant.
> I'm having trouble logging in as the administrator.
>
> I have downloaded OfBiz 13.07.02 and changed the configuration to connect
> to Postgres 9.4.
>
> Now I have it working with the demo data loaded.
> I want to add a new tenant with no demo data loaded.
>
> I heave read many articles and tried the suggestions, the furthest I have
> gotten is to run this at the command line:
>
> ant create-tenant
>
> At first I got errors using this and I realized that it could not create
> the databases that I was specifying.
> I manually created the databases with my chosen tenant id '10001'.
> So now I have 2 additional databases ofbiz_10001 and ofbizolap_10001.
>
> At the point where it asks me what data to install I have tried both 'Seed'
> and 'seed-initial'. I must confess that I'm not sure what this means.
>
> I ran the create-tenant again and this time it created 833 tables in the
> main database and 6 tables in the olap database.
>
> At the end it tells me the following:
>  [echo] Delegator = default#10001
>  [echo] Tenant admin = '10001-admin'
>  [echo] Password for tenant admin is 'ofbiz' must change on first login
>
> I have also update the global config to show the tenant input on the login
> screen.
>
> When I try to login with the above user, it tells me that the user does not
> exist.
>
>
> Kind regards.
> Stefan Badenhorst.
>
> --
>
>
> *Email Disclaimer*
>
> This email message (and or any attachments) is proprietary to MI-C3, and is
> intended for the original addressee/nominated recipient only and/or
> otherwise authorized personnel. The information contained herein and
> attached is confidential. If you are not the intended recipient, please be
> advised that viewing this message and any attachments, as well as copying,
> forwarding, printing and disseminating any information related to this
> email is prohibited, and that you should not take any action based on the
> content of the email and/or attachments. If you received this email in
> error, please contact the sender and destroy all copies on this email and
> any attachments. The views and opinion expressed in this message are those
> of the individual sender of this message and do not necessarily represent
> the views and opinion of MI-C3. We cannot ensure or guarantee that the
> integrity of this communication has been maintained or that it is secure or
> error free as information can be intercepted, corrupted, lost and or
> subject to interference. MI-C3 does not accept liability for any errors or
> omissions in the contents of this message or for any damage resulting from
> the opening of this message should it contain a virus.
>


--
Pierre Smits

*OFBiz Extensions Marketplace*
http://oem.ofbizci.net
Reply | Threaded
Open this post in threaded view
|

Re: Multi Tenant

Pierre Smits
In reply to this post by Stefan Badenhorst
Hi Stefan,

When having setup the connection to the RDBMS and multi tenant setting
correctly, the ./ant create-tenant command should work fine re initiating
the tenant and creating the <tenantId>-admin user login for the tenant.

When having provided the data set to load (seed, seed-initial, etc), the
process will perform the following actions/functions:
1 create the entity records for the tenant in the Tenant and associated
entities.
2 instantiate the tenant delegator
3 setup the connection to the databases for the tenant in the RDBMS
4 create the tables and indexes in the tenant databases
5 seed the data in the databases and create the indexes

The second phase of the process creates the <tenantId>-admin user login and
set the initial password and permissions.

After completion of the process, you should be able to log in to the tenant
instance (providing username (<tenantId>-admin), initial password
(ofbiz) and the tenant code (<tenantId>) in the login screen.

If you feel that there is something wrong with the process in your OFBiz
version (r13.07.x, if I recall correctly) please register a JIRA issue and
attach a log file.

Best regards,

Pierre

Op vrijdag 25 september 2015 heeft Stefan Badenhorst <
[hidden email]> het volgende geschreven:

> Good day.
>
> I hope someone can help me setting up an additional tenant.
> I'm having trouble logging in as the administrator.
>
> I have downloaded OfBiz 13.07.02 and changed the configuration to connect
> to Postgres 9.4.
>
> Now I have it working with the demo data loaded.
> I want to add a new tenant with no demo data loaded.
>
> I heave read many articles and tried the suggestions, the furthest I have
> gotten is to run this at the command line:
>
> ant create-tenant
>
> At first I got errors using this and I realized that it could not create
> the databases that I was specifying.
> I manually created the databases with my chosen tenant id '10001'.
> So now I have 2 additional databases ofbiz_10001 and ofbizolap_10001.
>
> At the point where it asks me what data to install I have tried both 'Seed'
> and 'seed-initial'. I must confess that I'm not sure what this means.
>
> I ran the create-tenant again and this time it created 833 tables in the
> main database and 6 tables in the olap database.
>
> At the end it tells me the following:
>  [echo] Delegator = default#10001
>  [echo] Tenant admin = '10001-admin'
>  [echo] Password for tenant admin is 'ofbiz' must change on first login
>
> I have also update the global config to show the tenant input on the login
> screen.
>
> When I try to login with the above user, it tells me that the user does not
> exist.
>
>
> Kind regards.
> Stefan Badenhorst.
>
> --
>
>
> *Email Disclaimer*
>
> This email message (and or any attachments) is proprietary to MI-C3, and is
> intended for the original addressee/nominated recipient only and/or
> otherwise authorized personnel. The information contained herein and
> attached is confidential. If you are not the intended recipient, please be
> advised that viewing this message and any attachments, as well as copying,
> forwarding, printing and disseminating any information related to this
> email is prohibited, and that you should not take any action based on the
> content of the email and/or attachments. If you received this email in
> error, please contact the sender and destroy all copies on this email and
> any attachments. The views and opinion expressed in this message are those
> of the individual sender of this message and do not necessarily represent
> the views and opinion of MI-C3. We cannot ensure or guarantee that the
> integrity of this communication has been maintained or that it is secure or
> error free as information can be intercepted, corrupted, lost and or
> subject to interference. MI-C3 does not accept liability for any errors or
> omissions in the contents of this message or for any damage resulting from
> the opening of this message should it contain a virus.
>


--
Pierre Smits

*OFBiz Extensions Marketplace*
http://oem.ofbizci.net
Reply | Threaded
Open this post in threaded view
|

Re: Multi Tenant

Stefan Badenhorst
Thanks, Pierre.

Please let me know what log file you are interested in.
I also would like to verify where the process failed.
Can you give me some directions on what tables and databases I could look at to see if data was loaded correctly?

Reply | Threaded
Open this post in threaded view
|

Re: Multi Tenant

Stefan Badenhorst
In reply to this post by Pierre Smits
I have created The issue as you requested OFBIZ-6658 with the log files attached.
https://issues.apache.org/jira/browse/OFBIZ-6658

I have noticed in the log file that there are 2 errors that come up:
|OFBiz-config-3 |DatabaseUtil |E| Error adding foreign key: ModelEntity was null for related entity name Tenant

 and

 |main |GenericDelegator |E| Failure in create operation for entity [JobSandbox]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:JobSandbox][createdStamp,2015-09-29 13:47:16.145(java.sql.Timestamp)][createdTxStamp,2015-09-29 13:47:16.145(java.sql.Timestamp)][jobId,8200(java.lang.String)][jobName,Clear EntitySyncRemove Info(java.lang.String)][lastUpdatedStamp,2015-09-29 13:47:16.145(java.sql.Timestamp)][lastUpdatedTxStamp,2015-09-29 13:47:16.145(java.sql.Timestamp)][maxRecurrenceCount,-1(java.lang.Long)][poolId,pool(java.lang.String)][runAsUser,system(java.lang.String)][runTime,2000-01-01 00:00:00.0(java.sql.Timestamp)][serviceName,cleanSyncRemoveInfo(java.lang.String)][tempExprId,MIDNIGHT_DAILY(java.lang.String)] (SQL Exception while executing the following:INSERT INTO public.JOB_SANDBOX (JOB_ID, JOB_NAME, RUN_TIME, POOL_ID, STATUS_ID, PARENT_JOB_ID, PREVIOUS_JOB_ID, SERVICE_NAME, LOADER_NAME, MAX_RETRY, CURRENT_RETRY_COUNT, AUTH_USER_LOGIN_ID, RUN_AS_USER, RUNTIME_DATA_ID, RECURRENCE_INFO_ID, TEMP_EXPR_ID, CURRENT_RECURRENCE_COUNT, MAX_RECURRENCE_COUNT, RUN_BY_INSTANCE_ID, START_DATE_TIME, FINISH_DATE_TIME, CANCEL_DATE_TIME, JOB_RESULT, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "job_sandbox" violates foreign key constraint "job_sndbx_usrlgn"
Detail: Key (run_as_user)=(system) is not present in table "user_login".)). Rolling back transaction.
Reply | Threaded
Open this post in threaded view
|

Multi Tenant

Pierre Smits
In reply to this post by Stefan Badenhorst
Hi Stefan,

The entities to look for are:

   - Tenant
   - TenantDataSource

The entities are available for the 'default' delegator, they cannot be
accessed when logging in at tenant level.

The most important elements of the first entity are the id of the tenant
(which is also used to define the delegator) and the disabled field. If the
last one is set to true (Y), the engine won't use the tenant delegator and
users can't access the tenant environment.

The second entity maps the tenantId to the rdbms to ensure that the data
entered in the tenant environment (the tenant delegator, e.g.
default#<tenantId> will be persisted in the tenant database(s) -
ofbiz_<tenantId> or ofbizolap_<tenantId>.



Best regards,


Pierre Smits

*OFBiz Extensions Marketplace*
http://oem.ofbizci.net

On Tue, Sep 29, 2015 at 9:54 AM, Stefan Badenhorst <
[hidden email]
<javascript:_e(%7B%7D,'cvml','[hidden email]');>> wrote:

> Thanks, Pierre.
>
> Please let me know what log file you are interested in.
> I also would like to verify where the process failed.
> Can you give me some directions on what tables and databases I could look
> at
> to see if data was loaded correctly?
>
>
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Multi-Tenant-tp4672725p4672845.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>



--
Pierre Smits

*OFBiz Extensions Marketplace*
http://oem.ofbizci.net