Created
September 26, 2021 12:14
-
-
Save HON95/360c3896e0ba7ff4e98802fab91bb2f9 to your computer and use it in GitHub Desktop.
InfluxDB Docker alternative bootstrap script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
INFLUX_USERNAME="admin" | |
INFLUX_PASSWORD="password123" | |
INFLUX_ORG="main-org" | |
INFLUX_BUCKET="main-bucket" | |
INFLUX_RETENTION="0" | |
echo "Starting container" | |
docker-compose up -d influxdb | |
echo "Waiting for it to start" | |
while :; do | |
docker-compose exec influxdb curl -sSf "http://localhost:8086/api/" &>/dev/null && status=1 || status=0 | |
sleep 1 | |
if [[ $status == 1 ]]; then | |
break | |
fi | |
done | |
echo "Setup" | |
docker-compose exec influxdb influx setup \ | |
--username="$INFLUX_USERNAME" \ | |
--password="$INFLUX_PASSWORD" \ | |
--org="$INFLUX_ORG" \ | |
--bucket="$INFLUX_BUCKET" \ | |
--retention="$INFLUX_RETENTION" \ | |
--force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment