Skip to content

Commit

Permalink
Merge db347d4 into 6963ce0
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaknarfen authored Oct 27, 2018
2 parents 6963ce0 + db347d4 commit 19a23c1
Show file tree
Hide file tree
Showing 242 changed files with 11,538 additions and 4,452 deletions.
30 changes: 23 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ cache:
addons:
chrome: stable

node_js:
- "6"
- "7"
- "8"

matrix:
fast_finish: true

Expand All @@ -25,6 +20,27 @@ before_install:

install:
- npm install
- sudo apt-get install -y build-essential libssl-dev python-pip python2.7-dev
- sudo pip install -U setuptools wheel docker-cloud synapseclient[pandas,pysftp]
- docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD"

stages:
- name: deploy-containers
- name: test

script:
- npm run ci:travis
jobs:
include:
- stage: deploy-containers
script:
- ./get-data-aws.sh || travis_terminate 1
- ./container-build.sh || travis_terminate 1
- ./container-deploy.sh || travis_terminate 1
- stage: test
script: npm run ci:travis
node_js: 6
- stage: test
script: npm run ci:travis
node_js: 7
- stage: test
script: npm run ci:travis
node_js: 8
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Launch Chrome against localhost, with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000/*",
"url": "http://localhost:8080/*",
"runtimeArgs": [
"--disable-web-security",
"--user-data-dir",
Expand All @@ -18,7 +18,7 @@
"name": "Attach to Chrome, with sourcemaps",
"type": "chrome",
"request": "attach",
"url": "http://localhost:3000/*",
"url": "http://localhost:8080/*",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:latest
FROM node:8.11.4

# See https://crbug.com/795759
RUN apt-get update && apt-get install -yq libgconf-2-4
Expand Down Expand Up @@ -29,8 +29,8 @@ COPY . .

RUN npm run webdriver:update

## The ci:travis script already runs the AoT build, so these two lines build the client and server
RUN npm run ci:travis
## These two lines build the client and server
RUN npm run build:aot
RUN npm run build:server:docker

COPY ./start-server.sh /ng-app/start-server.sh
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Coverage Status](https://coveralls.io/repos/github/Sage-Bionetworks/Agora/badge.svg?branch=master)](https://coveralls.io/github/Sage-Bionetworks/Agora?branch=master)
[![Build Status](https://travis-ci.com/Sage-Bionetworks/Agora.svg?branch=master)](https://travis-ci.com/Sage-Bionetworks/Agora)
[![Build Status](https://travis-ci.org/Sage-Bionetworks/Agora.svg?branch=master)](https://travis-ci.org/Sage-Bionetworks/Agora)
[![GitHub version](https://badge.fury.io/gh/Sage-Bionetworks%2FAgora.svg)](https://badge.fury.io/gh/Sage-Bionetworks%2FAgora)

# Agora BETA
Expand Down Expand Up @@ -126,7 +126,7 @@ There are two ways to use this application in a remote production environment. O

If you are copying the dist folder, install Node in the remote machine. Then, install MongoDB and populate the needed collections (follow the steps described above). Start the application by running `node` against the `server.js` file.

If you are copying the entire project, install Node and any needed global dependencies in the remote machine. Then, run `npm install` to get all local dependencies installed and just follow the same steps for the local development (see below). You'll need to expose port `3000` so anyone can access the application.
If you are copying the entire project, install Node and any needed global dependencies in the remote machine. Then, run `npm install` to get all local dependencies installed and just follow the same steps for the local development (see below). You'll need to expose port `8080` so anyone can access the application.

In both cases the final URL will be the remote machine public ip.

Expand Down Expand Up @@ -170,7 +170,7 @@ npm start
npm run start:prod
```

go to [http://0.0.0.0:3000](http://0.0.0.0:3000) or [http://localhost:3000](http://localhost:3000) in your browser. If you are running in production mode change from `3000` to `8080`.
go to [http://0.0.0.0:8080](http://0.0.0.0:8080) in your browser.

## Other commands

Expand Down Expand Up @@ -302,7 +302,7 @@ We have good experience using these editors:
### Visual Studio Code + Debugger for Chrome
> Install [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) and see docs for instructions to launch Chrome
The included `.vscode` automatically connects to the webpack development server on port `3000`.
The included `.vscode` automatically connects to the webpack development server on port `8080`.
# Types
> When you include a module that doesn't include Type Definitions inside of the module you can include external Type Definitions with @types
Expand Down
9 changes: 6 additions & 3 deletions config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# the number of hard disk drives that store data, and load pattern. When one is in doubt,
# setting it to the number of available CPU cores would be a good start (the value “auto” will try to autodetect it).
worker_processes auto;
# maximum number of open files (RLIMIT_NOFILE) for worker processes. default is 1024
# set to (worker_connections * worker_processes).
worker_rlimit_nofile 65535;

# Keep logs of events http://nginx.org/en/docs/ngx_core_module.html#error_log
error_log /var/log/nginx-error.log info;
Expand All @@ -13,7 +16,7 @@ events {
# To check your server's limits limits, run these 2 commands ["ulimit -Hn", "ulimit -Sn"]
# Max # of clients = worker_connections * worker_processes
# Total # of users you can serve per second = worker_processes * worker_connections / (keepalive_timeout * 2)
worker_connections 20000;
worker_connections 8096;

# Use epoll, an I/O processing method that can enhance performance an is commonly used within Linux
# http://nginx.org/en/docs/events.html
Expand All @@ -33,7 +36,7 @@ http {
ip_hash;

# Our 4 replicated servers
server agora:5000 max_fails=2 fail_timeout=3s;
server agora:8080 max_fails=2 fail_timeout=3s;
}

# The processing rate of requests coming from a single IP address
Expand Down Expand Up @@ -149,4 +152,4 @@ http {
proxy_read_timeout 600;
}
}
}
}
2 changes: 1 addition & 1 deletion config/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require('ts-node/register');
var helpers = require('./helpers');

exports.config = {
baseUrl: 'http://localhost:3000/',
baseUrl: 'http://localhost:8080/',

/**
* Use `npm run e2e`
Expand Down
12 changes: 10 additions & 2 deletions config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const helpers = require('./helpers');
*
* problem with copy-webpack-plugin
*/
const webpack = require('webpack');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlElementsPlugin = require('./html-elements-plugin');
Expand All @@ -19,6 +20,7 @@ const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const StyleLintPlugin = require('stylelint-webpack-plugin');
const rxPaths = require('rxjs/_esm2015/path-mapping');

const buildUtils = require('./build-utils');

Expand Down Expand Up @@ -54,10 +56,14 @@ module.exports = function (options) {
*
* https://github.com/webpack-contrib/webpack-bundle-analyzer
*/
const baPlugin = (METADATA.Analyzer === true) ? [new BundleAnalyzerPlugin({
const baPlugin = (METADATA.Analyzer === 'true') ? [new BundleAnalyzerPlugin({
openAnalyzer: false
})] : [];

/*const baPlugin = [new BundleAnalyzerPlugin({
openAnalyzer: false
})];*/

return {
/**
* The entry point for the bundle
Expand Down Expand Up @@ -106,7 +112,7 @@ module.exports = function (options) {
*
* BE AWARE that not using lettable operators will probably result in significant payload added to your bundle.
*/
alias: buildUtils.rxjsAlias(supportES2015)
alias: rxPaths()
},

/**
Expand Down Expand Up @@ -201,6 +207,8 @@ module.exports = function (options) {
'process.env.Docker': JSON.stringify(METADATA.Docker)
}),

new webpack.optimize.ModuleConcatenationPlugin(),

/**
* Plugin: CopyWebpackPlugin
* Description: Copy files and directories in webpack.
Expand Down
2 changes: 1 addition & 1 deletion config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
module.exports = function (options) {
const ENV = (process.env.mode = process.env.ENV = process.env.NODE_ENV = 'development');
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3000;
const PORT = process.env.PORT || 8080;
const Docker = process.env.Docker || false;
const Analyzer = process.env.Analyzer || false;

Expand Down
15 changes: 12 additions & 3 deletions config/webpack.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ const NodemonPlugin = require( 'nodemon-webpack-plugin' );

const ENV = (process.env.mode || process.env.NODE_ENV || process.env.ENV || 'development');
const Docker = process.env.Docker || false;
const HOST = process.env.HOST || 'localhost';

const MONGODB_HOST = process.env.MONGODB_HOST || null;
const MONGODB_PORT = process.env.MONGODB_PORT || null;

const METADATA = Object.assign({}, buildUtils.DEFAULT_METADATA, {
host: process.env.HOST || 'localhost',
port: process.env.PORT || 3000,
port: process.env.PORT || 8080,
ENV: ENV,
Docker: Docker
Docker: Docker,
MONGODB_HOST: MONGODB_HOST,
MONGODB_PORT: MONGODB_PORT
});

module.exports = {
Expand Down Expand Up @@ -70,7 +77,9 @@ module.exports = {
'process.env.NODE_ENV': JSON.stringify(METADATA.ENV),
'process.env.HOST': JSON.stringify(METADATA.host),
'process.env.PORT': JSON.stringify(METADATA.port),
'process.env.Docker': JSON.stringify(METADATA.Docker)
'process.env.Docker': JSON.stringify(METADATA.Docker),
'process.env.MONGODB_HOST': JSON.stringify(METADATA.MONGODB_HOST),
'process.env.MONGODB_PORT': JSON.stringify(METADATA.MONGODB_PORT)
})
],
target: 'node',
Expand Down
22 changes: 22 additions & 0 deletions container-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -ex

CURRENT_DIR=$(pwd)
PARENT_DIR=$(dirname "$CURRENT_DIR")
DATA_DIR=$PARENT_DIR/data

# build docker images
docker build -t sagebionetworks/agora-app:latest -f ./Dockerfile $CURRENT_DIR
docker build -t sagebionetworks/agora-nginx:latest -f ./nginx.Dockerfile $CURRENT_DIR

# move docker files to DATA_DIR, otherwise docker builds will fail on travis
cp -rp $CURRENT_DIR/mongo-seed $DATA_DIR/.

pushd $DATA_DIR
docker build -t sagebionetworks/agora-mongo_data:latest -f ./mongo-seed/rnaseq_differential_expression.Dockerfile $DATA_DIR
docker build -t sagebionetworks/agora-mongo_seed_links:latest -f ./mongo-seed/network.Dockerfile $DATA_DIR
docker build -t sagebionetworks/agora-mongo_seed_info:latest -f ./mongo-seed/gene_info.Dockerfile $DATA_DIR
docker build -t sagebionetworks/agora-mongo_seed_team:latest -f ./mongo-seed/team_info.Dockerfile $DATA_DIR
docker build -t sagebionetworks/agora-mongo_seed_team_images:latest -f ./mongo-seed/team_images.Dockerfile $DATA_DIR
popd

12 changes: 12 additions & 0 deletions container-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -ex

# push images to dockerhub
docker push sagebionetworks/agora-app:latest
docker push sagebionetworks/agora-nginx:latest
docker push sagebionetworks/agora-mongo_data:latest
docker push sagebionetworks/agora-mongo_seed_links:latest
docker push sagebionetworks/agora-mongo_seed_info:latest
docker push sagebionetworks/agora-mongo_seed_team:latest
docker push sagebionetworks/agora-mongo_seed_team_images:latest

13 changes: 4 additions & 9 deletions docker-compose-app.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
version: '2'
services:
agora:
build:
context: .
dockerfile: Dockerfile
image: 'sagebionetworks/agora-app'
environment:
- MONGO_URI=mongodb://mongodb/agora
restart: always
expose:
- '5000'
- '8080'
networks:
- front-tier
# NGINX will reverse proxy the express application
nginx:
build:
# Look for the Dockerfile inside the "nginx" folder
context: .
dockerfile: nginx.Dockerfile
image: 'sagebionetworks/agora-nginx'
restart: always
ports:
- '80:80'
Expand All @@ -29,4 +24,4 @@ services:
networks:
front-tier:
external:
name: agora_network
name: agora_network
34 changes: 9 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,25 @@ services:
mongodb:
container_name: mongodb
image: 'amd64/mongo'
entrypoint:
- mongod
- --bind_ip_all
ports:
- 27017:27017
networks:
- front_agora
mongod:
container_name: mongod
build:
context: ./mongo-seed
dockerfile: ./mongod.Dockerfile
links:
- mongodb
networks:
- front_agora
mongo_data:
container_name: mongo_data
build:
context: ../data
dockerfile: ../Agora/mongo-seed/rnaseq_differential_expression.Dockerfile
image: 'sagebionetworks/agora-mongo_data'
links:
- mongodb
depends_on:
- mongod
- mongodb
networks:
- front_agora
mongo_seed_links:
container_name: mongo_seed_links
build:
context: ../data
dockerfile: ../Agora/mongo-seed/network.Dockerfile
image: 'sagebionetworks/agora-mongo_seed_links'
links:
- mongodb
depends_on:
Expand All @@ -40,9 +30,7 @@ services:
- front_agora
mongo_seed_info:
container_name: mongo_seed_info
build:
context: ../data
dockerfile: ../Agora/mongo-seed/gene_info.Dockerfile
image: 'sagebionetworks/agora-mongo_seed_info'
links:
- mongodb
depends_on:
Expand All @@ -51,9 +39,7 @@ services:
- front_agora
mongo_seed_team:
container_name: mongo_seed_team
build:
context: ../data
dockerfile: ../Agora/mongo-seed/team_info.Dockerfile
image: 'sagebionetworks/agora-mongo_seed_team'
links:
- mongodb
depends_on:
Expand All @@ -62,9 +48,7 @@ services:
- front_agora
mongo_seed_team_images:
container_name: mongo_seed_team_images
build:
context: ../data
dockerfile: ../Agora/mongo-seed/team_images.Dockerfile
image: 'sagebionetworks/agora-mongo_seed_team_images'
links:
- mongodb
depends_on:
Expand Down
Loading

0 comments on commit 19a23c1

Please sign in to comment.