Creating Tenant in Apache OFBiz
Its really long time, when I last wrote a blog. In Past few months during working on Apache OFBiz, I have working on multiple e-commerce website. During this, I come to know about concept of Multi-tenant. By Multi-tenant we can have multiple website on same Application with different databases facility available for different websites.
I really have to search a lot for creating tenant in OFBiz, there are documentation and tutorials there, but I did not find all commands at same place so we can have tenant running in Apache OFBiz. Main problem I got was in Creating different back-office user login. I searched in build.xml of the OFBiz and after going to every command I finally was successful in making list of commands. Sharing this commands as I might not be alone who is having problem in it.
1. Import this Data in web-tools of main Database for creating tenant of separate website.
<Tenant tenantId="10001" tenantName="Name"/>
<TenantDataSource tenantId="10001" entityGroupName="org.ofbiz"
jdbcUri="jdbc:postgresql://127.0.0.1/tenant_name" jdbcUsername="username" jdbcPassword="password"/>
<TenantDataSource tenantId="10001" entityGroupName="org.ofbiz.olap"
jdbcUri="jdbc:postgresql://127.0.0.1/tenant_nameolap" jdbcUsername="username" jdbcPassword=password"/>
2. To load the seed data for the new tenant database.
java -Xmx512m -XX:MaxPermSize=128m -jar ofbiz.jar -install -readers=seed -delegator=default#10001
3. To load Admin Login for backend authentication.
./ant load-tenant-admin-user-login -DdelegatorId=default#10001 -DuserLoginId=admin
Note: Don't forget to create new database for the tenant. :)