Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-7120

Multisite support in specialpurpose/cmssite

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: 16.11.01
    • Component/s: cmssite
    • Labels:
      None
    • Sprint:
      Community Day 3 - 2016

      Description

      Idea is to implement a WebSiteFilter in specialpurose/cmssite component which can demonstrate OFBiz CMS ability to serve multiple websites with single webapp.

      To demonstrate WebSiteFilter usage, will also be adding sample website data, in addition to the one we already have.

      Originally this idea and implementation is from Scott Gray. I will be providing the patch for review and acceptance by the community.

      1. OFBIZ-7120-1.patch
        30 kB
        Mohammed Rehan Khan
      2. OFBIZ-7120-1.patch
        34 kB
        Pranay Pandey
      3. OFBIZ-7120-2.patch
        17 kB
        Mohammed Rehan Khan
      4. OFBIZ-7120-2.patch
        17 kB
        Pranay Pandey

        Activity

        Hide
        pandeypranay Pranay Pandey added a comment - - edited

        Attaching patches for this feature implemented in specialpurpose/cmssite component.

        OFBIZ-7120-1.patch
        This patch is for implementation done to support the feature.

        1. Introduced 3 new fields in WebSite Entity
          1. hostedPathAlias - For WebSites hosted on webapp using the WebSiteFilter, indicates the path this WebSite will be hosted on
          2. isDefault - If Y then it is default WebSite
          3. displayMaintenancePage - If set to Y, redirect user to site maintenance page (When a specific website needs to brought down without interrupting any of the other processes on the same instance)
        2. Updates in RequestHandler for handling requests from MULTI_SITE_ENABLED web app and to append URLs with hostedPathAlias for the corresponding website.
        3. Removed webSiteEntry from cmssite webapp web.xml as now this app is going to be MULTI_SITE_ENABLED and will serve as a sample for multi-site environment, also updated ControlServlet mapping to /* from /cms/*.
        4. Added Filter and mapping for WebSiteFilter in web.xml.
        5. Updates in CmsEvents.cms event to handle case of showing maintenance page when a specific site has brought down.
        6. WebSiteFilter class for filtering requests for multi-site-enabled webapp having WebSiteFilter entry.
        7. Prepared class MultiSiteRequestWrapper and overridden getPathInfo() method of HttpServletRequest class which is used to hide the hostPathAlias portion of the URL from OFBiz.

        OFBIZ-7120-2.patch
        This patch contains supporting data for demonstration of multi-site setup.

        Made the existing website the default one, so that user lands here whenever no specific hostedPathAlias is supplied.

        Introduced two more websites and added their URLs on default website home page for reference. Anyone can refer the setup to setup the similar environment in hot-deploy application.

        Introduced the maintenance page content and associated it with all the 3 sites, but in custom setup, every website can have it’s own.

        Any website can be brought down easily by setting up value of displayMaintenancePage to Y from here: https://localhost:8443/content/control/EditWebSite?webSiteId=WebSite2

        Clean build with data load is required prior to testing the feature.

        Here are the URLs for accessing these directly-

        1. CmsSite(Default) = https://localhost:8443/cmssite/
        2. WebSite-1 = https://localhost:8443/cmssite/website-1
        3. WebSite-2 = https://localhost:8443/cmssite/website-2

        A developer can simply have cmssite component available in specialpurpose and do an entry of WebSiteFilter in hot-deploy webapp web.xml can leverage the feature and can setup a multi-site enabled webapp.

        Thanks Scott Gray for the design and implementation, thanks Mohammed Rehan Khan for providing the patch for trunk.

        Feedback from the community is welcome, please review and suggest any improvements you see.

        Show
        pandeypranay Pranay Pandey added a comment - - edited Attaching patches for this feature implemented in specialpurpose/cmssite component. OFBIZ-7120 -1.patch This patch is for implementation done to support the feature. Introduced 3 new fields in WebSite Entity hostedPathAlias - For WebSites hosted on webapp using the WebSiteFilter, indicates the path this WebSite will be hosted on isDefault - If Y then it is default WebSite displayMaintenancePage - If set to Y, redirect user to site maintenance page (When a specific website needs to brought down without interrupting any of the other processes on the same instance) Updates in RequestHandler for handling requests from MULTI_SITE_ENABLED web app and to append URLs with hostedPathAlias for the corresponding website. Removed webSiteEntry from cmssite webapp web.xml as now this app is going to be MULTI_SITE_ENABLED and will serve as a sample for multi-site environment, also updated ControlServlet mapping to /* from /cms/*. Added Filter and mapping for WebSiteFilter in web.xml. Updates in CmsEvents.cms event to handle case of showing maintenance page when a specific site has brought down. WebSiteFilter class for filtering requests for multi-site-enabled webapp having WebSiteFilter entry. Prepared class MultiSiteRequestWrapper and overridden getPathInfo() method of HttpServletRequest class which is used to hide the hostPathAlias portion of the URL from OFBiz. OFBIZ-7120 -2.patch This patch contains supporting data for demonstration of multi-site setup. Made the existing website the default one, so that user lands here whenever no specific hostedPathAlias is supplied. Introduced two more websites and added their URLs on default website home page for reference. Anyone can refer the setup to setup the similar environment in hot-deploy application. Introduced the maintenance page content and associated it with all the 3 sites, but in custom setup, every website can have it’s own. Any website can be brought down easily by setting up value of displayMaintenancePage to Y from here: https://localhost:8443/content/control/EditWebSite?webSiteId=WebSite2 Clean build with data load is required prior to testing the feature. Here are the URLs for accessing these directly- CmsSite(Default) = https://localhost:8443/cmssite/ WebSite-1 = https://localhost:8443/cmssite/website-1 WebSite-2 = https://localhost:8443/cmssite/website-2 A developer can simply have cmssite component available in specialpurpose and do an entry of WebSiteFilter in hot-deploy webapp web.xml can leverage the feature and can setup a multi-site enabled webapp. Thanks Scott Gray for the design and implementation, thanks Mohammed Rehan Khan for providing the patch for trunk. Feedback from the community is welcome, please review and suggest any improvements you see.
        Hide
        pandeypranay Pranay Pandey added a comment - - edited

        Just to give a real world example where this feature can be very helpful. It can be helpful in building the multisite setup like: http://www.gap.com/ or https://www.scarpa.com/ where you can navigate between different websites from the top navigation. Every website is having its own theme and represents its own brand.

        Show
        pandeypranay Pranay Pandey added a comment - - edited Just to give a real world example where this feature can be very helpful. It can be helpful in building the multisite setup like: http://www.gap.com/ or https://www.scarpa.com/ where you can navigate between different websites from the top navigation. Every website is having its own theme and represents its own brand.
        Hide
        pandeypranay Pranay Pandey added a comment -

        Hi Community,

        I am planning to add this feature to Trunk if no objections are there.

        Thanks

        Show
        pandeypranay Pranay Pandey added a comment - Hi Community, I am planning to add this feature to Trunk if no objections are there. Thanks
        Hide
        pfm.smits Pierre Smits added a comment -

        Hi Pranay Pandey,

        I haven't had the time yet to look at the impact of the patch files with respect to my environment.
        I have a different approach with respect to multi site support in our multi-tenant setup: I implement per site a unique cmssite (with the base generated through a modified ./ant create-component process), as each can have different freemarker template requirements for rendering.

        I am currently going through a process of assessing what the impact of the gradle move has/will have on my customisations and that is already taxing.

        With the move to gradle the external libraries in cmssite have been removed. Did you have already had a chance to assess the impact of that on this?

        Show
        pfm.smits Pierre Smits added a comment - Hi Pranay Pandey , I haven't had the time yet to look at the impact of the patch files with respect to my environment. I have a different approach with respect to multi site support in our multi-tenant setup: I implement per site a unique cmssite (with the base generated through a modified ./ant create-component process), as each can have different freemarker template requirements for rendering. I am currently going through a process of assessing what the impact of the gradle move has/will have on my customisations and that is already taxing. With the move to gradle the external libraries in cmssite have been removed. Did you have already had a chance to assess the impact of that on this?
        Hide
        pandeypranay Pranay Pandey added a comment -

        Thanks for the note Pierre. I will check this up and get back.

        Based on the details of your design for multisite support, are you willing to contribute it as a sample to trunk?

        Show
        pandeypranay Pranay Pandey added a comment - Thanks for the note Pierre. I will check this up and get back. Based on the details of your design for multisite support, are you willing to contribute it as a sample to trunk?
        Hide
        pfm.smits Pierre Smits added a comment -

        Hi Pranay Pandey,

        I will need to investigate what I - with the contracts I have - can do.

        Show
        pfm.smits Pierre Smits added a comment - Hi Pranay Pandey , I will need to investigate what I - with the contracts I have - can do.
        Hide
        rehan.khan Mohammed Rehan Khan added a comment -

        Hello Community,

        Today I have verified this feature with latest code base of trunk. Everything is working as expected after making changes as per new project building structure with Gradle.

        I needed to make changes in the patches provided earlier which are as follows:

        1. Removed build.xml file from cmssite component.
        2. Updated packages reference as per new structure.

        Here are the updated patches.


        Thanks

        Show
        rehan.khan Mohammed Rehan Khan added a comment - Hello Community, Today I have verified this feature with latest code base of trunk. Everything is working as expected after making changes as per new project building structure with Gradle. I needed to make changes in the patches provided earlier which are as follows: Removed build.xml file from cmssite component. Updated packages reference as per new structure. Here are the updated patches. – Thanks
        Hide
        pandeypranay Pranay Pandey added a comment -

        Thanks Mohammed Rehan Khan for verifying the patches at latest trunk revision and providing the updated patches.
        Committed to trunk at r1761150, r1761155 and r1761156.

        Show
        pandeypranay Pranay Pandey added a comment - Thanks Mohammed Rehan Khan for verifying the patches at latest trunk revision and providing the updated patches. Committed to trunk at r1761150, r1761155 and r1761156.

          People

          • Assignee:
            pandeypranay Pranay Pandey
            Reporter:
            pandeypranay Pranay Pandey
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development

                Agile