Forked from YannRobert/init-graphite-container-volumes.sh
Last active
August 29, 2015 14:22
-
-
Save janpapenbrock/09b415bcb7da50c8d2de to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
set -e | |
set -x | |
LOG_DIR=$HOME/graphite-volumes/var-log | |
DATA_DIR=$HOME/graphite-volumes/graphite-storage | |
VOLUMES_INIT_CONTAINER_NAME=graphite-volumes-init | |
#rm -rf $LOG_DIR | |
#rm -rf $DATA_DIR | |
# this will fail if one of the volume directories already exists, this prevents you from accidentally deleting your existing data | |
mkdir $LOG_DIR | |
mkdir $DATA_DIR | |
#sudo restorecon -Rv /$HOME/graphite-volumes | |
#sudo chcon -Rt svirt_sandbox_file_t $LOG_DIR | |
#sudo chcon -Rt svirt_sandbox_file_t $DATA_DIR | |
docker rm -f $VOLUMES_INIT_CONTAINER_NAME || true | |
docker pull hopsoft/graphite-statsd | |
docker run -d \ | |
--name $VOLUMES_INIT_CONTAINER_NAME \ | |
hopsoft/graphite-statsd | |
sleep 2 | |
docker logs $VOLUMES_INIT_CONTAINER_NAME | |
docker cp $VOLUMES_INIT_CONTAINER_NAME:/opt/graphite/storage $DATA_DIR | |
mv $DATA_DIR/storage/* $DATA_DIR | |
rmdir $DATA_DIR/storage | |
docker cp $VOLUMES_INIT_CONTAINER_NAME:/var/log $LOG_DIR | |
mv $LOG_DIR/log/* $LOG_DIR | |
rmdir $LOG_DIR/log | |
docker rm -f $VOLUMES_INIT_CONTAINER_NAME | |
echo "Content of storage directory" | |
ls -alFtr $DATA_DIR | |
echo "Content of log directory" | |
ls -alFtr $LOG_DIR | |
echo "Success" | |
This file contains hidden or 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/sh | |
set -e | |
set -x | |
LOG_DIR=$HOME/graphite-volumes/var-log | |
DATA_DIR=$HOME/graphite-volumes/graphite-storage | |
CONTAINER_NAME=graphite | |
docker pull hopsoft/graphite-statsd | |
docker rm -f $CONTAINER_NAME || true | |
docker run -d \ | |
--name $CONTAINER_NAME \ | |
-v $DATA_DIR:/opt/graphite/storage \ | |
-v $LOG_DIR:/var/log \ | |
-p 80:80 \ | |
-p 2003:2003 \ | |
-p 8125:8125/udp \ | |
hopsoft/graphite-statsd | |
sleep 2 | |
docker logs $CONTAINER_NAME | |
sleep 1 | |
curl --fail http://localhost | |
echo "Success" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment