diff --git a/README.md b/README.md index 6a901c4b374f71b2d7d1ca360d967a808750ec03..a0f2a194b394b19e07c4ffa4ff39f90058fe332b 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,67 @@ host sandbox. The SSH data transfer configuration can be enable with posix drive Add **csgrid_id_rsa** private key in /home/csgrid/.ssh CSGrid server directory and fill **csgrid_id_rsa.pub** file content in SGA csgrid home directory _.ssh/authorized_keys_ file. +## Multiple SGAs with same instalation directory + +Multiple SGAs can be run from the same installation directory. In this case, we +have a installation directory shared among all SGA machines via NFS. +All SGAs machines share the same script sgad.sh and configuration file sgad.cfg. +To run multiple SGAs in this environment, the following changes can be done: + +sgad.sh +```bash +#!/bin/bash +export CSBASE_SERVER="http://localhost:40409" +export SGAD_HOST=$HOSTNAME +export SGAD_PORT=40100 +export SGAD_NAME=$HOSTNAME +export SGAD_PLATFORM="Linux44_64" +export SERVER_DATA_DIR="/mnt/csgrid_data" + +timestamp=$(date +%Y%m%d%H%M%S) +logsdir="logs" + +[[ ! -e $logsdir ]] && echo "mkdir $logsdir" && mkdir $logsdir + +logfile="logs/${HOSTNAME}_sgad_${timestamp}.log" + +configfile=${1} +if [ -z ${configfile} ]; then + echo "Using default file configuration" > ${logfile}; + configfile=sgad.cfg +fi +hostruntimedir="/tmp/${SGAD_NAME}" +sgadruntimedir="${hostruntimedir}/sgad" +runtimesandboxdir="${sgadruntimedir}/sandbox" + +[[ ! -e $hostruntimedir ]] && echo "mkdir $hostruntimedir..." && mkdir $hostruntimedir +[[ ! -e $sgadruntimedir ]] && echo "mkdir $sgadruntimedir..." && mkdir $sgadruntimedir +[[ ! -e $runtimesandboxdir ]] && echo "mkdir $runtimesandboxdir..." && mkdir $runtimesandboxdir + +eval $(luarocks path --bin) +sgad ${configfile} 2>&1 | tee -a "${logfile}" +``` + +sgad.cfg +```lua +csbase_server = os.getenv("CSBASE_SERVER") +platform = os.getenv("SGAD_PLATFORM") or "Linux44_64" +sgad_host = os.getenv("SGAD_HOST") +sgad_port = tonumber(os.getenv("SGAD_PORT")) +sga_name = os.getenv("SGAD_NAME") +status_interval_s = 10 +exec_polling_interval_s = 5 +register_retry_s = 3 +project_root_dir = os.getenv("SERVER_DATA_DIR") .. "/projects" +algorithm_root_dir = os.getenv("SERVER_DATA_DIR") .. "/algorithms" +runtime_data_dir = "/tmp/" .. os.getenv("SGAD_NAME") .. "/sgad" +sandbox_root_dir = "/tmp/" .. os.getenv("SGAD_NAME") .. "/sgad/sandbox" +driver = "sga.driver.posix" +resources = { + "docker" +} +``` + ## Install Requirements: