Created
August 7, 2015 07:46
-
-
Save corbinu/a4c445fcb68c6468bb7d to your computer and use it in GitHub Desktop.
Break couchbase on docker restart
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 | |
docker stop couchbase | |
docker rm -f cb-node-demo | |
docker run -d --volumes-from couchbase -p 8091:8091 --name couchbase2 couchbase/server:enterprise-4.0.0-beta | |
sleep 1.3 | |
COUCHBASERESPONSIVE=0 | |
while [ $COUCHBASERESPONSIVE != 1 ]; do | |
echo -n '.' | |
RUNNING=$(docker inspect couchbase2 | json -a State.Running) | |
if [ "$RUNNING" == "true" ] | |
then | |
let COUCHBASERESPONSIVE=1 | |
else | |
sleep 1.3 | |
fi | |
done | |
export CB_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' couchbase2) | |
docker run -d --env CB_IP=$CB_IP --name cb-node-demo -p 3000:3000 corbinu/try-cb-nodejs |
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 | |
docker stop couchbase | |
docker start couchbase |
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 | |
docker pull couchbase/server:enterprise-4.0.0-beta | |
docker pull corbinu/try-cb-nodejs | |
docker run -d -p 8091:8091 -v /tmp/couchbase:/opt/couchbase/var \ | |
--name couchbase couchbase/server:enterprise-4.0.0-beta | |
export CB_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' couchbase) | |
echo | |
echo -n 'Initilizing cluster.' | |
sleep 1.3 | |
COUCHBASERESPONSIVE=0 | |
while [ $COUCHBASERESPONSIVE != 1 ]; do | |
echo -n '.' | |
RUNNING=$(docker inspect couchbase | json -a State.Running) | |
if [ "$RUNNING" == "true" ] | |
then | |
let COUCHBASERESPONSIVE=1 | |
else | |
sleep 1.3 | |
fi | |
done | |
echo | |
echo '#' | |
echo '# Initializing node' | |
echo '#' | |
COUCHBASERESPONSIVE=0 | |
while [ $COUCHBASERESPONSIVE != 1 ]; do | |
echo -n '.' | |
docker exec -it couchbase couchbase-cli node-init -c 127.0.0.1:8091 \ | |
-u access -p password \ | |
--node-init-data-path=/opt/couchbase/var/lib/couchbase/data \ | |
--node-init-index-path=/opt/couchbase/var/lib/couchbase/data \ | |
--node-init-hostname=$CB_IP | |
if [ $? -eq 0 ] | |
then | |
let COUCHBASERESPONSIVE=1 | |
else | |
sleep .7 | |
fi | |
done | |
echo | |
COUCHBASERESPONSIVE=0 | |
while [ $COUCHBASERESPONSIVE != 1 ]; do | |
echo -n '.' | |
docker exec -it couchbase bash -c "couchbase-cli cluster-init -c 127.0.0.1:8091 -u access -p password \ | |
--cluster-username=Administrator \ | |
--cluster-password=password --cluster-port=8091 \ | |
--services=data,index,query --cluster-index-ramsize=1024 \ | |
--cluster-ramsize=512" | |
if [ $? -eq 0 ] | |
then | |
let COUCHBASERESPONSIVE=1 | |
else | |
sleep .7 | |
fi | |
done | |
sleep 35 | |
docker exec -it couchbase couchbase-cli bucket-edit -c 127.0.0.1:8091 \ | |
-u Administrator -p password --bucket=travel-sample --bucket-ramsize=512 | |
docker run -d --env CB_IP=$CB_IP --name cb-node-demo -p 3000:3000 corbinu/try-cb-nodejs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment