-
Notifications
You must be signed in to change notification settings - Fork 6
/
start-awe-worker.sh
executable file
·78 lines (67 loc) · 1.81 KB
/
start-awe-worker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# usage info
function usage () {
echo "Usage: start-awe-worker.sh [-d ~/data] -s SKYPORT_HOST "
}
# get options
while getopts d:a:s: option; do
case "${option}"
in
d) DATADIR=${OPTARG};;
s) SKYPORT_HOST=${OPTARG};;
a) SKYPORT_AUTH=${OPTARG};;
*)
usage
;;
esac
done
# make sure the required options are present
if [ -z ${SKYPORT_HOST} ]
then
usage
exit 1
fi
# check on the auth situation
if [ -z ${SKYPORT_AUTH} ]
then
echo "We did not find an auth token (-a or $SKYPORT_AUTH). Running in anonymous mode"
fi
# set the AWE_SERVER relative to the SKYPORT SERVER
AWE_SERVER=http://${SKYPORT_HOST}:8001/awe/api/
# ensure a local copy of the Skyport repo exists and docker and environment are ready
#git clone --recursive https://github.com/MG-RAST/Skyport2.git
#cd Skyport2
source ./scripts/get_docker_binary.sh
# there might be a better directory than this already set via an ENV variable
if [ -z ${DATADIR} ]
then
export DATADIR=`pwd`/tmp
fi
mkdir -p ${DATADIR}
if [ "${SKYPORT_HOST}_" == "skyport.local_" ] ; then
ADDHOST="--add-host skyport.local:${SKYPORT_DOCKER_GATEWAY}"
fi
# define a somewhat unique name for the worker
hostn=`hostname`
WNAME=awe-worker-${hostn}
set -x
docker run \
-d \
${ADDHOST}\
--name ${WNAME} \
-v ${DATADIR}/awe-worker:${DATADIR}/awe-worker \
-v ${DOCKER_BINARY}:/usr/local/bin/docker \
-v /var/run/docker.sock:/var/run/docker.sock \
mgrast/awe-worker:develop \
/go/bin/awe-worker \
--name external_worker-1 \
--data=/awe-worker/ \
--logs=/mnt/data/logs/ \
--workpath=/awe-worker/work/ \
--serverurl=${AWE_SERVER} \
--group=docker \
--supported_apps=* \
--auto_clean_dir=false \
--debuglevel=0
set +x