代码拉取完成,页面将自动刷新
#!/bin/bash
set -eo pipefail
IFS=$'\n\t'
sandbox () {
# Enter attaches users to a shell in the desired container
enter () {
case $2 in
influxdb)
echo "Entering /bin/bash session in the influxdb container..."
docker-compose exec influxdb /bin/sh
;;
chronograf)
echo "Entering /bin/sh session in the chronograf container..."
docker-compose exec chronograf /bin/sh
;;
kapacitor)
echo "Entering /bin/bash session in the kapacitor container..."
docker-compose exec kapacitor /bin/sh
;;
telegraf)
echo "Entering /bin/bash session in the telegraf container..."
docker-compose exec telegraf /bin/sh
;;
#ifql)
# echo "Entering /bin/bash session in the ifql container..."
# docker-compose exec ifql /bin/sh
# ;;
*)
#echo "sandbox enter (influxdb||chronograf||kapacitor||telegraf||ifql)"
echo "sandbox enter (influxdb||chronograf||kapacitor||telegraf)"
;;
esac
}
# Logs streams the logs from the container to the shell
logs () {
case $2 in
influxdb)
echo "Following the logs from the influxdb container..."
docker-compose logs -f influxdb
;;
chronograf)
echo "Following the logs from the chronograf container..."
docker-compose logs -f chronograf
;;
kapacitor)
echo "Following the logs from the kapacitor container..."
docker-compose logs -f kapacitor
;;
telegraf)
echo "Following the logs from the telegraf container..."
docker-compose logs -f telegraf
;;
#ifql)
# echo "Following the logs from the ifql container..."
# docker-compose logs -f ifql
# ;;
*)
#echo "sandbox logs (influxdb||chronograf||kapacitor||telegraf||ifql)"
echo "sandbox logs (influxdb||chronograf||kapacitor||telegraf)"
;;
esac
}
case $1 in
up)
echo "Spinning up Docker Images..."
echo "If this is your first time starting sandbox this might take a minute..."
docker-compose up -d --build
if false ; then
echo "Opening tabs in browser..."
sleep 3
if [ $(uname) == "Darwin" ]; then
open http://localhost:3010
open http://localhost:8888
elif [ $(uname) == "Linux" ]; then
sensible-browser http://localhost:8888
sensible-browser http://localhost:3010
else
echo "no browser detected..."
fi
fi
;;
down)
echo "Stopping and removing running sandbox containers..."
docker-compose down
;;
restart)
echo "Stopping all sandbox processes..."
docker-compose down > /dev/null 2>&1
echo "Starting all sandbox processes..."
docker-compose up -d --build > /dev/null 2>&1
echo "Services available!"
;;
delete-data)
echo "deleting all influxdb, kapacitor and chronograf data..."
rm -rf kapacitor/data influxdb/data chronograf/data
;;
docker-clean)
echo "Stopping and removing running sandbox containers..."
docker-compose down
echo "Removing TICK images..."
#docker rmi sandbox_documentation influxdb:latest telegraf:latest kapacitor:latest chronograf:latest ifqld:latest ifqld_wait:latest quay.io/influxdb/ifqld:latest chrono_config:latest chronograf:latest > /dev/null 2>&1
docker rmi influxdb:1.6.1-alpine telegraf:1.7.3-alpine kapacitor:1.5.1-alpine chronograf:1.6.1-alpine > /dev/null 2>&1
;;
influxdb)
echo "Entering the influx cli..."
docker-compose exec influxdb /usr/bin/influx
;;
rebuild-docs)
echo "Rebuilding documentation container..."
docker build -t sandbox_documentation documentation/ > /dev/null 2>&1
echo "Restarting..."
docker-compose down > /dev/null 2>&1
docker-compose up -d --build > /dev/null 2>&1
;;
enter)
enter $@
;;
logs)
logs $@
;;
*)
# cat <<-EOF
#sandbox commands:
# up -> spin up the sandbox environment
# down -> tear down the sandbox environment
# restart -> restart the sandbox
# influxdb -> attach to the influx cli
# enter (influxdb||kapacitor||chronograf||telegraf||ifql) -> enter the specified container
# logs (influxdb||kapacitor||chronograf||telegraf||ifql) -> stream logs for the specified container
# delete-data -> delete all data created by the TICK Stack
# docker-clean -> stop and remove all running docker containers and images
# rebuild-docs -> rebuild the documentation image
#EOF
cat <<-EOF
sandbox commands:
up -> spin up the sandbox environment
down -> tear down the sandbox environment
restart -> restart the sandbox
influxdb -> attach to the influx cli
enter (influxdb||kapacitor||chronograf||telegraf) -> enter the specified container
logs (influxdb||kapacitor||chronograf||telegraf) -> stream logs for the specified container
delete-data -> delete all data created by the TICK Stack
docker-clean -> stop and remove all running docker containers and images
rebuild-docs -> rebuild the documentation image
EOF
;;
esac
}
sandbox $@
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。