Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
executable file 113 lines (106 sloc) 3.06 KB
#!/bin/bash
#
# Command Line Interface to start all services associated with the Fast/Micro-RTPS tutorials
#
#
# 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
stoppingContainers () {
echo "Stopping running containers"
${dockerCmd} -f docker-compose/kurento-with-filters.yml down -v --remove-orphans
}
startingContainers () {
echo -e "Starting containers: - \033[1;35mKurento\033[0m and \033[1mKurento-Examples (${command})\033[0m"
echo -e "- \033[1;35mKurento\033[0m is a Media Server"
echo -e "- \033[1mKurento-Examples\033[0m displays a web app to access the web-cam"
echo ""
TUTORIAL_NAME=${command} ${dockerCmd} -f docker-compose/kurento-with-filters.yml up -d --remove-orphans
echo ""
echo -e "Now open \033[4mhttps://localhost:8443\033[0m"
}
dockerCmd="docker compose"
if (( $# == 2 )); then
dockerCmd="docker-compose"
fi
if (( $# < 1 )); then
echo "Illegal number of parameters"
echo "usage: services [start|stop|create]"
exit 1
fi
command="$1"
case "${command}" in
"help")
echo "usage: services [start|stop]"
;;
"start")
export $(cat .env | grep "#" -v)
stoppingContainers;
echo -e "Starting containers: - \033[1;35mKurento\033[0m and \033[1mKurento-Examples (hello-world)\033[0m"
echo -e "- \033[1;35mKurento\033[0m is a Media Server"
echo -e "- \033[1mKurento-Examples\033[0m displays a web app to access the web-cam"
echo ""
${dockerCmd} -f docker-compose/kurento.yml up -d --remove-orphans
echo ""
echo -e "Now open \033[4mhttps://localhost:8443\033[0m"
;;
"chroma")
stoppingContainers;
startingContainers;
;;
"crowddetector")
stoppingContainers;
startingContainers;
;;
"hello-world")
stoppingContainers;
echo -e "Starting containers: - \033[1;35mKurento\033[0m and \033[1mKurento-Examples (hello-world)\033[0m"
${dockerCmd} -f docker-compose/kurento.yml up -d --remove-orphans
echo ""
echo -e "Now open \033[4mhttps://localhost:8443\033[0m"
;;
"magic-mirror")
stoppingContainers;
startingContainers;
;;
"module-tests-api")
stoppingContainers;
startingContainers;
;;
"one2many-call")
stoppingContainers;
startingContainers;
;;
"one2one-call")
stoppingContainers;
startingContainers;
;;
"platedetector")
stoppingContainers;
startingContainers;
;;
"pointerdetector")
stoppingContainers;
startingContainers;
;;
"stop")
export $(cat .env | grep "#" -v)
stoppingContainers
;;
"create")
export $(cat .env | grep "#" -v)
echo "Pulling Docker images"
docker pull curlimages/curl
${dockerCmd} -f docker-compose/kurento.yml pull
${dockerCmd} -f docker-compose/kurento-with-filters.yml pull
;;
esac