You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.5 KiB

4 years ago
wdir=$PWD
wdir_connect="$wdir/src-local/hybrid/connect"
toolsok='ok'
# create wdir connect dir
if [ -d $wdir_connect ];then
mkdir -p $wdir_connect
fi
# check for node
nodeversion=$(node $wdir/test/testnode.js)
if [ $nodeversion != 'Node_is_working' ];then
echo "Cannot find node"
echo "Install it and try again!"
toolsok='no'
fi
#check for docker
dockerversion=$(/bin/bash $wdir/test/testdocker.sh)
if [ $dockerversion != 'linux' ];then
echo "Cannot find docker"
echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no'
fi
#check for docker-compose
dockercomposeversion=$(docker-compose -f $wdir/test/run.yml config --services)
if [ $dockercomposeversion != 'swarmlabclient' ];then
echo "Cannot find docker-compose"
echo "Install it and try again!"
echo "http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html"
toolsok='no'
fi
#check for wireguard
wgversion=$(wg --version | cut -d' ' -f1)
if [ $wgversion != 'wireguard-tools' ];then
echo "Cannot find wg"
echo "Install it and try again!"
echo "https://www.wireguard.com/install/"
toolsok='no'
fi
4 years ago
#check for pm2
if ! command -v pm2 &> /dev/null
then
toolsok='no'
echo "pm2 could not be found"
echo "sudo npm install -g pm2"
exit
fi
4 years ago
#check for jq
if ! command -v jq &> /dev/null
then
toolsok='no'
echo "jq could not be found"
exit
fi
if [ $toolsok == 'ok' ];then
npm install
fi
if [ $toolsok == 'ok' ];then
cd src-local
npm install
cd $wdir
fi
4 years ago
if [ $toolsok == 'ok' ];then
cp -f $wdir/files/VuetableCssConfig.js $wdir/node_modules/vuetable-2/src/components/VuetableCssConfig.js
cat << FOE > $wdir/src-local/ecosystem.config.js
module.exports = {
"apps": [
{
"name" : "server",
"autorestart" : true,
"watch" : true,
"cwd" : "$wdir/src-local",
"script" : "./llo/new.js",
"run_as_user" : "node",
"args" : "start",
"pid_file" : "$wdir/src-local/pid.pid",
"log_type" : "json",
"log_file" : "$wdir/src-local/logs/logfile",
"error_file" : "$wdir/src-local/logs/errorfile",
"out_file" : "$wdir/src-local/logs/outfile",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"merge_logs" : true,
"exec_mode" : "fork",
"max_restarts": 10,
"max_memory_restart": "500M",
"restart_delay": 1000
},
]
}
FOE
fi
4 years ago
echo $nodeversion
echo $dockerversion
echo $dockercomposeversion
echo $wdir
echo $wdir_connect