forked from N5GEH/n5geh.tutorials.from_sensor_to_application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
services
67 lines (63 loc) · 1.93 KB
/
services
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
#!/bin/bash
#
# Command Line Interface to start all services associated with this Tutorial
#
# For this tutorial the commands are merely a convenience script to run docker or docker compose
#
# Each services script can be run using either docker-compose (the external tool with the hyphen -)
# or docker compose (the newer version directly bundled with Docker with a space )
#
# if you start up with the following command:
#
# ./services start legacy
#
# This will force the script to use docker-compose which may be more reliable in
# some cases (or if an older version of Docker is being used)
set -e
dockerCmd="docker compose"
if (( $# == 2 )); then
dockerCmd="docker-compose"
fi
if (( $# < 1 )); then
echo "Illegal number of parameters"
echo "usage: services [create|start|stop]"
exit 1
fi
command="$1"
case "${command}" in
"help")
echo "usage: services [create|start]"
;;
# TODO we can make several steps here
# or we can just remove the start command. Tell the users to start the containers in Documentation
"start")
${dockerCmd} up -d
# ${dockerCmd} -f n5geh.services.controller/PIDControl/docker-compose.yml up -d TODO when to update the device name
;;
"create")
DIRECTORY="n5geh.services.controller"
if [ ! -d "$DIRECTORY" ]; then
git clone https://github.com/N5GEH/n5geh.services.controller.git
fi
# build image of pid controller
cd n5geh.services.controller
cp ./PIDControl/.env.EXAMPLE ./PIDControl/.env
docker build -f PIDControl/Dockerfile --tag pid4fiware .
# build image of front panel of the pid controller
cd PIDControl/control_panel
docker build --tag pidpanel .
# build image of the virtual devices
cd ../../../
cd devices
docker build --tag virtual_device .
# build image of the gateway
cd ../
cd gateway
docker build --tag gateway .
;;
*)
echo "Command not Found."
echo "usage: services [create|start]"
exit 127;
;;
esac