Skip to content

Commit 09847e1

Browse files
committed
Make docker-compose flexible
1 parent 78d2162 commit 09847e1

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
./services create || true
2929
- name: Run Script
3030
run: |
31-
./services start && ./services stop
31+
./services start test && ./services stop test

services

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
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

87
set -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
1417
fi
@@ -35,7 +38,7 @@ loadData () {
3538

3639
stoppingContainers () {
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

4144
displayServices () {
@@ -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

Comments
 (0)