liferay setup note - parkland readme

Environment Setup

Install MySQL Server 5.7 using MySQL Installer

https://dev.mysql.com/downloads/windows/installer/5.7.html Recomended Default User: root Recomended Default Password: password If the setup wizard generates a password for you make sure you note it. mysql> create database lportal character set utf8

Create Liferay Folder and Clone Repository

Create folder c:/liferay Clone git repository inside c:/liferay

Install Liferay 7.1

Liferay 7.1 SP1 Extract liferay-dxp-tomcat-7.1.10.1-sp1-20190110085705206.zip using 7-Zip in c:\liferay Copy c:/liferay/parkland-portal/configs/common/portal-ext.properties to c:/liferay/liferay-dxp-7.1.10.1-sp1/portal-ext.properties
Copy c:/liferay/parkland-portal/configs/local/portal-ext-env.properties to c:/liferay/liferay-dxp-7.1.10.1-sp1/portal-ext-env.properties

Recomended:

Modify c:/liferay/liferay-dxp-7.1.10.1-sp1/tomcat-9.0.6/bin/ to increase the memory allocated to Liferay and explicitly point to the jdk installation. My jdk is installed in c:\apps\jdk-11.0.2
JAVA_HOME=C:\Apps\jdk-11.0.2
CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx2g -XX:MaxMetaspaceSize=512m"

Start Liferay

Start liferay by executing c:\liferay\liferay-dxp-tomcat-7.1-sp1/tomcat-9.0.6/bin/startup.bat

Checkpoint

Look for this in the logs:
INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 504593 ms
Open http://localhost.8080 The server is not licenced. Copy the developer activation key into c:\liferay\liferay-dxp-tomcat-7.1-sp1/deploy
INFO  [fileinstall-C:/liferay/liferay-dxp-7.1.10.1-sp1/osgi/modules][LicenseManager:?] Digital Enterprise Development license validation passed
INFO  [fileinstall-C:/liferay/liferay-dxp-7.1.10.1-sp1/osgi/modules][LicenseManager:?] License registered for Digital Enterprise Development
Open http://localhost:8080 Login as: test@parkland.ca / test

Configure Workspace

Create a file in the liferay workspace called gradle-local.properties with the following contents. This assumes The workspace is in c:\liferay\parkland-portal and liferay was installed in c:\liferay\liferay-dxp-tomcat-7.1-sp1
#
# Set the folder that contains the Liferay bundle downloaded from the
# "liferay.workspace.bundle.url" property. The default value is "bundles".
#
liferay.workspace.home.dir=../liferay-dxp-7.1.10.1-sp1

Developer Tools

Developers on the project are using Liferay Dev Studio 3.4 If you don't have access on Liferay.com Sam or Sudipto can provide you with the installation files. - Install in c:\liferay it will create a liferay-developer-studio folder - During installation you can skip the activation key and proxy settings - Installation can take a while in windows ☕ - Start it by running DeveloperStudio.exe You will be prompted to create an eclipse-workspace. Recomendation is c:\liferay\eclipse-workspace - After starting it the first time choose Import Liferay Workspace and select the c:\liferay\parkland-portal workspace.

Coding Standards

Naming

Package names should follow the convention: ca.parkland.portal.retail.<feature>.<type> Module names should follow the convention retail-<feature>-<type> Module should be the feature we're building. For example profile or favourites. Type should be one of web, rest, api, service or test. For example retail-userprofile-web

Formatting

Code should be clear and well formatted following generally accepted best practices.
Feel free to make use of the liferay source formatter which can be invoked through ./gradlew checkSourceFormatting to check all the source or ./gradlew formatSource -DformatSource.format.local.changes=true to check your local changes. Additional documentation on the source formatter can be found at https://dev.liferay.com/de/develop/reference/-/knowledge_base/7-1/source-formatter-gradle-plugin
Note: The plugin will complain about a missing copyright. We do not need the Liferay copyright on our source files.

Branching

We will adopt a variant of the feature branch model
  1. Create a Branch for major features based on master
  2. All work for the feature should take place in the branch
  3. Seperate branches are not required for tasks although you may use them locally
  4. When work on the feature is larglely complete merge master into your feature branch
  5. Complete testing and if all acceptance criteria is satisfied open a pull request to merge the feature into master. The pull request should include a link to the feature.
  6. Once accepted the feature will be merged into the master branch

Brand Region setup

mysql> select name,categoryId from AssetCategory where name in (select name from Parkland_Brand);
+----------+------------+
| name     | categoryId |
+----------+------------+
| Fas Gas  |      52268 |
| Esso     |      52269 |
| Pioneer  |      52270 |
| Chevron  |      52271 |
| Ultramar |      52272 |
+----------+------------+
5 rows in set (0.00 sec)

mysql> update Parkland_Brand set categoryId=52286 where name = 'Fas Gas'
    -> ;
ERROR 1054 (42S22): Unknown column 'categoryId' in 'field list'
mysql> update Parkland_Brand set brandCategoryId=52286 where name = 'Fas Gas'
    -> ;
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> update Parkland_Brand set brandCategoryId=52268 where name = 'Fas Gas'
    -> ;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> update Parkland_Brand set brandCategoryId=52269 where name = 'Esso'
    -> ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> update Parkland_Brand set brandCategoryId=52270 where name = 'Pioneer';
Query OK, 0 rows affected (0.01 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> update Parkland_Brand set brandCategoryId=52271 where name = 'Chevron';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> update Parkland_Brand set brandCategoryId=52272 where name = 'Ultramar';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0


mysql> select name,categoryId from AssetCategory where name in ('Ontario','Quebec','West');
+---------+------------+
| name    | categoryId |
+---------+------------+
| Ontario |      52276 |
| Quebec  |      52277 |
| West    |      52275 |
+---------+------------+
3 rows in set (0.00 sec)

mysql> select * from Parkland_Station;
+--------------------------------------+-----------+---------+-----------+--------+----------+----------------------------+----------------------------+--------+----------------+-----------------------+-------------+------------------+
| uuid_                                | stationId | groupId | companyId | userId | userName | createDate                 | modifiedDate               | siteId | organizationId | name                  | fuelBrandId | regionCategoryId |
+--------------------------------------+-----------+---------+-----------+--------+----------+----------------------------+----------------------------+--------+----------------+-----------------------+-------------+------------------+
| 4d3bf285-0b26-f457-1206-f3c1023aca3e |         3 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45922 | Fas Gastest location  |           3 |             NULL |
| 82134286-7cc4-2401-bb90-ba0e14fd1e25 |         4 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45929 | Essotest location     |           4 |             NULL |
| 772eddda-f53e-8405-ea8e-3cff3f0cce73 |         5 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45936 | Pioneertest location  |           5 |             NULL |
| d1afe331-81c9-7213-7ace-6a5e228fc10d |         6 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45943 | Chevrontest location  |           6 |             NULL |
| d858ec50-f666-ab37-2da4-41c7728e0930 |         7 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45950 | Ultramartest location |           7 |             NULL |
+--------------------------------------+-----------+---------+-----------+--------+----------+----------------------------+----------------------------+--------+----------------+-----------------------+-------------+------------------+
5 rows in set (0.00 sec)

mysql> update Parkland_Station set regionCategoryId = 52276;
Query OK, 5 rows affected (0.00 sec)
Rows matched: 5  Changed: 5  Warnings: 0

mysql> update Parkland_Station set regionCategoryId = 52275 where name = 'Fas Ga                                                                s';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> update Parkland_Station set regionCategoryId = 52277 where name = 'Esso';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> select * from Parkland_Station;
+--------------------------------------+-----------+---------+-----------+--------+----------+----------------------------+----------------------------+--------+----------------+-----------------------+-------------+------------------+
| uuid_                                | stationId | groupId | companyId | userId | userName | createDate                 | modifiedDate               | siteId | organizationId | name                  | fuelBrandId | regionCategoryId |
+--------------------------------------+-----------+---------+-----------+--------+----------+----------------------------+----------------------------+--------+----------------+-----------------------+-------------+------------------+
| 4d3bf285-0b26-f457-1206-f3c1023aca3e |         3 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45922 | Fas Gastest location  |           3 |            52276 |
| 82134286-7cc4-2401-bb90-ba0e14fd1e25 |         4 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45929 | Essotest location     |           4 |            52276 |
| 772eddda-f53e-8405-ea8e-3cff3f0cce73 |         5 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45936 | Pioneertest location  |           5 |            52276 |
| d1afe331-81c9-7213-7ace-6a5e228fc10d |         6 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45943 | Chevrontest location  |           6 |            52276 |
| d858ec50-f666-ab37-2da4-41c7728e0930 |         7 |   35698 |     20099 |  20103 | NULL     | 2019-04-05 20:36:06.695000 | 2019-04-05 20:36:06.695000 | NULL   |          45950 | Ultramartest location |           7 |            52276 |
+--------------------------------------+-----------+---------+-----------+--------+----------+----------------------------+----------------------------+--------+----------------+-----------------------+-------------+------------------+
5 rows in set (0.00 sec)

mysql> update Parkland_Station set regionCategoryId = 52277 where name = 'Essotest location';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update Parkland_Station set regionCategoryId = 52275 where name = 'Fas Gastest location';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select x.name,y.name from AssetCategory y JOIN Parkland_Station x on x.regionCategoryId = y.categoryId;
+-----------------------+---------+
| name                  | name    |
+-----------------------+---------+
| Fas Gastest location  | West    |
| Essotest location     | Quebec  |
| Pioneertest location  | Ontario |
| Chevrontest location  | Ontario |
| Ultramartest location | Ontario |
+-----------------------+---------+
5 rows in set (0.00 sec)

Troubleshooting

Gogo shell - system:check
######## MYSTERY SHOPPER SETUP IN LOCAL
(OPTIONAL required only if you want to run Mystery shopper in local, else the modules related to Mystery Shopper will throw error in local)
1) Mystery shopper on premise database is located in Calgary network, so to make Mystery shopper modules work in local you should be connected to VPN. 2) Mystery shopper database is unfortunately on higher version of My SQL so we will need to replace the "mysql.jar" with "mysql-connector-java-5.1.45.jar" in the location "C:\liferay\liferay-dxp-7.1.10.1-sp1\tomcat-9.0.6\lib\ext". The mysql connector can be downloaded from "https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.45/" or ask Sudipto/Sam.
3) Add the following entries:
a) In the C:\liferay\liferay-dxp-7.1.10.1-sp1\tomcat-9.0.6\conf\server.xml add the following entry inside the "GlobalNamingResources" tag.
<Resource
    name="jdbc/mysteryShopperPool"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="com.mysql.jdbc.Driver"           
    url="jdbc:mysql://10.250.240.185:3306/mysteryshopper"
    username="mystery"
    password="mystery"
    maxTotal="100"
    maxIdle="50"
    maxWaitMillis="30000"/>
b) Add the following entries in the C:\liferay\liferay-dxp-7.1.10.1-sp1\tomcat-9.0.6\conf\context.xml add the following entry inside the "Context" tag.
<ResourceLink name="jdbc/mysteryShopperPool" global="jdbc/mysteryShopperPool" type="javax.sql.DataSource"/>
4) Update the liferay fixpack in local to 12.
############# Page Setup for the Performance Data Checklist/MysteryShop
1. Create a page named Performance Details and select the type as "Link to a Page of This Site" and select the page link as Mystery Shop Score (below child page)
2. Create two sub pages for Performance Details: 
    - Mystery Shop Score (tm-mystery-shop-score)
    - Checklist (tm-checklist)
3. Drop the portlet "Mystery Shopper Full View" in Mystery Shop Score Page
4. Drop the portlet "TM Full View" in Checklist Page

Comments

Popular posts from this blog

Portlet Edit Mode (Portlet preference) to replace Portlet configuration

GoGo Shell & What can be deleted in Liferay Instance