Skip to content

Commit

Permalink
Merge pull request #120 from common-workflow-language/cwltool
Browse files Browse the repository at this point in the history
Cwltool parsing and API
  • Loading branch information
stain authored Aug 11, 2017
2 parents e58485d + d1cf192 commit bce46b1
Show file tree
Hide file tree
Showing 207 changed files with 32,457 additions and 2,257 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ services: mongodb

before_install:
- sudo apt-get -qq update
- sudo apt-get install graphviz
- sudo apt-get install graphviz python-pip
- sudo pip install cwltool

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/abea7d67d180d37286b3
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always

on_start: never # options: [always|never|change] default: always
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.3-jdk-8-alpine
FROM maven:3.5-jdk-8-alpine
MAINTAINER Stian Soiland-Reyes <[email protected]>

# Build-time metadata as defined at http://label-schema.org
Expand All @@ -16,7 +16,14 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.schema-version="1.0"


RUN apk add --update graphviz ttf-freefont && rm -rf /var/cache/apk/*
RUN apk add --update graphviz ttf-freefont py2-pip gcc python2-dev libc-dev && rm -rf /var/cache/apk/*


#wheel needed by ruamel.yaml for some reason
RUN pip install wheel
RUN pip install cwltool html5lib ruamel.yaml==0.12.4

RUN cwltool --version

RUN mkdir /usr/share/maven/ref/repository

Expand All @@ -38,7 +45,4 @@ WORKDIR /tmp

EXPOSE 8080

# Expects mongodb on port 27017
ENV SPRING_DATA_MONGODB_HOST=mongo
ENV SPRING_DATA_MONGODB_PORT=27017
CMD ["/usr/bin/java", "-jar", "/usr/lib/cwlviewer.jar"]
21 changes: 0 additions & 21 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,3 @@
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.

---------------------------------------------------------

./src/main/resources/static/img/GitHub-Mark-32px.png

GITHUB®, the GITHUB® logo design, OCTOCAT® and the OCTOCAT® logo design
are exclusive trademarks registered in the United States by GitHub, Inc.

The OCTOCAT design is the exclusive property of GitHub, Inc and has
been federally registered with the United States Copyright Office.
All rights reserved.

Use rules apply: https://github.com/logos

---------------------------------------------------------

./src/main/resources/static/img/Docker-logo.png

Copyright 2013-2015 Docker, Inc. All rights reserved.

Use rules apply: https://www.docker.com/brand-guidelines
16 changes: 15 additions & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ For more information regarding the authorized uses of these items please [contac

-----------

# Git logo
img/gitlogo.png
Git Logo by Jason Long is licensed under the [Creative Commons Attribution 3.0 Unported License](https://creativecommons.org/licenses/by/3.0/)

-----------

# European Union flag
img/Flag_of_Europe.svg
Public Domain
Expand Down Expand Up @@ -170,4 +176,12 @@ https://github.com/ariutta/svg-pan-zoom

[BSD 2-clause license](src/main/resources/static/bower_components/svg-pan-zoom/LICENSE)

-----------
----------

# highlight.js
bower_components/highlightjs
https://highlightjs.org/

[BSD 3-clause license](src/main/resources/static/bower_components/highlightjs/LICENSE)


83 changes: 33 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ provide a [pull request](https://github.com/common-workflow-language/cwlviewer/p
or join the [gitter chat for common-workflow-language](https://gitter.im/common-workflow-language/common-workflow-language)!


## Running with Docker
## Recommended - Running with Docker

This application can be started with [Docker](https://www.docker.com/).

If you have [Docker Compose](https://docs.docker.com/compose/install/), then to start
MongoDB and CWLViewer exposed on port `8080`, run:
If you have [Docker Compose](https://docs.docker.com/compose/install/), then to start CWLViewer exposed on port `8080`, run:

docker-compose up

Expand All @@ -42,7 +41,6 @@ services:
build: .
```
See the [docker-compose.yml](docker-compose.yml) file for details.
If you don't want to use Docker Compose, you can do the equivalent manually with `docker`
Expand All @@ -51,67 +49,33 @@ and the [commonworkflowlanguage/cwlviewer](https://hub.docker.com/r/commonworkfl
docker run --name cwlviewer-mongo -p 27017:27017 -d mongo
docker run --name cwlviewer -p 8080:8080 --link cwlviewer-mongo:mongo -d commonworkflowlanguage/cwlviewer
docker logs -f cwlviewer


**WARNING**: Please ensure that your MongoDB installation is not exposed to the world on port `27017`

If you have modified the source code, then you may want to build the docker image locally first:

docker build -t commonworkflowlanguage/cwlviewer .

## Running without Docker

### Requirements

## Requirement: MongoDB
#### MongoDB

You will need to have [MongoDB](https://www.mongodb.com/) running,
by default on `localhost:27017`.
by default on `localhost:27017`

If you are running from the command line, you can override this by supplying
system properties like `-Dspring.data.mongodb.host=mongo.example.org` and
`-Dspring.data.mongodb.port=1337`

If you have Docker, but are not using the Docker Compose method above,
you may start MongoDB with [Docker](https://www.docker.com/) using:

docker run --name cwlviewer-mongo -p 27017:27017 -d mongo

**WARNING**: The above expose mongodb to the world on port `27017`.

## Configuration

There are a variety of configuration options detailed in the [application configuration file](https://github.com/common-workflow-language/cwlviewer/blob/master/src/main/resources/application.properties) which can be adjusted.

When deploying with docker, these can be overriden externally by creating/modifying `docker-compose.override.yml` as follows:

```yaml
version: '2'
services:
spring:
environment:
githubAPI.authentication: oauth
githubAPI.oauthToken: abcdefghhijklmnopqrstuvwxyz
```

The properties can alternatively be provided as system properties on the
command line, e.g. `-DgithubAPI.authentication=oauth`
`-DgithubAPI.oauthToken=abcdefghhijklmnopqrstuvwxyz` or via a [variety of other methods supported by Spring Boot](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html)

### Github API

If you run cwlviewer in production, you are likely to hit the GitHub API's rate limit of 60 requests/hr. This can be increased to 5000 requests/hr by using authentication (either basic or OAuth) by setting the `githubAPI.authentication` and either `githubAPI.oauthToken` or both `githubAPI.username` and `githubAPI.password` in the [application configuration file](https://github.com/common-workflow-language/cwlviewer/blob/master/src/main/resources/application.properties) depending on the method.
#### Apache Jena Fuseki (or alternative SPARQL server)

OAuth tokens can be obtained using the [Github authorizations API](https://developer.github.com/v3/oauth_authorizations/).
You will also need to have a SPARQL server such as [Apache Jena Fuseki](https://jena.apache.org/documentation/fuseki2/) running,
by default on `localhost:3030`

## Private Repositories

If you wish to use cwlviewer to view private Github repositories, set

```
githubAPI.useForDownloads = true
singleFileSizeLimit = 1048575
```
Along with an authentication method which has the privileges necessary to access the repository (see above).
**WARNING**: This uses the [Github Contents API](https://developer.github.com/v3/repos/contents/) to download files instead of [Rawgit](https://rawgit.com/) which will increase API calls significantly.
## Building and Running
## Compiling and Running

To compile you will need [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or OpenJDK 8 (`apt install openjdk-8-jdk`),
as well as [Apache Maven 3](https://maven.apache.org/download.cgi) (`apt install maven`).
Expand Down Expand Up @@ -145,6 +109,25 @@ org.researchobject.CwlViewerApplication : Started CwlViewerApplication in 28.60

Now check out http://localhost:8080/ to access CWL Viewer.

## Configuration

There are a variety of configuration options detailed in the [application configuration file](https://github.com/common-workflow-language/cwlviewer/blob/master/src/main/resources/application.properties) which can be adjusted.

When deploying with docker, these can be overriden externally by creating/modifying `docker-compose.override.yml` as follows:

```yaml
version: '2'
services:
spring:
environment:
githubAPI.authentication: oauth
githubAPI.oauthToken: abcdefghhijklmnopqrstuvwxyz
```

The properties can alternatively be provided as system properties on the
command line, e.g. `-DgithubAPI.authentication=oauth`
`-DgithubAPI.oauthToken=abcdefghhijklmnopqrstuvwxyz` or via a [variety of other methods supported by Spring Boot](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html)

# Thanks

Developers and [contributors](https://github.com/common-workflow-language/cwlviewer/graphs/contributors) include:
Expand Down
22 changes: 17 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
version: '2'
services:
spring:
image: commonworkflowlanguage/cwlviewer
# To run from this source code instead of Docker hub,
# disable "image:"" and enable "build:" below
image: commonworkflowlanguage/cwlviewer
#build: .
ports:
- "8080:8080"
# TODO:
# volumes:
# - .:/code
links:
- mongo

- sparql
environment:
- SPARQL_ENDPOINT=http://sparql:3030/cwlviewer/
- SPRING_DATA_MONGODB_HOST=mongo
- SPRING_DATA_MONGODB_PORT=27017
mongo:
image: mongo
sparql:
## For debugging, expose the Fuseki port by enabling:
# ports:
# - "3030:3030"
## To find the admin password, try:
## docker-compose exec sparql grep admin /fuseki/shiro.ini
image: stain/jena-fuseki
# FIXME: --loc=/fuseki/databases/cwlviewer fails as it needs empty dir
command: "/jena-fuseki/fuseki-server --loc=/fuseki/databases /cwlviewer"
26 changes: 18 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.commonwl.view</groupId>
<artifactId>cwlviewer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>CWLViewer</name>
Expand Down Expand Up @@ -62,11 +62,6 @@
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.mylyn.github</groupId>
<artifactId>org.eclipse.egit.github.core</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand All @@ -88,9 +83,24 @@
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.0.pr4</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-osgi</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>4.8.0.201706111038-r</version>
</dependency>
</dependencies>

<build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/org/commonwl/view/PageController.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,24 @@ public String homePage(Model model, @RequestParam(value = "url", required = fals
return "index";
}

/**
* About page
* @param model The model for the about page
* @return The view for this page
*/
@GetMapping("/about")
public String about(Model model) {
return "about";
}

/**
* API documentation page
* @param model The model for the API documentation page
* @return The view for this page
*/
@GetMapping("/apidocs")
public String apiDocumentation(Model model) {
return "apidocs";
}

}
22 changes: 21 additions & 1 deletion src/main/java/org/commonwl/view/cwl/CWLElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,26 @@

package org.commonwl.view.cwl;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.ArrayList;
import java.util.List;

/**
* Represents the input/output of a workflow/tool
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class CWLElement {

private String label;
private String doc;
private String type;
private String format;
private List<String> sourceID;
private String defaultVal;

public CWLElement() {
this.sourceID = new ArrayList<String>();
this.sourceID = new ArrayList<>();
}

public String getLabel() {
Expand All @@ -61,6 +65,22 @@ public void setType(String type) {
this.type = type;
}

public String getFormat() {
return format;
}

public void setFormat(String format) {
this.format = format;
}

public List<String> getSourceID() {
return sourceID;
}

public void setSourceID(List<String> sourceID) {
this.sourceID = sourceID;
}

public List<String> getSourceIDs() {
return sourceID;
}
Expand Down
Loading

0 comments on commit bce46b1

Please sign in to comment.