comparison launch_gnb.sh @ 7:dfb2bc3aedbd draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
author gga
date Thu, 01 Feb 2024 12:45:00 +0000
parents 5a6050937cb9
children 29eeddd8ea62
comparison
equal deleted inserted replaced
6:12494257f0f0 7:dfb2bc3aedbd
1 #!/bin/bash 1 #!/bin/bash
2 2
3 set -e 3 set -e
4 4
5 mongod --dbpath ./mongo_db/ --unixSocketPrefix `pwd` --bind_ip fake_socket --logpath ./mongod.log --pidfilepath ./mongo.pid & 5 echo "Running mongod: "
6 mongod --dbpath ./mongo_db/ --unixSocketPrefix "$(pwd)" --bind_ip fake_socket --logpath ./mongod.log --pidfilepath ./mongo.pid &
6 7
7 sleep 8 8 echo "Waiting while mongod starts up"
9
10 tries=0
8 11
9 # "Listening on" is for mongodb 5x 12 # "Listening on" is for mongodb 5x
10 if ! grep -q "Listening on" ./mongod.log; then 13 while ! grep -q "Listening on" ./mongod.log; do
11 echo "Failed to launch MongoDB:" 1>&2; 14
12 cat ./mongod.log 1>&2; 15 tries=$((tries + 1))
13 kill $GNB_PID; 16
14 exit 1; 17 if [ "$tries" -ge 30 ]; then
15 fi; 18 echo "Failed to launch MongoDB:" 1>&2;
19 cat ./mongod.log 1>&2;
20 exit 1;
21 fi
22
23 sleep 3
24 done;
16 25
17 TMP_STORAGE=$(pwd)/tmp_storage 26 TMP_STORAGE=$(pwd)/tmp_storage
18 mkdir "$TMP_STORAGE" 27 mkdir "$TMP_STORAGE"
19 28
20 export NODE_OPTIONS="--max-old-space-size=$((${GALAXY_MEMORY_MB:-8192} * 75 / 100))" 29 export NODE_OPTIONS="--max-old-space-size=$((${GALAXY_MEMORY_MB:-8192} * 75 / 100))"
21 30
22 genoboo run --storage-path "$TMP_STORAGE" --port ${GNB_PORT} --mongo-url mongodb://$MONGO_URI%2Fmongodb-27017.sock/genenotebook > ./gnb.log 2>&1 & 31 genoboo run --storage-path "$TMP_STORAGE" --port ${GNB_PORT} --mongo-url mongodb://$MONGO_URI%2Fmongodb-27017.sock/genenotebook > ./gnb.log 2>&1 &
23 32
24 export GNB_PID=$! 33 export GNB_PID=$!
25 34
26 sleep 15 35 tries_gnb=0
27 36
28 if ! grep -q "GeneNoteBook server started, serving" ./gnb.log; then 37 while ! grep -q "GeneNoteBook server started, serving" ./gnb.log; do
29 echo "Failed to launch GeneNoteBook:" 1>&2; 38
30 cat ./gnb.log 1>&2; 39 tries_gnb=$((tries_gnb + 1))
31 kill $GNB_PID $(<"./mongo.pid"); 40
32 exit 1; 41 if [ "$tries_gnb" -ge 30 ]; then
33 fi; 42 echo "Failed to launch GeneNoteBook:" 1>&2;
43 cat ./gnb.log 1>&2;
44 kill $GNB_PID $(<"./mongo.pid");
45 exit 1;
46 fi
47
48 sleep 3
49 done;