Skip to content

Development Environment Setup

Lukas Mohs edited this page Aug 23, 2016 · 75 revisions

Required Software

  1. Install Java JDK 7 and JDK 8 from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  2. Determine the Java home directory path (for JDK 8). Under Mac OS it's usually similar to /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home, but run /usr/libexec/java_home to be sure. Update your profile file to export your Java home directory env variable:

    nano ~/.profile

    Add the line:

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
  3. Install maven. On Mac OS with homebrew: brew install mvn or brew install maven

  4. Install mysql. On Mac OS with homebrew:

    brew install mysql
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  5. Make sure mysql is running. On Mac OS with homebrew:

    brew tap homebrew/services
    brew services start mysql

Setup for Development

  1. Download Liferay 6.2 bundled with Tomcat (Community Edition) from http://www.liferay.com/downloads/liferay-portal/available-releases

  2. Unzip downloaded bundle, let's call the target folder XCOLAB_BUNDLES_DIR

  3. Download tomcat 8 and unzip it in XCOLAB_BUNDLES_DIR. The tomcat root directory should be XCOLAB_BUNDLES_DIR\apache-tomcat-8.0.33. Make sure you use that exact name (including the version).

  4. Remember to change permissions in tomcat's bin folder for executable flags to all scripts
    $chmod +x *.sh

  5. Clone XCoLab GitHub repository: https://github.com/CCI-MIT/XCoLab. Lets call the directory to which the repository was downloaded XCOLAB_SRC.

  6. Create a file at you user directory home with the name .xcolab.application.properties

  7. Copy file XCOLAB_SRC/microservices/services/src/main/resources/application.properties to ~/.xcolab.application.properties and edit it to match your local configuration for mysql and your (fake) smtp server

  8. Copy file XCOLAB_SRC/conf/deploy.properties to ~/.xcolab.deploy.properties, edit that file and set liferay.auto.deploy.dir to XCOLAB_BUNDLES_DIR/deploy (i.e.: liferay.auto.deploy.dir=/Users/Beatrice/projects/XCOLAB_BUNDLES_DIR/deploy Take care that you have no spaces around the equals-sign '=' or after "/deploy").

  9. Now it's needed to put all "parent" artifacts in local maven repository, execute mvn install -N in following dirs

    XCOLAB_SRC
    XCOLAB_SRC/taglibs
    XCOLAB_SRC/themes
    XCOLAB_SRC/services
    XCOLAB_SRC/portlets
    XCOLAB_SRC/hooks
    XCOLAB_SRC/layouts
    XCOLAB_SRC/microservices
    XCOLAB_SRC/microservices/util
    
  10. Install utility libraries

    cd XCOLAB_SRC/microservices/util/xcolab-utils
    mvn compile package install
    
    cd XCOLAB_SRC/microservices/util/service-utils
    mvn compile package install
    
  11. Now put all missing "parent" artifacts in local maven repository, execute mvn install -N in following dirs

    XCOLAB_SRC/microservices/clients
    XCOLAB_SRC/microservices/services
    
  12. Install the client libraries. Make sure you install admin-client and members-client first, as other clients depend on them. You can use following bash script:

    cd XCOLAB_SRC/microservices/clients/admin-client
    mvn clean compile package install clean
    cd ../../..
    
    cd XCOLAB_SRC/microservices/clients/members-client
    mvn clean compile package install clean
    cd ../../..
    
    cd XCOLAB_SRC/microservices/clients
    for D in *; do
        if [ -d "${D}" ]; then
            cd $D
    	    	    pwd
    	    mvn clean compile package install clean
    	    cd ..
        fi
    done
    
  13. Install plansProposalsFacade-service

    cd XCOLAB_SRC/services/plansProposalsFacade
    mvn install -N
    
    cd XCOLAB_SRC/services/plansProposalsFacade/plansProposalsFacade-portlet-service
    mvn compile package install
  14. install common taglibs/libraries

    cd XCOLAB_SRC/taglibs/colabIceFacelets
    mvn compile package install
    
    cd XCOLAB_SRC/taglibs/colabJspTags
    mvn compile package install
  15. Install plansProposalFacade-portlet

    cd XCOLAB_SRC/services/plansProposalsFacade/plansProposalsFacade-portlet
    mvn compile package liferay:deploy -DskipTests=true

    if you get a mvn error while maven is downloading the file jdbc-stdext-2.0.jar or jta-1.0.1B.jar, you can manually download it and install it with the following command (executed in the folder that contains the jar):

    mvn install:install-file -Dfile=jdbc-stdext-2.0.jar -Dpackaging=jar -DgroupId=javax.sql -DartifactId=jdbc-stdext -Dversion=2.0
    mvn install:install-file -Dfile=jta-1.0.1B.jar -Dpackaging=jar -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B

    Note that you need to deactivate tests by adding the skipTests flag: mvn compile package liferay:deploy -DskipTests=true

  16. Install theme, layout tmpl and hooks

    cd XCOLAB_SRC/themes/climatecolab-theme
    mvn compile package liferay:deploy
    
    cd XCOLAB_SRC/layouts/climatecolab-layout
    mvn compile package liferay:deploy
    
    cd XCOLAB_SRC/hooks/climatecolab-hooks
    mvn compile package liferay:deploy
  17. Install all portlets

    cd XCOLAB_SRC/portlets

    for each PORTLET go to PORTLET directory and execute: mvn compile package liferay:deploy

    (you can use following bash script, which is also located at XCOLAB_SRC/portlets/deployALL.sh).

    for D in *; do
      if [ -d "${D}" ]; then
          cd $D
    	pwd
    	mvn compile package liferay:deploy
    	cd ..
      fi
    done
  18. Install all services. You can use following bash script, which is also located at XCOLAB_SRC/deployServices.sh:

    cd XCOLAB_SRC/microservices/services
    for D in *-service; do
        if [ -d "${D}" ]; then
            cd $D
            pwd
            mvn clean compile package spring-boot:repackage
            cd ..
        fi
    done
    
  19. Edit file XCOLAB_BUNDLES_DIR/tomcat-xxx/conf/context.xml

    inside add definition of jdbc/LiferayPool resource, IE:

    <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/LiferayPool" password="liferay" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/xcolab?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false" username="liferay"/>

By editing the 'server.xml' file, you can also set the port (if 8080 doesn't work, try 8081).

  1. Copy XCOLAB_SRC/conf/portal-ext.properties to XCOLAB_BUNDLES_DIR/tomcat-xxx/webapps/ROOT/WEB-INF/classes

  2. Copy images

    mkdir XCOLAB_BUNDLES_DIR/tomcat-7.0.42/webapps/ROOT/WEB-INF/classes/images
    cp XCOLAB_SRC/conf/member_photo.png XCOLAB_BUNDLES_DIR/tomcat-xxx/webapps/ROOT/WEB-INF/classes/images/
  3. Create a database that uses "utf8mb4 collation" encoding and specify a user & password (for the context.xml set above, it's liferay:liferay).:

    mysql -u liferay -p 
    CREATE DATABASE xcolab
        CHARACTER SET utf8mb4
        COLLATE utf8mb4_unicode_ci;
  4. Import newest database dump (ask Patrick for it):

    cat dump.sql.bz2 | bunzip2 | mysql -u liferay -p xcolab 
    
  5. Change XCOLAB_BUNDLES_DIR/tomcat-xxx/bin/setenv.sh to increase PermGen and set the Java Home path for JDK 7. At least you should use an xmx of 2048 and permgen of 512, but preferrably more if you can. Make sure you set the path to JDK version 7, as version 8 will lead to runtime errors.

  6. Unzip simulation client lib into XCOLAB_BUNDLES_DIR/tomcat-xxx/lib/ext

    cd XCOLAB_BUNDLES_DIR/tomcat-xxx/lib/ext
    unzip XCOLAB_SRC/other/simulation-client.zip 
  7. Download document_library.zip (ask Patrick for it) and unpack it in XCOLAB_BUNDLES_DIR/data

  8. Edit XCOLAB_BUNDLES_DIR/portal-setup-wizard.properties and verify the path to liferay.home is correct (/Users/pdeboer/Documents/liferay/liferay-portal-6.2.0-ce-ga1 on my system)

  9. Run the liferay server:

    XCOLAB_BUNDLES_DIR/tomcat-xxx/bin/startup.sh
  10. Follow the server logs:

    tail -f XCOLAB_BUNDLES_DIR/tomcat-xxx/logs/catalina.out

    If you get the following exception: "The database contains changes from a previous upgrade attempt that failed.", modify the Release_ MySQL table and set the state_ column of all rows to 0: use xcolab; update Release_ set state_=0;. If you get an error that another version of Liferay is to be deployed, in the Release_ Table change the column buildNumber of the row with releaseid = 1 according to your version of Liferay (e.g. 6201 for Liferay 6.2.1): use xcolab; update Release_ set buildNumber=6204 where releaseid=1;

  11. Start the microservice server:

    XCOLAB_BUNDLES_DIR/apache-tomcat-8.0.33/bin/startup.sh
  12. Follow the logs:

    tail -f XCOLAB_BUNDLES_DIR/apache-tomcat-8.0.33/logs/catalina.out
    
  13. If you're working on one of our test servers: Reset the e-Mail settings (Control Panel / Server Admin / Mail. Set the credentials for the SMTP server to something that doesn't work)

Clone this wiki locally