Skip to content

Commit 9c2160e

Browse files
committed
More checks, new command to install example data.
`iris check` checks for required executables. Updated the README with more useful information.
1 parent a8ee368 commit 9c2160e

File tree

2 files changed

+107
-14
lines changed

2 files changed

+107
-14
lines changed

README.md

+52-6
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,73 @@ Iris
22
====
33
A web application for exploration of biological data
44

5-
DEPENDENCIES
6-
------------
5+
EXTERNAL DEPENDENCIES
6+
---------------------
7+
The following tools need to be installed separately (e.g., with [Homebrew](http://mxcl.github.com/homebrew/)) before Iris and its dependencies can be installed:
8+
79
* node (nodejs.org)
810
* git (git-scm.com)
911
* gcc
1012
* mongodb (mongodb.org)
1113

14+
OVERVIEW
15+
--------
16+
Iris is equipped with a command-line tool, quaintly named `iris`, to manage the project. It can be used to install dependencies, start Iris and it services, monitor Iris, and shut it down.
17+
18+
To use the tool, run:
19+
20+
source iris.env
21+
1222
INSTALLATION
1323
------------
14-
$ source iris.env
15-
$ iris install
24+
To install Iris, along with its dependencies, run:
25+
26+
iris install
27+
28+
To check the installation, and execute project tests, run:
29+
30+
iris check
31+
32+
To install example data used by the demo, run:
33+
34+
iris examples
1635

1736
CONFIGURATION
1837
-------------
1938
Iris services are configured in a simple configuration file in `conf/services.json` listing an HTTP port, the name of the service, the Node.js control file, and a configuration file. A sample services configuration is available at `conf/services-sample.json`. To get started:
2039

21-
$ cp conf/services-sample.json conf/services.json
40+
cp conf/services-sample.json conf/services.json
2241

2342
RUNNING IRIS
2443
------------
25-
$ iris start
44+
To start Iris, run:
45+
46+
iris start
47+
48+
All the services configured in `conf/services.json` are started. Their process IDs and network ports are listed.
49+
50+
To stop Iris, run:
51+
52+
iris stop
53+
54+
To restart Iris, run:
55+
56+
iris restart
57+
58+
To determine whether Iris and its services are running, run:
59+
60+
iris status
61+
62+
Each of the above management commands can be run on individual services by supplying the service name as an argument:
63+
64+
iris {start,stop,restart,status} <service-name>
65+
66+
MORE HELP
67+
---------
68+
The `iris` tool has a general and command-specific help facility. To find out more about it, run:
69+
70+
iris help [<command>]
71+
2672

2773
PROJECT STRUCTURE
2874
-----------------

scripts/iris

+55-8
Original file line numberDiff line numberDiff line change
@@ -410,33 +410,80 @@ function iris_cmd_restart {
410410
iris_cmd_start $@
411411
}
412412

413+
414+
# ---------------------------------------------------------------------------
415+
# IRIS EXAMPLES
416+
# ---------------------------------------------------------------------------
417+
_help_check="iris examples
418+
419+
Install example data."
420+
function iris_cmd_examples {
421+
local overwrite=$1
422+
EXAMPLEDIR=./examples
423+
cd $IRIS_HOME
424+
git submodule update --init -- $EXAMPLEDIR > /dev/null
425+
cd $EXAMPLEDIR
426+
if [ -z "$(which mongorestore 2> /dev/null)" ]; then
427+
tput bold; echo "Error!"; tput sgr0
428+
echo "Cannot find the command 'mongorestore', required for loading
429+
the example data"
430+
exit 1
431+
fi
432+
dbs=$(echo 'show dbs' | mongo --quiet | cut -f1 | grep -v '^bye$')
433+
for f in ./mongo/*; do
434+
db=$(basename $f)
435+
if [ "$(echo $dbs | grep -c "$db")" -eq 1 -a \
436+
"$overwrite" != "-f" ]; then
437+
echo "Database '$db' already exists. Use '-f' to overwrite."
438+
else
439+
echo "Loading database '$db'"
440+
mongorestore --drop $f
441+
fi
442+
done
443+
}
444+
413445
# ---------------------------------------------------------------------------
414446
# IRIS CHECK
415447
# ---------------------------------------------------------------------------
416448
_help_check="iris check
417449
418-
Checks to ensure the Iris installation is complete and ready to go"
450+
Checks to ensure the Iris installation is complete and ready to go."
419451
function iris_cmd_check {
420452
local errnum=0
421453
declare -a errors=()
422454
function add_error {
423455
errors[$errnum]="$1"
424456
errnum=$(($errnum+1))
425457
}
426-
# Required files
458+
459+
# Ensure required files exist
427460
for f in $SVC_CONF bin/fbsql bin/scatter bin/ranges lib/libfastbit.a; do
428461
if [ ! -e "$f" ]; then
429462
add_error "Required file '$f' is missing."
430463
fi
431464
done
432-
if [ -e "$SVC_CONF" ]; then
433-
if [ -n "$( (/usr/bin/python -mjson.tool < $SVC_CONF > /dev/null) 2>&1)" ]; then
434-
add_error "Service configuration '${SVC_CONF##$IRIS_HOME/}' is not valid JSON."
435-
fi
465+
466+
# Ensure services.json is valid JSON
467+
if [ -e "$SVC_CONF" -a \
468+
-n "$( (/usr/bin/python -mjson.tool < $SVC_CONF > /dev/null) 2>&1)" ]
469+
then
470+
add_error "Service configuration '${SVC_CONF##$IRIS_HOME/}' is
471+
not valid JSON."
436472
fi
473+
474+
# Ensure 'logs' is writable
437475
if [ -e "$LOGDIR" -a ! -w "$LOGDIR" ]; then
438-
add_error "Log directory '${LOGDIR##$IRIS_HOME/}' exists but is not writable."
476+
add_error "Log directory '${LOGDIR##$IRIS_HOME/}'
477+
exists but is not writable."
439478
fi
479+
480+
# Check for required executables
481+
for executable in node npm mongo; do
482+
if [ -z "$(which $executable 2> /dev/null)" ]; then
483+
add_error "Command '$executable' was not found in your path."
484+
fi
485+
done
486+
440487
if [ "$errnum" -gt 0 ]; then
441488
tput bold
442489
echo "Errors:"
@@ -446,7 +493,7 @@ function iris_cmd_check {
446493
done
447494
exit 0;
448495
else
449-
echo "No file errors. All systems go."
496+
echo "Files lookin' good."
450497
fi
451498

452499
# NODEUNIT

0 commit comments

Comments
 (0)