Make runnodes open up a separate tab for each node on MacOS X and a separate xterm on Linux. Update the docs a bit.

This commit is contained in:
Mike Hearn 2016-11-08 14:49:18 +01:00
parent a9fc6f5495
commit b56548a427
2 changed files with 41 additions and 20 deletions

View File

@ -29,17 +29,21 @@ construction, where message handlers should be registered and threads started.
Starting Nodes
--------------
To use an app you must also have a node server. To create a node server run the gradle installTemplateNodes task.
To use an app you must also have a node server. To create a node server run the ``gradle deployNodes`` task.
This will output the node JAR to ``build/libs/corda.jar`` and several sample/standard
node setups to ``build/nodes``. For now you can use the ``build/nodes/nodea`` configuration as a template.
Each node server by default must have a ``node.conf`` file in the current working directory. After first
execution of the node server there will be many other configuration and persistence files created in a node workspace directory. This is specified as the basedir property of the node.conf file, or else can be overidden using ``--base-directory=<workspace>``.
execution of the node server there will be many other configuration and persistence files created in a node
workspace directory. This is specified as the basedir property of the node.conf file, or else can be overidden
using ``--base-directory=<workspace>``.
.. note:: Outside of development environments do not store your node directories in the build folder.
.. warning:: Also note that the bootstrapping process of the ``corda.jar`` unpacks the Corda dependencies into a temporary folder. It is therefore suggested that the CAPSULE_CACHE_DIR environment variable be set before starting the process to control this location.
.. warning:: Also note that the bootstrapping process of the ``corda.jar`` unpacks the Corda dependencies into a
temporary folder. It is therefore suggested that the CAPSULE_CACHE_DIR environment variable be set before
starting the process to control this location.
Installing Apps
---------------
@ -240,7 +244,8 @@ You can create more configurations with new tasks that extend Cordform.
New nodes can be added by simply adding another node block and giving it a different name, directory and ports. When you
run this task it will install the nodes to the directory specified and a script will be generated (for UNIX users only
at present) to run the nodes with one command.
at present) to run the nodes with one command (``runnodes``). On MacOS X this script will run each node in a new
terminal tab, and on Linux it will open up a new XTerm for each node.
Other cordapps can also be specified if they are already specified as classpath or compile dependencies in your
``build.gradle``.

View File

@ -1,22 +1,38 @@
#!/usr/bin/env bash
# Will attempt to execute a corda node within all subdirectories in the current working directory.
# TODO: Use screens or separate windows when starting instances.
set -euo pipefail
trap 'kill $(jobs -p)' EXIT
export CAPSULE_CACHE_DIR=cache
function runNode {
pushd $1
( java -jar JAR_NAME )&
popd
}
for dir in `ls`; do
if [ -d $dir ]; then
runNode $dir
fi
done
read -p 'Any key to exit'
kill $(jobs -p)
if which osascript >/dev/null; then
# MacOS X: open each node in a in new tab.
first=true
script='tell app "Terminal"
activate'
rootdir=`pwd`
for dir in `ls`; do
if [ -d $dir ]; then
script="$script
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
do script \"cd $rootdir/$dir; java -jar JAR_NAME; exit\" in window 1"
first=false
fi
done
script="$script
end tell"
echo "$script"
osascript -e "$script"
else
# Some other UNIX, probably Linux
#
# This next line is safe even if JAVA_HOME is unset. If it is set, it means that java overrides the
# default system java, which is what we want.
export PATH=$JAVA_HOME/bin:$PATH
for dir in `ls`; do
if [ -d $dir ]; then
pushd $dir >/dev/null
xterm -T "`basename $dir`" -e 'java -jar JAR_NAME' &
popd >/dev/null
fi
done
fi