From 9fd36ed802b7e671c4beec11ee79636c01900c9c Mon Sep 17 00:00:00 2001 From: Carlos Juliano M Viana <cviana@tecgraf.puc-rio.br> Date: Wed, 25 Mar 2020 16:39:44 -0300 Subject: [PATCH] =?UTF-8?q?Adicionando=20se=C3=A7=C3=A3o=20com=20explica?= =?UTF-8?q?=C3=A7=C3=A3o=20para=20executar=20m=C3=BAtiplos=20SGAs=20a=20pa?= =?UTF-8?q?rtir=20de=20um=20mesmo=20diret=C3=B3rio=20de=20instala=C3=A7?= =?UTF-8?q?=C3=A3o,=20compartilhando=20mesmos=20arquivos=20sgad.sh=20e=20s?= =?UTF-8?q?gad.cfg.=20=20-=20=20Proposta=20da=20solu=C3=A7=C3=A3o=20aprese?= =?UTF-8?q?ntada=20para=20o=20grupo=20do=20BRSiOP.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [SOMA-4111] [SOMA-4102] [SOMA-2554] --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/README.md b/README.md index 6a901c4..a0f2a19 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: -- GitLab