Skip to content

Instantly share code, notes, and snippets.

@usk81
Last active December 4, 2017 04:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usk81/74321e479e483c1d30e85c4b39fd7539 to your computer and use it in GitHub Desktop.
Save usk81/74321e479e483c1d30e85c4b39fd7539 to your computer and use it in GitHub Desktop.
Docker compose for Couchbase community edition
set -x
set -m
/entrypoint.sh couchbase-server &
sleep 15
# Setup index and memory quota
curl -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=512 -d indexMemoryQuota=512
# Setup services
curl -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex
# Setup credentials
curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password
# Setup Memory Optimized Indexes
curl -i -u Administrator:password -X POST http://127.0.0.1:8091/settings/indexes -d 'storageMode=forestdb'
# Load travel-sample bucket
# curl -v -u Administrator:password -X POST http://127.0.0.1:8091/sampleBuckets/install -d '["travel-sample"]'
echo "Type: $TYPE"
if [ "$TYPE" = "WORKER" ]; then
echo "Sleeping ..."
sleep 15
#IP=`hostname -s`
IP=`hostname -I | cut -d ' ' -f1`
echo "IP: " $IP
echo "Auto Rebalance: $AUTO_REBALANCE"
if [ "$AUTO_REBALANCE" = "true" ]; then
couchbase-cli rebalance --cluster=$COUCHBASE_MASTER:8091 --user=Administrator --password=password --server-add=$IP --server-add-username=Administrator --server-add-password=password
else
couchbase-cli server-add --cluster=$COUCHBASE_MASTER:8091 --user=Administrator --password=password --server-add=$IP --server-add-username=Administrator --server-add-password=password
fi;
fi;
fg 1
version: "3"
services:
db:
build:
context: .
dockerfile: Dockerfile
deploy:
replicas: 1
volumes:
- ./export/var/couchbase/node1:/opt/couchbase/var
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
FROM couchbase:community
COPY configure-node.sh /opt/couchbase
#HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost:8091/pools || exit 1
CMD ["/opt/couchbase/configure-node.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment