All the mess around publishing or changing the content of a live site without drawing the attention of site users can be avoided by using Staging.
Staging basically allows you to clone your live site and publish the modifications or new updates. Liferay’s staging environment allows you to make changes to your site in a specialized staging area. When you’re finished, you can publish all your site changes at once.
There are two ways of doing this in Liferay:
1. Local Live Staging
2. Remote Live Staging
Local Live Staging:
This is when both your staging environment and your live environment are hosted on the same server.
It clones the site with copies of all the sites existing pages. Also depending on which portlets are enabled during staging the portlet data is also copied. The cloned site becomes the staging environment and the original site becomes the live environment.
Pros and Cons of Local Live Staging:
- Since the staged and live environments are on the same server, it allows you to publish site changes very quickly.
- Easier to switch between the staged and live environments.
- Liferay recommends Local Live when the website is small – low traffic, small groups of end users such as small company’s internal websites with less content ,having a few pages and some portlets .
- The content isn’t as well protected or backed up as remote live, since staged content is stored in the same database as the production content.
- Multiple versions of the portlet cannot be installed as only one version of portlet can be installed at any given time on a single Liferay server.
Steps to enable Local Live Staging:
Local Live Staging is much simpler to set up compared to Remote live with just a few steps:
1. Login as Site administrator.
2. Navigate to the Site Administration (Admin on the doc bar) → Configuration
3. Site Settings is highlighted in the left menu by default, if not then select the last icon on the side bar and select Site Settings.
4. Click on Staging listed under the Advanced tab which will show the staging type options.
5. Under Staging Type, select Local Live and further options will be displayed for page versioning and Staged Content. You can enable page versioning on a site’s public pages, private pages, both, or neither and save. Page versioning allows you to work in parallel on different versions of pages and maintains a history of all page modifications.
Staging allows changes to be made in a staging environment so that work can be reviewed, possibly using a workflow, before it’s published to a live site.
Remote Live Staging:
Remote Live staging allows you to connect between the current site and another site on a remote Liferay server. The remote site being the Live environment and the current site being an instance of Liferay Portal used solely for staging, allowing the content creators to make changes to staging server while the live server handles the incoming user traffic and when the changes are ready to be published, they are pushed over the network to the remote live server.
Pros and Cons of Remote Live Staging:
- Contents are well protected, as they are saved on two different servers with different databases
- Contents are well backed up.
- Allows you to deploy new versions of portlets and content to your staging environment without worrying about interfering with your live environment.
- Allows you to use one Liferay instance as the staging server for multiple production servers.
- Liferay recommends Remote Live when the website is huge – high traffic, big groups of end users.
- Publishing is slower with Remote Live than with Local Live since data needs to be transferred over a network.
- You need more hardware to run a separate staging server.
Steps to enable Remote Live Staging:
The remote (live) Liferay server and the local (staging) Liferay server should be completely separate systems.
1.Before a site administrator can enable Remote Live staging for a site, the remote Liferay server must be added to the current Liferay server’s list of allowed servers.
Add the following lines to your current Liferay server’s portal-ext.properties file:
tunnel.servlet.hosts.allowed=127.0.0.1,SERVER_IP,[Remote server IP address]
axis.servlet.hosts.allowed=127.0.0.1,SERVER_IP,192.168.0.16,[Remote server IP address]
2.The current Liferay server must also be added to the remote Liferay server’s list of allowed servers with the authentication key to be shared by your current and your remote server.
Then add the following lines to your remote Liferay server’s portal-ext.properties file:
tunnel.servlet.hosts.allowed=127.0.0.1,SERVER_IP,[Local server IP address]
axis.servlet.hosts.allowed=127.0.0.1,SERVER_IP,192.168.0.16,[Local server IPaddress]
3.Restart both Liferay servers after making the changes.
4.After restarting, log back in to your local Liferay portal instance as a site administrator.
5.Then go to the site settings form the dock bar as we did for Local live staging.
6.This time select Remote Live under Staging Type and additional options appear.
7.Enter your remote Liferay server’s IP address into the Remote Host/IP field. If the remote Liferay server is a cluster, you can set the Remote Host/IP to the load balanced IP address of the cluster in order to increase the availability of the publishing process. Next, enter the port on which the remote Liferay instance is running into the Remote Port field. You only need to enter a Remote Path Context if a non-root portal servlet context is being used on the remote Liferay server. Finally, enter the site ID of the site on the remote Liferay server that will be used for the Live environment. If a site hasn’t already been prepared for you on the remote Liferay server, you can log in to the remote Liferay server and create a new blank site. After the site has been created, note the site ID so you can enter it into the Remote Site ID field on your local Liferay server.
8.You can find any site’s ID by selecting Actions → Edit next to the site’s name on the Sites page of the Control Panel. Finally, check the Use a Secure Network Connection field to secure the publication of pages from your local (staging) Liferay server to your remote (live) Liferay server.
Liferay also offers the Page Versioning feature. This feature works with both Local Live and Remote Live staging and allows site administrators to create multiple variations of staged pages. This allows several different versions of sites and pages to be developed at the same time. Variations can be created, merged, and published using a Git-like versioning system. Your site’s update history won’t be saved until you enable page versioning. Page versioning requires staging (either Local Live or Remote Live) to be enabled. Page versioning also maintains a history of all updates to the site from the time page versioning was enabled. Site administrators can revert to a previous version of the site at any time.
Using the Staging Environment:
Once the staging is enabled, the dockbar shows another menu for staging to help manage the staged pages. In the Live environment the page management options have been removed, as you cannot directly edit live pages.
To make changes enter the staging environment clicking on Staging button and your management options are restored and you can access some new options related to staging.
Now if you can make any changes you want to the site, For example lets add a new page called Test Staging and the n add some porlets to the page.
These changes if you check in the Live site won’t be available until you publish it from staging.
The options available in staging are as below:
Manage Site Pages Variations: allows you to work in parallel on multiple versions of a staged site page.
Manage Page Variations: allows you to work in parallel on multiple versions of a staged page.
Undo/Redo: allows you to step back/forward through recent changes to a page, which can save you the time of manually adding or removing portlets if you make a mistake.
History: shows you the list of revisions of the page, based on publication dates. You can go to any change in the revision history and see how the pages looked at that point.
Mark as Ready for Publication: After you’re done making changes to the staged page, click this button. The status of the page changes from Draft to Ready for Publication and any changes you’ve made can be published to the Live Site. When you publish a page to live, only the version which was Marked as Ready for Publication is published.
The Publish to Live button gives you the option to publish to Live Now or Schedule a publication to Live.
Now: immediately pushes any changes to the Live Site.
Schedule: lets you set a specific date to publish or to set up recurring publishing. You could use this, for example, to publish all changes made during the week every Monday morning without any further intervention.
The Publish to Live button also gives you options to select pages, applications, content, and permissions.
Pages: gives you the option to choose which pages to include when you publish. You can see the default settings in the gray text below the header. Click the Change button to configure these options to suite your needs.
Application Configuration allows you to select which applications you want to publish. Select the Choose Applications radio button to configure the applications and settings to be published.
Content allows you to configure the content to be published. Clicking the select option under All Content allows you to delete the portlet metadata before publishing.
Permissions :allows you to include permissions for the pages and portlets when the changes are published.
Furthermore, you’re given the Current and Previous and Scheduled tabs. The Current and Previous tab lets you view past publications along with their authors and create/completion dates. The Scheduled tab lets you view what publication processes are scheduled for publishing.
Click on Mark as Ready for Publication, then click Publish to Live → Now, and select Publish to publish your Bookmarks portlet to the live site.
Liferay staging is very easy to use and makes content management for content-rich web site easy. Depending the size of user group and site content you can choose between local live and remote live Staging. Liferay provides a secure and easy of staging.