thehyve/webapp

Name: webapp

Owner: The Hyve

Description: open targets platform angular.js front end

Forked from: opentargets/webapp

Created: 2018-03-06 11:47:13.0

Updated: 2018-03-06 11:47:16.0

Pushed: 2018-02-23 15:58:08.0

Homepage: https://www.targetvalidation.org

Size: 20142

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Docker container: Docker Repository on Quay

CircleCI build: CircleCI

OpenTargets Web App

This is the web app for the Open Targets Platform, based on the Open Targets REST API. The app is based on Angular, while D3 is used for visualization and graphs.

Usage (run your own copy of the webapp)

Depending on how you deploy, you might want to do two things:

for example to change evidence_sources displayed

NB: In general, you shouldn't use custom.json to override the {"api":} variable of the app, otherwise the deploy steps described below will fail.

Deploy on netlify
  1. Fork the webapp (unless you are a member of the Open Targets team who deploys to production :smile: )
  2. (optional) add a custom.json to /app/config/**/ to change your fork's configuration. When deploying with netlify, the custom.json cannot be changed without first commiting it to the code.
  3. Set up netlify/github integration, including specifying the build steps (yarn run full-setup) and the directory served (app).
  4. Change the netlify.toml to point to your API. The app will point to the API specified with APIHOST in the netlify.toml file.
Deploy using our docker container

A docker container with a compiled version of the webapp from a NGINX web server is available on quay.io Docker Repository on Quay

To run the app locally using the container:

er run -d -p 8443:443 -p 8080:80 quay.io/opentargets/webapp

Then visit https://localhost:8443

The standard container comes with self-signed certificates, so you will have click through a couple of security warnings to get to the app.

If you want to point to the docker container to an API different than the production one:

You can specify the variables:

The default value is used for each variable if it's not specified.

er run -d -p 8443:443 -p 8080:80 -e "REST_API_SCHEME=https" -e "REST_API_SERVER=devapi.appspot.com" -e "REST_API_PORT=443" quay.io/opentargets/webapp

Any other modifications, including changing the custom.json for the container, cannot be made at runtime. You'd have to create your own fork/modifications. Read on to the developing section.

Developing (change and contribute to the code)
Prerequisites

Installation and tests need some node.js tools: you must have node.js and its package manager npm installed. You can get them from http://nodejs.org/

Installing gulp globally also helps

install -g gulp
Install

Clone the repository and install the dependencies. Tools are installed via NPM (and yarn)

clone https://github.com/opentargets/webapp.git
ebapp
full-install
r use yarn directly
 run full-install

This installs the required node modules and calls jspm install which takes care of all Angular dependencies and 3rd party widgets. So these commands create three directories:

Angular code is installed via Bower includes:

Build

After you make your changes you will want to build and run the application:

  1. set the APIHOST env variable to point to a fully functional rest_api. Notice that APIHOST can be of the form "https://somesite.com:1234/api/" (recommended) or a simple prefix /api/ if you are taking care of reverse-proxying the API there (for eg if you are serving the app locally in nginx)
  2. (optional) add a custom.json with your configurations to override the ones contained in default.json
  3. run yarn run setup or gulp build-all
  4. all the code you need for deployment will be contained in /app.
  5. to point to a different API (or update your custom.json) and not have to rebuild the whole app, you can change the APIHOST env var (or custom.json) and then run only gulp build-config
Running the app

Any webserver that can serve the /app directory will do.

NOTE to have a fully functional app, you also need to have your web server to reverse proxy /proxy to https://proxy.opentargets.io. In nginx this is achieved with the following change to nginx.conf:

tion /proxy/ {
        proxy_pass https://proxy.opentargets.io/;
    }
Use a local server

TODO

Use our nginx container

You can run a nginx webserver using docker and mount the app folder as a volume. We have a container that is derived from nginx:alpine which you can use

er run -d --name webapp -p 7899:80 -p 7443:443 -v $PWD/webapp/app:/var/www/app quay.io/opentargets/webapp

Notice that any change to the code will require you to rebuild the content of the app and possibly restart the nginx container.

NB if you do this with the standard nginx container you have to take care to redirect /proxy to https://proxy.opentargets.io

You can also build your own container, if you want to change the nginx configuration. NB before building the container you should have built the app at least once,for eg. with gulp build-all

er build -t mywebapp .

it for the build to finish

er run -d -p 7899:80 -p 7443:443 mywebapp
 if you want to keep changing the code, mount the volume:
er run -d -p 7899:80 -p 7443:443 -v $PWD/webapp/app:/var/www/app mywebapp
Branch containers

If you push some changes to the branch, a container with the tag of the branch will be publicly available after a few minutes on quay.io

er pull quay.io/opentargets/webapp:<yourbranchname>
Further documentation
Plugins

Read about how to create platform plugins here.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.