forked from FIWARE/tutorials.Historic-Context-Flume
-
Notifications
You must be signed in to change notification settings - Fork 0
/
services
executable file
·112 lines (106 loc) · 4.47 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
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
#!/bin/bash
#
# Command Line Interface to start all services associated with the Getting-Started Tutorial
#
# For this tutorial the commands are merely a convenience script to run docker-compose
#
set -e
loadData () {
printf "Loading context data "
./import-data
echo -e " \033[1;32mdone\033[0m"
printf "Provisioning IoT devices "
./provision-devices
echo -e " \033[1;32mdone\033[0m"
}
stoppingContainers () {
echo "Stopping containers"
docker-compose --log-level ERROR -f docker-compose/multiple.yml -p fiware down -v --remove-orphans
}
if (( $# != 1 )); then
echo "Illegal number of parameters"
echo "usage: services [create|mongodb|mysql|multiple|postgres|stop]"
exit 1
fi
command="$1"
case "${command}" in
"help")
echo "usage: services [create|mongodb|mysql|multiple|postgres|stop]"
;;
"multiple")
stoppingContainers
echo -e "Starting seven containers \033[1;34mOrion\033[0m, \033[1;34mCygnus\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1;30mTutorial\033[0m and \033[1;30mMongoDB\033[0m, \033[1;30mPostgreSQL\033[0m and \033[1;30mMySQL\033[0m databases."
echo -e "- \033[1;34mOrion\033[0m is the context broker"
echo -e "- \033[1;34mCygnus\033[0m is configured to write context data to Mongo-DB, PostgeSQL and MySQL"
echo -e "- \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
echo -e "- \033[1;30mTutorial\033[0m acts as a series of dummy IoT Sensors over HTTP"
echo ""
docker-compose --log-level ERROR -f docker-compose/multiple.yml -p fiware up -d --remove-orphans
loadData
echo ""
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
;;
"mongodb")
stoppingContainers
echo -e "Starting five containers \033[1;34mOrion\033[0m, \033[1;34mCygnus\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1;30mTutorial\033[0m and a \033[1;30mMongoDB\033[0m database."
echo -e "- \033[1;34mOrion\033[0m is the context broker"
echo -e "- \033[1;34mCygnus\033[0m is configured to write context data to Mongo-DB only"
echo -e "- \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
echo -e "- \033[1;30mTutorial\033[0m acts as a series of dummy IoT Sensors over HTTP"
echo ""
docker-compose --log-level ERROR -f docker-compose/mongodb.yml -p fiware up -d --remove-orphans
loadData
echo ""
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
;;
"postgres")
stoppingContainers
echo -e "Starting six containers \033[1;34mOrion\033[0m, \033[1;34mCygnus\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1;30mTutorial\033[0m and \033[1;30mMongoDB\033[0m and \033[1;30mPostgreSQL\033[0m databases."
echo -e "- \033[1;34mOrion\033[0m is the context broker"
echo -e "- \033[1;34mCygnus\033[0m is configured to write context data to PostgreSQL only"
echo -e "- \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
echo -e "- \033[1;30mTutorial\033[0m acts as a series of dummy IoT Sensors over HTTP"
echo ""
docker-compose --log-level ERROR -f docker-compose/postgres.yml -p fiware up -d --remove-orphans
loadData
echo ""
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
;;
"mysql")
stoppingContainers
echo -e "Starting six containers \033[1;34mOrion\033[0m, \033[1;34mCygnus\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1;30mTutorial\033[0m and \033[1;30mMongoDB\033[0m and \033[1;30mMySQL\033[0m databases."
echo -e "- \033[1;34mOrion\033[0m is the context broker"
echo -e "- \033[1;34mCygnus\033[0m is configured to write context data to MySQL only"
echo -e "- \033[1;36mIoT-Agent\033[0m is configured for the UltraLight Protocol"
echo -e "- \033[1;30mTutorial\033[0m acts as a series of dummy IoT Sensors over HTTP"
echo ""
docker-compose -f docker-compose/mysql.yml -p fiware up -d --remove-orphans
loadData
echo ""
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
;;
"stop")
stoppingContainers
;;
"create")
echo "Obtaining Mongo DB image"
docker pull mongo:3.6
echo "Obtaining PostgreSQL DB image"
docker pull postgres:latest
echo "Obtaining MySQL DB image"
docker pull mysql:5.7
echo "Obtaining Latest Orion Image"
docker pull fiware/orion
echo "Obtaining Latest UltraLight IoT Agent"
docker pull fiware/iotagent-ul
echo "Obtaining Latest Cygnus"
docker pull fiware/cygnus-ngsi
echo "Obtaining Tutorial Application"
docker pull fiware/tutorials.context-provider
;;
*)
echo "Command not Found."
echo "usage: services [create|mongodb|mysql|multiple|postgres|stop]"
exit 127;
;;
esac