Skip to content

Instantly share code, notes, and snippets.

@HON95
Created September 26, 2021 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HON95/360c3896e0ba7ff4e98802fab91bb2f9 to your computer and use it in GitHub Desktop.
Save HON95/360c3896e0ba7ff4e98802fab91bb2f9 to your computer and use it in GitHub Desktop.
InfluxDB Docker alternative bootstrap script
#!/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