Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 77 lines (67 sloc) 1.74 KB
#!/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
if (( $# != 1 )); then
echo "Illegal number of parameters"
echo "usage: services [create|https|start|stop]"
exit 1
fi
startContainers () {
echo ""
export IDM_HTTPS_ENABLED="$1"
docker-compose --log-level ERROR -p fiware up -d --remove-orphans
echo ""
}
stoppingContainers () {
echo "Stopping containers"
docker-compose --log-level ERROR -p fiware down -v --remove-orphans
}
waitToConnect () {
printf "Connecting \033[1;31mKeyrock\033[0m to \033[1;30mMySQL\033[0m "
for value in {1..5}
do
sleep 1
printf "."
done
echo -e " \033[1;32mdone\033[0m"
}
command="$1"
case "${command}" in
"help")
echo "usage: services [create|start|stop]"
;;
"start")
stoppingContainers
echo -e "Starting two containers \033[1;31mKeyrock\033[0m and a \033[1;30mMySQL\033[0m database."
echo -e "- \033[1;31mKeyrock\033[0m is an Identity Management Front-End over HTTP"
startContainers false
waitToConnect
echo ""
echo -e "Now open \033[4mhttp://localhost:3005/idm\033[0m"
;;
"https")
stoppingContainers
echo -e "Starting two containers \033[1;31mKeyrock\033[0m and a \033[1;30mMySQL\033[0m database."
echo -e "- \033[1;31mKeyrock\033[0m is an Identity Management Front-End"
startContainers true
waitToConnect
echo ""
echo -e "Now open \033[4mhttps://localhost:3443/idm\033[0m"
;;
"stop")
stoppingContainers
;;
"create")
echo "Pulling Docker images"
docker-compose --log-level ERROR -p fiware pull
;;
*)
echo "Command not Found."
echo "usage: services [create|start|stop]"
exit 127;
;;
esac