CVRG Waveform Development Environment Configuration

From CVRG Wiki

Jump to: navigation, search

Contents

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 .

Download Liferay

  1. Navigate to [Liferay Portal 6.1.1 on SourceForge] (formerly https://www.liferay.com/downloads/liferay-portal/available-releases)
  2. Be sure the Liferay version you're downloading is 6.1.1 GA2.
  3. In the drop-down menu by Liferay Portal 6.1 Community Edition download the following bundles:

Create the Liferay Folder Structure

  1. Create folder /opt/liferay
  2. Change the ownership of the liferay folder to user tomcat.
  3. Copy the four zip files downloaded earlier from the Download folder to /opt/liferay
  4. Unzip the file liferay-portal-tomcat-6.1.1-ce-ga2-20120731132656558.zip
    Note: Do not delete the zip file!
  5. Rename the resulting folder to waveform3
  6. Unzip the file liferay-plugins-sdk-6.1.1-ce-ga2-20121004092655026.zip
  7. 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

  1. In the plugins SDK folder, create a new file called build.[your username].properties
  2. 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.

  1. Save the file.
  2. Obtain copies of the modified build-common-plugin.xml and the build-common.xml files from the following link: | build files
  3. Paste these files into the SDK folder, overwriting the originals.
  4. Create the folder /opt/liferay/portlet-ext
  5. Create the folder /opt/liferay/portlet-opt
  6. Create the folder /opt/liferay/utility-jars
  7. Create the folder /opt/liferay/utility-builds

Remove Demo and Prepackaged data

  1. Navigate to /opt/liferay/waveform3/data/hsql
  2. Delete all files in this folder.
  3. Navigate to /opt/liferay/waveform3/tomcat-7.0.27/webapps
  4. 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.

Installing PostgreSQL

  1. 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
  2. Install PostgreSQL using the command: yum install postgresql91-server.x86_64
  3. 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.

  1. Use the command: sudo passwd postgres
  2. 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.

  1. Create the account in Linux with the following command: sudo adduser liferay
  2. Set the password for that account with the following command: sudo passwd liferay
  3. Keep track of the password you set.

Create the DB Liferay account and Liferay Database

  1. Switch to the postgres account with the following command: su postgres
  2. Enter the PostgreSQL database client with the following command: psql
  3. Create liferay account in PostgreSQL with the following command: CREATE USER liferay WITH PASSWORD ‘<use the password you set for the liferay account>’;
  4. Create the database with the following command:CREATE DATABASE lportal;
  5. Give full access to that database to the liferay account with the following command: GRANT ALL PRIVILEGES ON DATABASE lportal TO liferay;
  6. Exit PostgreSQL with the following command: \q

Configure PostgreSQL to Accept Local Connections

  1. 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
  2. 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
  3. 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.

Start Liferay

  1. Navigate to /opt/liferay/waveform3/tomcat-7.0.27/bin
  2. 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.
  3. 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.
  4. Under the Database section, click the “change” link.
    Liferay Database
  5. Make it look like this (again, use the password that you set for the liferay account.):
    Liferay Database Entry Screen
  6. 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.
  1. Go to the Eclipse website http://www.eclipse.org/downloads/packages/release/juno/r and download Eclipse IDE for Java EE Developers.
  2. Unzip the downloaded file into the desired folder. Recommended folders are /opt/eclipse or /home/[username]/eclipse.
    1. If you install to /opt, make sure to sudo chown –R [username] /opt/eclipse.
  3. Start Eclipse using the “eclipse” executable file in the new folder.
  4. Once Eclipse has started, it will be necessary to install and update the needed plugins. Begin by clicking Help  Eclipse Marketplace…
  5. In the “Find:” field, enter “egit” and click the “Go” button.
  6. When the list of results appears, click “Install” (The “Install” button may instead say “Update.”)
  7. Follow the instructions.
  8. Open the Eclipse Marketplace again and search for “liferay”
  9. 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.
  1. In Eclipse, click Window -> Preferences
  2. Click Liferay in the left hand pane.
  3. In the configuration section, click the link labeled “Configure installed Liferay Plugin SDKs”
  4. Click Add…
  5. Click Browse to navigate to the Liferay Plugins SDK folder.
  6. Click OK
  7. Click Liferay again in the left hand pane.
  8. Click the link labeled “Create a new Liferay runtime environment.”
  9. Select Liferay v6.1 CE (Tomcat 7) and click Next>
  10. Under Liferay Tomcat directory click “Browse” to navigate to the waveform3 folder you created earlier.
  11. Click OK
  12. Click Next >
  13. 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.
  14. Under Liferay source location click “Browse zip…” to browse to the file liferay-portal-src-6.1.1-ce-ga2-20120731132656558.zip
  15. 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.
  16. Click Finish

Install Liferay Globus Nexus Authentication

Install Custom Authentication Extension

  1. Pull the cvrg-ext plugin project from Github
  2. Import into Eclipse, under the ext folder in the Liferay SDK per the instructions below.
  3. Build the project. Your Liferay SDK should already be configured to automatically deploy to your Liferay instance.

Restart Liferay and Configure Authentication

  1. Run the following command under /opt/liferay-portal-6.0.6/tomcat-6.0.29/bin: sudo ./shutdown.sh
  2. 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


Maven install

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:

export M2_HOME=/usr/local/maven

export PATH=${M2_HOME}/bin:${PATH}

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

Physionet Applications

To set WFDB features on your machine. Follow the steps below:

  1. Download the WFDB Application source from http://www.physionet.org/physiotools/wfdb.tar.gz, and save in a temporary folder.
  2. Extract the tarball using the command
    sudo tar -xvf wfdb.tar.gz
  3. Navigate to the new folder extracted from the tarball.
  4. Create the file /etc/profile.d/wfdb.sh and add the following line to it:
    export PATH=$PATH:/opt/wfdb/bin
  5. Create the file /etc/ld.so.conf.d/wfdb.conf and add the following lines to it:
    /opt/wfdb/lib64
    /opt/wfdb/lib
  6. Restart the server to make the change take effect.
  7. Run:
    sudo ./configure --prefix=/opt/wfdb-$version_number
    sudo make
    sudo make install
    sudo ldconfig
  8. Create a symbolic link to the installation directory:
    ln -s /opt/wfdb-$version_number /opt/wfdb
  9. To check your installation, make sure that bin, database, include, lib, lib64 and share folders have been created in /opt/wfdb directory.
  10. 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
  11. If so, the install was successful.

In addition to WFDB it is necessary to install the PNN/PNNList application.

  1. Download the pNNx binaries from: http://www.physionet.org/physiotools/pNNx/pNNx.i386-linux.tar.gz
  2. Go to download folder and extract the file:
    tar -zxvf pNNx.i386-linux.tar.gz
  3. Create a pNNx folder in /opt directory:
    sudo mkdir /opt/pNNx
  4. Change the folder owner user:
    sudo chown -R tomcat /opt/pNNx
  5. Copy the content from the temporary(pNNx.i386-linux) folder to /opt/pNNx:
    sudo cp pNNx.i386-linux/* /opt/pNNx
  6. Create a soft links:
    sudo ln -s /opt/pNNx/pNNx /usr/bin/pNNx
    sudo ln -s /opt/pNNx/pnnlist /usr/bin/pnnlist
  7. To check your install, execute the command below:
    pNNx -h
  8. If the output works, the install was successful.

Chesnokov Application

Chesnokov is an Windows application and to execute it on Linux environment, you have to install the Wine Application.

Wine Install

First of all, we need to Enable & Install the EPEL Repo (Extra Packages for Enterprise Linux Repository)

  1. Go to temporary directory: cd /tmp
  2. Download the EPEL Repo install file: wget https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  3. Install the EPEL Repo: sudo rpm -ivh epel-release-6-8.noarch.rpm
  4. Run the following: yum repolist | grep epel
  5. 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.

  1. Run the following command: sudo yum install wine* --enablerepo=epel
  2. Check installation: winecfg
  3. Check configuration window that opens:


Wine Configuration

Chesnokov Install

  1. Create the /opt/autoqrs directory: sudo mkdir /opt/autoqrs
  2. Change the folder owner: sudo chown –R tomcat /opt/autoqrs
  3. Download the chesnokov zip file.
  4. Extract the zip file to autoqrs folder: sudo unzip Chesnokov_XML_Release.zip -d /opt/autoqrs
  5. Verify that the Release folder has been created inside the autoqrs folder
  6. To test use this command, inside Release folder: wine ecg.exe filters [dat file]

Axis2 Environment

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/

Axis2 install

To set up the Axis2 environment it is necessary to deploy the axis2 WAR file.

  1. Go to the Axis2 releases web site: http://axis.apache.org/axis2/java/core/download.cgi
  2. At this moment we are using version 1.4.1. Go down to the “Old releases” table and download the WAR Distribution[axis2.war]
  3. Open the downloaded war file and find the axis2.war file. (Yes, it’s a war within a war.)
  4. Move axis2.war file to /opt/liferay/waveform3/tomcat-7.0.27/webapps
  5. Start the server. And check if the axis2 folder has been created inside webapps folder. If so the install was successful.

Workspace Setup

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>

GENERAL

  • maven-parents [master]
  • waveform3-config-files [master]

JARS

  • 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]

WEB SERVICE

  • cvrg-services [master]

PORTLETS

  • analyze-portlet [master]
  • download-portlet [master]
  • visualize-portlet [master]
  • upload-portlet [master]
  • welcome-portlet [master]

EXTENSION

  • cvrg-ext [master]
  • cvrg_authenticator [master]
  • Globus-Nexus-Java-Client [master]


To import a plugin project from Github into Eclipse:

  1. Click File -> Import
  2. Under Git select Projects from Git
  3. Click Next >
  4. Select URI and click Next >
  5. In the URI field, enter <undisclosed location>/[plugin name].git
  6. The Host and Repository Path should auto-fill.
  7. The Protocol field should auto-fill to https
  8. You may leave the remaining fields blank.
  9. Click Next >
  10. On the Branch Selection screen Click Next >
  11. 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)
  12. Click Next >
  13. On the Wizard for project import screen, select Import existing projects and click Next >
  14. If the project not load, go back on the last screen, select Import as general project and click Next >
  15. Click Finish
  16. 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…
  17. Click the Source tab
  18. Remove the path displayed there
  19. Click Add Folder
  20. Browse to the [plugin name]/docroot/WEB-INF/src folder and click OK
  21. Click OK in the Build Path screen
  22. 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:

mvn install

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:

ant deploy

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.

  1. Right click the project in Eclipse and click Liferay -> SDK -> deploy
  2. 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…
  3. 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:

  1. cd /opt/liferay/waveform3/tomcat
  2. bin/shutdown.sh # stopping Liferay
  3. rm -rf webapps/*-ext # deleting web application
  4. find -name "ext-*" | xargs rm –rf # deleting jars and config files from Liferay
  5. bin/startup.sh # Starting Liferay
  6. tail -f logs/catalina.out
Personal tools
Project Infrastructures