CVRG Waveform Development Environment Configuration
From CVRG Wiki
Waveform Development Environment Configuration
Installing the Liferay Environment
The instructions will guide the user in the manual installation of the Waveform3 web application developed by the CVRG. It is assumed that the user is comfortable with the Linux environment and has sudo privileges. It is also assumed the user knows when and how to use sudo. If you do not have sudo privileges or are not fully confident in the Linux environment, please seek assistance .
- Navigate to [Liferay Portal 6.1.1 on SourceForge] (formerly https://www.liferay.com/downloads/liferay-portal/available-releases)
- Be sure the Liferay version you're downloading is 6.1.1 GA2.
- In the drop-down menu by Liferay Portal 6.1 Community Edition download the following bundles:
- Bundled with Tomcat (wget 'http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.1.1%20GA2/liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip')
- Portal JavaDocs (wget 'http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.1.1%20GA2/liferay-portal-doc-6.1.1-ce-ga2-20120806125709432.zip')
- Portal Source (wget 'http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.1.1%20GA2/liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip')
- Plugins SDK (wget 'http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.1.1%20GA2/liferay-plugins-sdk-6.1.1-ce-ga2-20121004092655026.zip')
Create the Liferay Folder Structure
- Create folder /opt/liferay
- Change the ownership of the liferay folder to user tomcat.
- Copy the four zip files downloaded earlier from the Download folder to /opt/liferay
- Unzip the file liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip
Note: Do not delete the zip file!
- Rename the resulting folder to waveform3
- Unzip the file liferay-plugins-sdk-6.1.1-ce-ga2-20121004092655026.zip
- The resulting folder, liferay-plugins-sdk-6.1.1, should be at the same level as the Liferay/Tomcat bundle (waveform3).
Configure the Plugins SDK
- In the plugins SDK folder, create a new file called build.[your username].properties
- Paste the following text into the file:
- app.server.portal.dir = /opt/liferay/waveform3/tomcat-7.0.27/webapps/ROOT
- app.server.lib.global.dir = /opt/liferay/waveform3/tomcat-7.0.27/lib/ext
- app.server.deploy.dir = /opt/liferay/waveform3/tomcat-7.0.27/webapps
- app.server.type = tomcat
- app.server.dir = /opt/liferay/waveform3/tomcat-7.0.27
Note that the precise version number for Tomcat may vary. Verify that the version above matches the version on your server. Also verify that this folder structure does, in fact, match the structure you’ve created.
- Save the file.
- Obtain copies of the modified build-common-plugin.xml and the build-common.xml files from the following Basecamp link: | build files
- Paste these files into the SDK folder, overwriting the originals.
- Create the folder /opt/liferay/portlet-ext
- Create the folder /opt/liferay/portlet-opt
- Create the folder /opt/liferay/utility-jars
- Create the folder /opt/liferay/utility-builds
Remove Demo and Prepackaged data
- Navigate to /opt/liferay/waveform3/data/hsql
- Delete all files in this folder.
- Navigate to /opt/liferay/waveform3/tomcat-7.0.27/webapps
- Delete the welcome-theme folder.
Add Necessary .jar Files
- There is a set of jar files that are necessary to support the portlets being used with CVRG resources. Obtain copies of these files.
Obtain a list of the correct jars and versions from a team lead or by examining an existing installation until the complete list has been finalized.
- Similarly, a set of .jar files should be placed in the /opt/liferay/portlet-ext folder, obtain this list in the same way as above.
Installing and Configuring the Database
The database being used for this implementation is a PostgreSQL database. This is connected to Liferay and serves as the backend for Liferay configurations and settings.
- Download the PostgreSQL .rpm file and install it using the command: rpm –ivh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
- Install PostgreSQL using the command: yum install postgresql91-server.x86_64
- Initialize the cluster using the command: service postgresql-9.1 initdb
PostgreSQL is now installed on your CentOS 6 machine and can be started and stopped as a service.
- Start postgreSQL: service postgresql-9.1 start
- Stop postgreSQL: service postgresql-9.1 stop
- Restart postgreSQL: service postgresql-9.1 restart
To configure PostgreSQL to startup automatically when the server starts, enter the following command: chkconfig postgresql-9.1 on
Configure postgres account
As part of the installation of PostgreSQL on the system, a new account called “postgres” was created in the Linux environment. It is necessary to use this account to access the PostgreSQL database. The account exists, but cannot be used until it is assigned a password.
- Use the command: sudo passwd postgres
- You will be prompted to enter a password. Keep track of the password you have entered as it will be needed elsewhere.
Create the Liferay User Account
Now it is possible to use this account to access PostgreSQL. It is necessary to create an account specifically for Liferay to access the database.
- Create the account in Linux with the following command: sudo adduser liferay
- Set the password for that account with the following command: sudo passwd liferay
- Keep track of the password you set.
Create the DB Liferay account and Liferay Database
- Switch to the postgres account with the following command: su postgres
- Enter the PostgreSQL database client with the following command: psql
- Create liferay account in PostgreSQL with the following command: CREATE USER liferay WITH PASSWORD ‘<use the password you set for the liferay account>’;
- Create the database with the following command:CREATE DATABASE lportal;
- Give full access to that database to the liferay account with the following command: GRANT ALL PRIVILEGES ON DATABASE lportal TO liferay;
- Exit PostgreSQL with the following command: \q
Configure PostgreSQL to Accept Local Connections
- While still working as user postgres, use the vi editor to change the configuration file with the following command: vi /var/lib/pgsql/9.1/data/pg_hba.conf
- Under the commented section, make it look like this:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres trust
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
- Restart PostgreSQL with the following command: service postgresql-9.1 restart
Run Database Creation Scripts
In the project cvrg-dataStorage on the CVRG GitHub repository is a series of .sql scripts that will need to be run as use postgres. Please follow the instructions provided in the project readme file.
- Navigate to /opt/liferay/waveform3/tomcat-7.0.27/bin
- Run the startup script by running the command ./startup.sh
It is useful to observe the catalina log output during startup to view any errors that may occur.
- To view the log, enter the command tail –f ../logs/catalina.out
Once the Tomcat startup is complete, open a web browser and navigate to the server URL (or localhost:8080) and the Liferay configuration page will display. Here, you can enter the basic information for the Administrator account to be used with the portal. Simply enter the appropriate information into the fields to set up your first name, last name and E-mail address.
- Under the Database section, click the “change” link.
- Make it look like this (again, use the password that you set for the liferay account.):
- Click “Finish Configuration”
Installing and Configuring the Development IDE
Basic Eclipse Configuration
- To begin, it is necessary to download and configure the Eclipse IDE. At this time, the preferred version is Eclipse 4.2 (Juno) as it has all of the necessary plugins to accomplish the required work.
- Go to the Eclipse website http://www.eclipse.org/downloads/packages/release/juno/r and download Eclipse IDE for Java EE Developers.
- Unzip the downloaded file into the desired folder. Recommended folders are /opt/eclipse or /home/[username]/eclipse.
- If you install to /opt, make sure to sudo chown –R [username] /opt/eclipse.
- Start Eclipse using the “eclipse” executable file in the new folder.
- Once Eclipse has started, it will be necessary to install and update the needed plugins. Begin by clicking Help Eclipse Marketplace…
- In the “Find:” field, enter “egit” and click the “Go” button.
- When the list of results appears, click “Install” (The “Install” button may instead say “Update.”)
- Follow the instructions.
- Open the Eclipse Marketplace again and search for “liferay”
- Click the”Install” button to install the Liferay IDE.
Configure the Eclipse IDE for Liferay
- Although the Liferay IDE is installed, it still needs to be configured to work with the local development environment.
- In Eclipse, click Window -> Preferences
- Click Liferay in the left hand pane.
- In the configuration section, click the link labeled “Configure installed Liferay Plugin SDKs”
- Click Add…
- Click Browse to navigate to the Liferay Plugins SDK folder.
- Click OK
- Click Liferay again in the left hand pane.
- Click the link labeled “Create a new Liferay runtime environment.”
- Select Liferay v6.1 CE (Tomcat 7) and click Next>
- Under Liferay Tomcat directory click “Browse” to navigate to the waveform3 folder you created earlier.
- Click OK
- Click Next >
- Here you will configure your other Liferay Resources. Under Liferay Javadoc URL click “Browse zip…” to browse to the file liferay-portal-doc-6.1.1-ce-ga2-20120806125709432.zip in the /opt/liferay folder.
- Under Liferay source location click “Browse zip…” to browse to the file liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip
- Under Liferay Tomcat bundle zip file click “Browse…” to browse to the file liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip in the /opt/liferay folder.
- Click Finish
Install Liferay Globus Nexus Authentication
Install Custom Authentication Extension
- Pull the cvrg-ext plugin project from Github
- Import into Eclipse, under the ext folder in the Liferay SDK per the instructions below.
- Build the project. Your Liferay SDK should already be configured to automatically deploy to your Liferay instance.
Restart Liferay and Configure Authentication
- Run the following command under /opt/liferay-portal-6.0.6/tomcat-6.0.29/bin: sudo ./shutdown.sh
- Once Tomcat has completely shut down, run the following command under /opt/liferay-portal-6.0.6/tomcat-6.0.29/bin: sudo ./startup.sh
Go ahead and download the latest Maven binary from its official site.
For this demo we will use the version 3.2.5 (apache-maven-3.2.5-bin.tar.gz)
After downloading the tarball, go to the download location and execute the following commands:
$ sudo tar -xzf apache-maven-3.2.5-bin.tar.gz -C /usr/local
$ cd /usr/local
$ sudo ln -s apache-maven-3.2.5 maven
Next, set up the Maven path:
Create the maven.sh file in /etc/profile.d/ location.
$ sudo vi /etc/profile.d/maven.sh
And insert the lines below into the new file:
Finally, log out and log in again to activate the above environment variables.
To verify successful installation of maven, check the version of maven:
$ mvn -version
To set WFDB features on your machine. Follow the steps below:
- Download the WFDB Application source from http://www.physionet.org/physiotools/wfdb.tar.gz, and save in a temporary folder.
- Extract the tarball using the command
sudo tar -xvf wfdb.tar.gz
- Navigate to the new folder extracted from the tarball.
- Create the file /etc/profile.d/wfdb.sh and add the following line to it:
- Create the file /etc/ld.so.conf.d/wfdb.conf and add the following lines to it:
- Restart the server to make the change take effect.
sudo ./configure --prefix=/opt/wfdb-$version_number
sudo make install
- Create a symbolic link to the installation directory:
ln -s /opt/wfdb-$version_number /opt/wfdb
- To check your installation, make sure that bin, database, include, lib, lib64 and share folders have been created in /opt/wfdb directory.
- From in the root of the extracted wfdb folder, try to execute the following command:
app/sampfreq -H data/100s
The result should be output:360
- If so, the install was successful.
In addition to WFDB it is necessary to install the PNN/PNNList application.
- Download the pNNx binaries from: http://www.physionet.org/physiotools/pNNx/pNNx.i386-linux.tar.gz
- Go to download folder and extract the file:
tar -zxvf pNNx.i386-linux.tar.gz
- Create a pNNx folder in /opt directory:
sudo mkdir /opt/pNNx
- Change the folder owner user:
sudo chown -R tomcat /opt/pNNx
- Copy the content from the temporary(pNNx.i386-linux) folder to /opt/pNNx:
sudo cp pNNx.i386-linux/* /opt/pNNx
- Create a soft links:
sudo ln -s /opt/pNNx/pNNx /usr/bin/pNNx
sudo ln -s /opt/pNNx/pnnlist /usr/bin/pnnlist
- To check your install, execute the command below:
- If the output works, the install was successful.
Chesnokov is an Windows application and to execute it on Linux environment, you have to install the Wine Application.
First of all, we need to Enable & Install the EPEL Repo (Extra Packages for Enterprise Linux Repository)
- Go to temporary directory: cd /tmp
- Download the EPEL Repo install file: wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
- Install the EPEL Repo: sudo rpm -ivh epel-release-6-8.noarch.rpm
- Run the following: yum repolist | grep epel
- And this is the expected output:
* epel: mirror.cogentco.com
epel Extra Packages for Enterprise Linux 6 - x86_64 10,023
With the EPEL Repo installed, you can install Wine. Install use yum. The installer might take up-to 20-30 minutes.
- Run the following command: sudo yum install wine* --enablerepo=epel
- Check installation: winecfg
- Check configuration window that opens:
- Create the /opt/autoqrs directory: sudo mkdir /opt/autoqrs
- Change the folder owner: sudo chown –R tomcat /opt/autoqrs
- Download the chesnokov zip file.
- Extract the zip file to autoqrs folder: sudo unzip Chesnokov_XML_Release.zip -d /opt/autoqrs
- Verify that the Release folder has been created inside the autoqrs folder
- To test use this command, inside Release folder: wine ecg.exe filters [dat file]
The cvrg-services project handle all web services from Waveform which run using the Axis 2 framework.
Before you checkout this project verify the Axis2 environment is defined by navigating to this URL: http://localhost:8080/axis2/
To set up the Axis2 environment it is necessary to deploy the axis2 WAR file.
- Go to the Axis2 releases web site: http://axis.apache.org/axis2/java/core/download.cgi
- At this moment we are using version 1.4.1. Go down to the “Old releases” table and download the WAR Distribution[axis2.war]
- Open the downloaded war file and find the axis2.war file. (Yes, it’s a war within a war.)
- Move axis2.war file to /opt/liferay/waveform3/tomcat-7.0.27/webapps
- Start the server. And check if the axis2 folder has been created inside webapps folder. If so the install was successful.
To set up the maven workspace. Create the default workspace folder: /opt/liferay/utility-builds
Go ahead and import all Git projects below into your workspace. (Be sure to use the specified branch):
Note: All projects should be located in the workspace folder except the Portlet projects. The portlet projects should be placed in /opt/liferay/liferay-plugins-sdk-6.1.1/portlets
Pull Projects/Plugins from Github (projectName [branch])
The CVRG plugin respository is at <undisclosed location>
- maven-parents [master]
- waveform3-config-files [master]
- jsierraecg [master]
- Philips1.04 [master]
- schiller-data [master]
- hl7aECG [master]
- ECG_Converter4 [master]
- cvrg-annotations [master]
- cvrg-analysisHub [master]
- cvrg-dataStorage [master]
- waveform-utilities [master]
- cvrg-filestore [master]
- liferay-ws-client [master]
- cvrg-services [master]
- analyze-portlet [master]
- download-portlet [master]
- visualize-portlet [master]
- upload-portlet [master]
- welcome-portlet [master]
- cvrg-ext [master]
- cvrg_authenticator [master]
- Globus-Nexus-Java-Client [master]
To import a plugin project from Github into Eclipse:
- Click File -> Import
- Under Git select Projects from Git
- Click Next >
- Select URI and click Next >
- In the URI field, enter <undisclosed location>/[plugin name].git
- The Host and Repository Path should auto-fill.
- The Protocol field should auto-fill to https
- You may leave the remaining fields blank.
- Click Next >
- On the Branch Selection screen Click Next >
- On the Local Destination screen, click Browse to set the Directory field to point to the path to the appropriate folder in your Liferay Plugins SDK. (For example, a portlet would go into /opt/liferay/liferay-plugins-sdk-6.1.1/portlets)
- Click Next >
- On the Wizard for project import screen, select Import existing projects and click Next >
- If the project not load, go back on the last screen, select Import as general project and click Next >
- Click Finish
- The new plugin will automatically be detected as a Liferay plugin. It may be necessary to configure the proper source folder so that the packages will display properly. Right click the project and select Build Path -> Configure Build Path…
- Click the Source tab
- Remove the path displayed there
- Click Add Folder
- Browse to the [plugin name]/docroot/WEB-INF/src folder and click OK
- Click OK in the Build Path screen
- The portlet source packages should now display properly.
Properties, Database and Test Files
After you checkout all projects by the correct branch, we have to check all properties files, database structure and maven test files.
- Properties files
- To make sure that you have the correct properties which waveform needs, check the files in waveform3-config-files in the GitHub repository. There you will find all required properties for liferay and waveform, except the liferay admin, axis transfer and database credentials.
- Database Structure
- It the cvrg-dataStorage project, you will find the sql folder at ../cvrg-dataStorage/src/main/sql. In this folder you will find all the instructions to set a new database, or the creation SQL scripts to check if your entities are OK.
- Maven Test files
- There is a folder called /maven/mavenTestResources in dropbox. Copy this folder to /opt/liferay/ to avoid errors on maven tests. This folder contains sample of ECG files to perform testing at cvrg-analysisHub, cvrg-annotations and ECG_Converter4 projects.
Now, it's time to compile all JARS, Web Services and Portlets.
The JARs and the Web Services use maven to compile, and the portles use the native liferay ANT script.
To compile all maven projects, you should go over the .../maven-parents/waveform folder and locate the pom.xml file. And execute the command below:
This command will compile, test, pack and move all jars to your local Tomcat/Liferay installation. Also cvrg-services.aar will copied to the correct axis2 folder.
After this execute the clean and deploy targets to all portlets ANT scripts using the command in the /opt/liferay/liferay-plugins-sdk-6.1.1/portlets folder:
Deploying a Plugin/Undeploying an Ext Plugin
Deploy a plugin
When you are ready to deploy a plugin you’ve been working on, the procedure is virtually the same for all plugin types, with a little extra for an ext plugin.
- Right click the project in Eclipse and click Liferay -> SDK -> deploy
- The Ant build script will automatically build the plugin and copy it to the deploy folder in the waveform3 folder. Liferay/Tomcat will then hot deploy it. No restart is required except…
- If the plugin is an Ext plugin, a restart is necessary after deployment because it add new jar files to the server’s global path.
Note that this same procedure is used when deploying an updated version of a plugin. Again, this is not true of Ext plugins, which have a more involved undeploy procedure:
Undeploy an Ext plugin
Run the following commands:
- cd /opt/liferay/waveform3/tomcat
- bin/shutdown.sh # stopping Liferay
- rm -rf webapps/*-ext # deleting web application
- find -name "ext-*" | xargs rm –rf # deleting jars and config files from Liferay
- bin/startup.sh # Starting Liferay
- tail -f logs/catalina.out