forked from NASA-AMMOS/common-workflow-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.sh
executable file
·113 lines (91 loc) · 2.79 KB
/
dev.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# --------
# dev.sh
# --------
# Builds, deploys, configures and runs a CWS console/worker setup locally for development.
ROOT=${1}
LDAP_USERNAME=${2}
DB_TYPE=${3}
DB_HOST=${4}
DB_PORT=${5}
DB_NAME=${6}
DB_USER=${7}
DB_PASS=${8}
ES_HOST=${9}
ES_PORT=${10}
ES_USE_AUTH=${11}
ES_USERNAME=${12}
ES_PASSWORD=${13}
ENABLE_CLOUD_AS=${14}
SECURITY_SCHEME=${15}
THIS_HOSTNAME=${16}
NOTIFICATION_EMAILS=${17}
ADMIN_FIRSTNAME=${18}
ADMIN_LASTNAME=${19}
ADMIN_EMAIL=${20}
NUM_WORKERS=${21}
WORKER_ABANDONED_DAYS=${22}
source ${ROOT}/utils.sh
# Only for the Mac users
[[ `uname -s` != "Darwin" ]] && return
print 'Building CWS libraries and creating distribution archive'
${ROOT}/build.sh
DIST=${ROOT}/dist
SERVER_DIST='cws_server.tar.gz'
# -------------------
# CONFIGURE CONSOLE
# -------------------
print "Preparing console installation files..."
mkdir -p ${DIST}/console-only
tar --directory=${DIST}/console-only -zxf ${DIST}/${SERVER_DIST}
print "Generating console installation properties..."
auto_conf_data console-only "$@" ${ROOT}/auto_conf_console.dat
print "Configuring console installation..."
${DIST}/console-only/cws/configure.sh ${ROOT}/auto_conf_console.dat Y
if [[ $? -gt 0 ]]; then
prompt_to_continue "Error during configuration (see above) Continue? (y/n): "
fi
# -----------------------------------------
# COPY IN DEVELOPMENT BPMN FILES
# used for development and testing purposes
# -----------------------------------------
cp ${ROOT}/install/dev/bpmn/*.bpmn ${DIST}/console-only/cws/bpmn
print "Done configuring console installation."
# --------------
# START CONSOLE
# --------------
LOG_FILE="server/apache-tomcat-${TOMCAT_VER}/logs/catalina.out"
BASE_PORT=8000
tab ${DIST}/console-only/cws "./start_cws.sh -d $BASE_PORT; tail -f $LOG_FILE"
print "Waiting for console startup..."
sleep 100
# -----------------
# CONFIGURE WORKERS
# -----------------
if [[ -z "$NUM_WORKERS" ]]; then
NUM_WORKERS=1
fi
for ((WORKER_NUM=1; WORKER_NUM <= $NUM_WORKERS; WORKER_NUM++)); do
print "Configuring worker $WORKER_NUM installation...";
WORKER_TAG="worker${WORKER_NUM}"
mkdir -p ${DIST}/${WORKER_TAG}
tar --directory=${DIST}/${WORKER_TAG} -zxf ${DIST}/${SERVER_DIST}
auto_conf_data ${WORKER_TAG} "$@" ${ROOT}/auto_conf.dat
${DIST}/${WORKER_TAG}/cws/configure.sh ${ROOT}/auto_conf.dat
if [[ $? -gt 0 ]]; then
prompt_to_continue "Error during configuration (see above) Continue? (y/n): "
fi
done
# -------------
# START WORKERS
# -------------
for ((WORKER_NUM=1; WORKER_NUM <= $NUM_WORKERS; WORKER_NUM++)); do
sleep 5
print "Starting worker ${WORKER_NUM}..."
WORKER_TAG="worker${WORKER_NUM}"
WORKER_PORT=$((BASE_PORT + WORKER_NUM))
tab ${DIST}/${WORKER_TAG}/cws "./start_cws.sh -d $WORKER_PORT; tail -f $LOG_FILE"
done
rm -f ${ROOT}/auto_conf.dat
rm -f ${ROOT}/auto_conf_console.dat
print "Finished"