Skip to content

Latest commit

 

History

History
263 lines (209 loc) · 12.3 KB

UPGRADE-NOTES.md

File metadata and controls

263 lines (209 loc) · 12.3 KB

Upgrade script for upgrade Liferay 7.1 to 7.4

Step 1 - Docker preparation

Make sure to clean all the containers & volumes from the Docker desktop instance

Step 2 - Pre upgrade data preparation

Before we can upgrade the database we need to clean up data and make some preparations.

Follow these steps:

  1. Obtain a database dump of the production database from Firelay.
  2. Copy and rename the dump file over file /docker/resources/dump-liferay.sql (do not commit to github)
  3. In the file /docker/docker-compose.yml, comment out all services except for 'database'. This will assure that Liferay is not loaded.
  4. Start Docker by running the following command in the 'Terminal' panel from the project root folder!
    ./gradlew startLiferay
  5. Connect to the database using a DB viewer such as DBeaver.
    jdbc:mariadb://localhost:3307/liferay
    user: liferay, password: liferay
  6. Execute the SQL script /docker/resources/pre-upgrade-cleanup.sql.
  7. To make sure you can login after start execute the following SQL statement:
    UPDATE User_ SET password_='your password here', passwordEncrypted=0 WHERE emailAddress='[email protected]';
  8. Go to table Configuration_ and select the SAML records: SELECT * FROM Configuration_ WHERE configurationId LIKE 'com.liferay.saml%'
    In the resultset update the 'dictionary' values. Set 'saml.enabled="false"'
  9. Stop Docker by running the following command in the 'Terminal' panel from the project root folder!
    ./gradlew stopLiferay

Step 3 - Run the Liferay Upgrade

Check that all containers have stopped and that the 'docker-compose.yml' file has been restored. Run the following command in the 'Terminal' panel from the project root folder!
./gradlew startLiferay

This command will start the 'oss-liferay-74' container which will initiate the database upgrade. Open the container logs and make sure no errors occur.

Step 4 - Update settings in Liferay

First begin by logging into Liferay:

http://localhost:8081

screen name=liferay, password='value entered in Step 2 - sub step 7

Enable JQuery

By default JQuery is turned off in Liferay 7.4. We need to switch it on.
  1. Open Control Panel -> System Settings -> Search: JQuery. Check 'Enable JQuery' and save

FreeMarker settings

We need to update some freemarker settings to allow our utilities classes to work properly.
  1. Open Control Panel -> System Settings -> Template Engines -> FreeMarker Engine
  2. Add 'nl.deltares.portal.utils.*' to Allowed Classes
  3. Remove staticUtil from list of Restricted Variables
  4. Remove objectUtil from list of Restricted Variables
  5. Remove serviceLocator from list of Restricted Variables
  6. Save changes

REST service settings

In Liferay 7.4 Guest users are no longer allowed to access the REST services.
  1. Open Control Panel -> Service Access Policy -> SYSTEM_DEFAULT
  2. Add Service Class: com.liferay.portal.kernel.service.GroupService and Method Name: getGroup
  3. Add Service Class: com.liferay.portal.kernel.service.LayoutService and Method Name: getLayoutByUuidAndGroupId
  4. Save changes

Step 5 - Update Site configurations and content

OSS and all child sites

Actions:

  1. Set theme to deltares-fews-theme. Make sure to copy the settings as they get lost when changing themes;
    • google-tag-id
    • page-footer-webcontent-id
    • Shopping Cart
    • show-cookies
  2. Clean the Velocity templates from oss.deltares.nl site
  3. Update template Carrousel-template

Softwaredagen/Software days/Academy site

Actions:

  1. Set theme to deltares-theme. Make sure to copy the settings as they get lost when changing themes;
    • google-tag-id
    • page-footer-webcontent-id
    • Shopping Cart
    • show-cookies
  2. Update Footer.ftl
  3. Replace search results portlet with the Deltares search results portlet
  4. Add registration success page. Configure this page in the registration form

Download site

Actions:

  1. Set theme to deltares-theme. Make sure to copy the settings as they get lost when changing themes;
    • google-tag-id
    • page-footer-webcontent-id
    • Shopping Cart
    • show-cookies
  2. Update Footer.ftl
  3. Add download success page. Configure this page in the download form

Step 6 - Upgrade system settings

portal-ext.properties file

  1. company.default.web.id=liferay.com This value must coincide with the 'webId' for the Company record of site 'oss.deltares.nl'
  2. template.engine.service.locator.restrict=false Set this so the Servicelocator will return Deltares utilities classes

GeoIP database

Make sure a recent version of the Geolite2-City.mmdb is available (> 23 Feb. 2023).

To ensure the IP addresses of users are passed to the Liferay backend, add a Valve to 'server.xml' configuration of Tomacat:

<Valve className="org.apache.catalina.valves.RemoteIpValve" internalProxies="10\.128\.0\.1|10\.129\.0\.1|10\.130\.0\.1" remoteIpHeader="x-forwarded-for" requestAttributesEnabled="true" protocolHeader="x-forwarded-proto" protocolHeaderHttpsValue="https"/>

End Upgrade script

Once the upgrade of the database is completed, the database needs to be exported as a dump file and then sent to Firelay.
Before sending DB Dump, test if it works by restoring the DB Dump into the database and check if errors occur.

Google Maps

To show the Activity Map it is necessary to acquire an API Key using a Google developer account.

System Settings

Upgrade issues

Upgrading from 7.1 db to 7.4 messes up the structures containing nested content. Related issue https://issues.liferay.com/browse/LPS-134191 If this persists we must look into 1st upgrading to 7.3 and then 7.4

Upgrading to 7.3 does not break nested structures Followed by upgrade to 7.4 results in the structures still containing content, however the nesting has been removed which causes (velocity) templates to get confused.

velocity seems not to be supported.

Project folder

- gradle-local.properties is not being picked up by command ./gradlew startLiferay --updated build.gradle to load local properties explicitly

Elastic search:

- renamed config elasticsearch7 - After starting docker containers make sure Elastic configuration is set to REMOTE and path is set to http://elasticsearch:9200 - Re-index all item

Java Script

- jQuery is default turned off - switch on: System Settings -> Third Party -> JQuery -> enable

JAVA

- bump java version from 1.8 to 11 for both project and gradle - when switching between 7.1 and 7.4 gradle java version needs to be set manually

Freemarker Scripts

- System Settings -> Template Engines -> FreeMarker Engine - Add Allowed Classes; nl.deltares.portal.utils.* -- testing if required - Remove restricted Variables; staticUtil (required in template Locations map view) - Remove restricted Variables; objectUtil in order to retrieve footer in init_custom.ftl - Remove restricted variables; serviceLocator - Servicelocator does not return Deltares utils classes -> as of 7.4 portalext.property "template.engine.service.locator.restrict=true" should be set to false;

Deltares Forms

- single oss forms module has been split into separate forms. - Registration Form throws error 3.0 opt-in: - see: https://help.liferay.com/hc/en-us/articles/360017902892-Introduction-to-Breaking-Changes-#upgrade-considerations for resolution.

journal-article-* modules

JournalArticle content is no longer available when listener is triggered. Therefore JournalArticleListener no longer works. It is possible to override the onBeforeUpdate method instead. However we should rethink if these modules can be removed. The functionality is not being used.

Structures configurations

- session type field renamed from 'type' -> 'registrationType'. Update if necessary for structures; SESSION, DINNER, BUSTRANSFER - Geolocation fields have been renamed; latitude -> lat, longitude -> lng - Deactivate all locals in structure fields that do not require translation. - Multiselect and single select fields do not work with Asset Publisher filtering options. Looks to be a bug. - Apparently this is a known issue: resolve by making sure the field is localizable - In old version Structures and Templates where named using a Key that needed to be inserted using SQL scripts. This is very difficult to manage and update. To avoid this problem we let Liferay create the keys and use configuration to map these to the internal key values.

Themes configuration

- When opening program item the '.header-back-to' appears and redirects to non-existing page. User main.css to set display: none

Templates configurations

- nested elements have automatically been converted to fieldsets. This needs to be changed for all templates. (eg. Footer.ftl)

REST service

- security issues when accessing REST service as Guest user: Access denied to com.liferay.portal.kernel.service.GroupService#getGroup - Solution is to add to System_Default in Configuration->Service Access Policy of DSD site: - com.liferay.portal.kernel.service.GroupService#getGroup - com.liferay.portal.kernel.service.LayoutService#getLayoutByUuidAndGroupId

IP Mapping

For a number of purposes we need to map the IP addresses of users to a Country. For this we use the database 'GeoLite2-City.mmdb'. This file needs to be located in a folder that is accessible Liferay. The folder can be configured in:

portal-ext.properties > maxmind.geoip.database.dir

Furthermore it allow tracking of user IPs in a container environment it is necessary to add a Valve to the 'server.xml' configuration of Tomcat

<Valve className="org.apache.catalina.valves.RemoteIpValve" internalProxies="10\.128\.0\.1|10\.129\.0\.1|10\.130\.0\.1" remoteIpHeader="x-forwarded-for" requestAttributesEnabled="true" protocolHeader="x-forwarded-proto" protocolHeaderHttpsValue="https"/>

Where the value for 'internalProxies' should be updated to match that of the google cloud environment.

Setup portal-ext.properties

As of u77 it is required that the properties file contains entry: company.default.web.id=liferay.com This value must coincide with the 'webId' for the Company record of site 'oss.deltares.nl'

Steps to initialize Docker instance

- Remove any existing volumes - First deploy without themes and modules - Check that the database upgrade processes complete successfully - fix any errors that may arise by removing problem records from original database - Enable JQuery options

PRE Upgrade Database tasks

To prepare the Liferay 7.1 database for the upgrade process, run the scripts defined in SQL file 'pre-upgrade-cleanup.sql' that can be found in the docker/resources folder of this project.

POST Upgrade Database tasks

- fix templates on the homepage of oss.deltares.nl: - delete velocity templates and related structures - create new Caroussel slides - create new Front Page Contact in (Basic Web Content) - Check if all countries available for companyId = 3948845 - Portlet options no longer visible: (https://help.liferay.com/hc/en-us/articles/12734525927565-Portlet-options-lost-after-upgrading-to-7-4-U51) - update the package.json of theme: "liferay-frontend-theme-styled": "6.0.63", "liferay-frontend-theme-unstyled": "6.0.52" - Ratings of ADT: can be set under Site Settings -> Community Tools -> Ratings