22#
33# Command Line Interface to start all services associated with the Getting-Started Tutorial
44#
5- # For this tutorial the commands are merely a convenience script to run docker-compose
6- #
5+ # For this tutorial the commands are merely a convenience script to run ${dockerCmd}#
76
87set -e
98
10- if (( $# != 1 )) ; then
11- echo " Illegal number of parameters"
9+ dockerCmd=" docker compose"
10+ if (( $# == 2 )) ; then
11+ dockerCmd=" docker-compose"
12+ fi
13+
14+ if (( $# < 1 )) ; then echo " Illegal number of parameters"
1215 echo " usage: services [create|cygnus|sth-comet|stop]"
1316 exit 1
1417fi
@@ -35,7 +38,7 @@ loadData () {
3538
3639stoppingContainers () {
3740 echo " Stopping running containers"
38- docker-compose -f docker-compose/cygnus-sth-comet.yml down -v --remove-orphans
41+ ${dockerCmd} -f docker-compose/cygnus-sth-comet.yml down -v --remove-orphans
3942}
4043
4144displayServices () {
@@ -118,7 +121,7 @@ case "${command}" in
118121 echo -e " - \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
119122 echo -e " - \033[1mTutorial\033[0m acts as a series of dummy IoT Sensors over HTTP"
120123 echo " "
121- docker-compose -f docker-compose/sth-comet.yml up -d --remove-orphans
124+ ${dockerCmd} -f docker-compose/sth-comet.yml up -d --remove-orphans
122125 loadData
123126 displayServices
124127 echo -e " Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
@@ -132,7 +135,7 @@ case "${command}" in
132135 echo -e " - \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
133136 echo -e " - \033[1mTutorial\033[0m acts as a series of dummy IoT Sensors"
134137 echo " "
135- docker-compose -f docker-compose/cygnus-sth-comet.yml up -d --remove-orphans
138+ ${dockerCmd} -f docker-compose/cygnus-sth-comet.yml up -d --remove-orphans
136139 loadData
137140 displayServices
138141 echo -e " Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
@@ -149,7 +152,7 @@ case "${command}" in
149152 export $( cat .env | grep " #" -v)
150153 echo " Pulling Docker images"
151154 docker pull curlimages/curl
152- docker-compose -f docker-compose/cygnus-sth-comet.yml pull
155+ ${dockerCmd} -f docker-compose/cygnus-sth-comet.yml pull
153156 ;;
154157 * )
155158 echo " Command not Found."
0 commit comments