Created
August 5, 2016 21:42
-
-
Save leedm777/d757c810f7785c9b3517fe073f4ee6aa 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 | |
# | |
# Spin up couchbase in a container | |
# | |
PROGNAME=$(basename $0) | |
: ${VERSION:=community-3.1.3} | |
alias couchbase-cli="docker exec couchbase couchbase-cli" | |
set -ex | |
if test "$(docker ps --filter name=couchbase -a --format exists)" = exists; then | |
docker start couchbase | |
else | |
docker run \ | |
--name couchbase \ | |
--detach \ | |
-e CB_REST_USERNAME=Administrator \ | |
-e CB_REST_PASSWORD=password \ | |
-p 8091:8091 \ | |
-p 8092:8092 \ | |
-p 8093:8093 \ | |
-p 8094:8094 \ | |
-p 11207:11207 \ | |
-p 11210:11210 \ | |
-p 11211:11211 \ | |
-p 18091:18091 \ | |
-p 18092:18092 \ | |
-p 18093:18093 \ | |
couchbase:${VERSION} | |
fi | |
while ! couchbase-cli bucket-list -c localhost; do | |
echo "${PROGNAME}: waiting for couchbase" >&2 | |
sleep 1 | |
done | |
if ! couchbase-cli bucket-list -c localhost | grep -q '^default$'; then | |
couchbase-cli bucket-create -c localhost \ | |
--bucket=default \ | |
--bucket-type=couchbase \ | |
--bucket-password= \ | |
--bucket-ramsize=100 \ | |
--bucket-replica=0 \ | |
--bucket-priority=low \ | |
--wait | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment