create_password() { # eval $1_var=$1 # echo "$postgres_var" SECRET=`tr -cd '[:alnum:]' < /dev/urandom | fold -w32 | head -n1` echo "$SECRET"; } start_blah() { echo "val1 is $1"; echo "val2 is $2"; echo "val3 is $3"; echo "val4 is $4"; } start_service() { # Start /federated/apps/SERVICE with output to /dev/null echo -ne "\n* Starting /federated/apps/$SERVICE service.." spin & SPINPID=$! if [ $DEBUG ]; then # Start /federated/apps/SERVICE with output to console for debug docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up [ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service /federated/apps/SERVICE" else docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null # Keep trying service port to make sure it's up before # we proceed RETRY="30" while [ $RETRY -gt 0 ]; do nc -z 172.99.0.19 9000 &> /dev/null if [ $? -eq 0 ]; then break else if [ "$RETRY" == 1 ]; then docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null kill -9 $SPINPID &> /dev/null fail "There was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with -d" fi ((RETRY--)) sleep 7 fi done fi }