Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
dkapoor committed Sep 28, 2016
2 parents e4aac80 + 8648997 commit dd45c6f
Show file tree
Hide file tree
Showing 67 changed files with 2,456 additions and 334 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.history
*.iml
atlassian-ide-plugin.xml
java_pid*.hprof
Expand Down
1 change: 1 addition & 0 deletions karma-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/*
60 changes: 60 additions & 0 deletions karma-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Karma-app
=========
Karma desktop app for linux, windows and mac using which you can easily launch Karma.

![](http://i.imgur.com/LtQcfmi.png)

##Installation
Download [karma app](https://github.com/usc-isi-i2/Web-Karma/releases) for your operating system. Then, install [java](https://www.java.com/en/download/help/download_options.xml) if you don't already have it. Installation of the right version of java is important. For instance, if you are running a 64bit windows, you have to download 64bit java for windows.
###Linux
Run `./Karma` on terminal.
###Mac
Navigate to the folder and open `Karma.app`
###Windows
First [set JRE_HOME](https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html) environmment variable. Then, navigate to the folder and open `Karma.exe`

##Usage
Once Karma app is opened, it automatically starts the server and launches on a web browser (It can take sometime the first time). In order to open a new instance on the browser, you can either click on "Open New Window" on the app or open `localhost:8080` on a new window in the browser.

##Configuration
You can set maximum heap size for karma on the main window. Once you change it, you need to __restart karma__.

![](http://i.imgur.com/zMUotto.png)


##Building the app from code.

1. Install:

1. latest [node](https://nodejs.org/en/)
2. electron-packager - `sudo npm install -g electron-packager`
3. wget - `brew install wget`
4. wine -
* if building on Mac[](https://www.davidbaumgold.com/tutorials/wine-mac/)

```
brew doctor
brew update
brew tap caskroom/cask
brew cask install xquartz
brew install wine
```
* if building on Linux: `sudo apt-get install wine`
2. Clone this repository and navigate to `karma-app` folder.
3. Make sure the npm python points to 2.7 version `npm config set python python2.7`
4. Run `./build --archive` to build and generate the zip files for all OS
5. The builds for all operating systems will be found in the target folder in `karma-app` folder.
Karma app is built for linux, windows and mac for both ia32 and x64 versions as follows when `./build` is run:
1. Navigates to karma-web directory and creates a shaded .war file.
2. Copies the .war snapshot and other .war files in external_webapps to the target folder.
3. Downloads apache tomcat.
4. Copies the war files to webapps folder in tomcat.
5. Copies conf files to tomcat folder.
6. Navigates to the electron app folder (desktop) and copies the tomcat folder to app directory.
7. Then we install all the dependencies and create a pre-release.
8. We then use electron-packager to create packages for all the OSes and their flavors.
9. The packages built are then copied to the target folder.
10. If the build script is run wit `--archive` option, it will create zip archives of all the builds.
74 changes: 74 additions & 0 deletions karma-app/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

########################################
# This build script:
# 1. Navigates to karma-web directory and creates a shaded .war file.
# 2. Copies the .war snapshot and other .war files in external_webapps to the target folder.
# 3. Downloads apache tomcat.
# 4. Copies the war files to webapps folder.
# 5. Copies conf files to tomcat folder.
# 6. Navigates to the electron app folder and copies the tomcat folder to app/app directory.
# 7. Runs the release script there to build karma app for linux, windows and mac.
########################################

CURRENT=`pwd`
rm -rf target
mkdir target

cd ..
mvn clean install -Dmaven.test.skip=true
cd karma-web/
mvn package -Pshaded
cp target/karma-web*.war $CURRENT/target/ROOT.war
cp external_webapps/* $CURRENT/target/

mv $CURRENT/target/cluster*.war $CURRENT/target/clusterService.war

cd $CURRENT/target

# download tomcat binary
wget http://apache.cs.utah.edu/tomcat/tomcat-7/v7.0.72/bin/apache-tomcat-7.0.72.zip -O tomcat.zip

# TODO if this fails, exit
unzip tomcat.zip
rm tomcat.zip

mv apache-tomcat* tomcat
rm -rf tomcat/webapps/*
mv *.war tomcat/webapps
chmod +x tomcat/bin/*.sh

cp $CURRENT/conf/* tomcat/conf/

rm -rf $CURRENT/desktop/app/tomcat
mv tomcat $CURRENT/desktop/app/

cd $CURRENT/desktop
npm install
npm run prerelease
cd app
electron-packager . --platform=win32 --arch=x64 --icon=../resources/icons/karma.ico --overwrite
electron-packager . --platform=linux --arch=x64 --icon=../resources/icons/karma.png --overwrite
electron-packager . --platform=darwin --arch=x64 --icon=../resources/icons/karma.icns --overwrite

cp -rf Karma-darwin* $CURRENT/target/Karma-Mac
cp -rf Karma-linux* $CURRENT/target/Karma-Linux
cp -rf Karma-win* $CURRENT/target/Karma-Windows
rm -rf Karma-*

cd $CURRENT/target

#put our license
for build_folder in `ls |grep Karma`
do
mv $build_folder/LICENSE $build_folder/LICENSE.electron.packager
cp $CURRENT/../LICENSE.txt $build_folder/
done

if [ "$1" == "--archive" ]
then
for i in `ls |grep 'Karma-*'`
do
zip -r $i $i
done
fi
133 changes: 133 additions & 0 deletions karma-app/conf/catalina.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,\
org.apache.naming.resources.,org.apache.tomcat.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageDefinition unless the
# corresponding RuntimePermission ("defineClassInPackage."+package) has
# been granted.
#
# by default, no packages are restricted for definition, and none of
# the class loaders supplied with the JDK call checkPackageDefinition.
#
package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,\
org.apache.jasper.,org.apache.naming.,org.apache.tomcat.

#
#
# List of comma-separated paths defining the contents of the "common"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank,the JVM system loader will be used as Catalina's "common"
# loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

#
# List of comma-separated paths defining the contents of the "server"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank, the "common" loader will be used as Catalina's "server"
# loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
server.loader=

#
# List of comma-separated paths defining the contents of the "shared"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
# the "common" loader will be used as Catalina's "shared" loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
shared.loader=

# List of JAR files that should not be scanned using the JarScanner
# functionality. This is typically used to scan JARs for configuration
# information. JARs that do not contain such information may be excluded from
# the scan to speed up the scanning process. This is the default list. JARs on
# this list are excluded from all scans. Scan specific lists (to exclude JARs
# from individual scans) follow this. The list must be a comma separated list of
# JAR file names.
# The JARs listed below include:
# - Tomcat Bootstrap JARs
# - Tomcat API JARs
# - Catalina JARs
# - Jasper JARs
# - Tomcat JARs
# - Common non-Tomcat JARs
# - Test JARs (JUnit, Cobertura and dependencies)
tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar,\
jasper.jar,jasper-el.jar,ecj-*.jar,\
tomcat-api.jar,tomcat-util.jar,tomcat-coyote.jar,tomcat-dbcp.jar,\
tomcat-jni.jar,tomcat-spdy.jar,\
tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\
tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\
tomcat-jdbc.jar,\
tools.jar,\
commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,\
commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\
commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\
commons-math*.jar,commons-pool*.jar,\
jstl.jar,taglibs-standard-spec-*.jar,\
geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\
ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\
jmx-tools.jar,jta*.jar,log4j.jar,log4j-1*.jar,mail*.jar,slf4j*.jar,\
xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\
junit.jar,junit-*.jar,hamcrest*.jar,org.hamcrest*.jar,ant-launcher.jar,\
cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\
jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\
xom-*.jar

# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for Servlet 3.0 pluggability features. These features include web
# fragments, annotations, SCIs and classes that match @HandlesTypes. The list
# must be a comma separated list of JAR file names.
org.apache.catalina.startup.ContextConfig.jarsToSkip=

# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for TLDs. The list must be a comma separated list of JAR file names.
org.apache.catalina.startup.TldConfig.jarsToSkip=tomcat7-websocket.jar

#
# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
#tomcat.util.buf.StringCache.char.enabled=true
#tomcat.util.buf.StringCache.trainThreshold=500000
#tomcat.util.buf.StringCache.cacheSize=5000
35 changes: 35 additions & 0 deletions karma-app/conf/context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->

<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->

</Context>
16 changes: 16 additions & 0 deletions karma-app/desktop/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
22 changes: 22 additions & 0 deletions karma-app/desktop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
node_modules
.DS_Store
Thumbs.db
*.log
*.autogenerated

# ignore everything in 'app' folder what had been generated from 'src' folder
/app/stylesheets
/app/app.js
/app/background.js
/app/karma.js
/app/env.json
/app/**/*.map
/app/tomcat
/app/Karma-*

/dist
*.swp
*.swo
*~
!package.json
!config
9 changes: 9 additions & 0 deletions karma-app/desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Karma app
=========

```
npm install
npm start
npm run build
npm run release
```
Loading

0 comments on commit dd45c6f

Please sign in to comment.