Last active
February 4, 2018 17:21
-
-
Save glenpike/3637f48f42fc17c2de4171465b2808f4 to your computer and use it in GitHub Desktop.
Quick and dirty Couchbase Server startup in a Docker container with docker-compose
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
version: "2" | |
services: | |
db: | |
build: ./ | |
ports: | |
- "8091:8091" | |
- "11207:11207" | |
- "11210:11210" | |
- "11211:11211" | |
- "18091:18091" | |
- "18092:18092" | |
- "18093:18093" | |
- "8092:8092" | |
- "8093:8093" | |
- "8094:8094" | |
restart: "on-failure:10" |
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
FROM couchbase:community-4.5.0 | |
EXPOSE 8091 8092 8093 9100 9101 9102 9103 9104 9105 9998 9999 11207 11209 11210 11211 11214 11215 18091 18092 18093 4369 21100-21300 | |
ENV ADMIN_LOGIN=root | |
ENV ADMIN_PASSWORD=foobar | |
ENV CLUSTER_RAM_QUOTA=512 | |
ENV CLUSTER_INDEX_RAM_QUOTA=256 | |
ENV BUCKET_NAME=music | |
ENV BUCKET_RAM_QUOTA=256 | |
COPY init.sh / | |
ENTRYPOINT ["/init.sh"] |
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 | |
#based on https://github.com/clakech/couchbase-elastic | |
wait_for_start() { | |
"$@" | |
while [ $? -ne 0 ] | |
do | |
echo 'waiting for couchbase to start' | |
sleep 3 | |
"$@" | |
done | |
} | |
echo "launch couchbase" | |
/entrypoint.sh couchbase-server & | |
# wait for couchbase to be up - `couchbase-cli server-info` is broken / n/a | |
wait_for_start wget -q localhost:8091 | |
# init the cluster - get _all_the_things_ | |
couchbase-cli cluster-init -c 127.0.0.1:8091 -u ${ADMIN_LOGIN} -p ${ADMIN_PASSWORD} \ | |
--cluster-init-username=${ADMIN_LOGIN} --cluster-init-password=${ADMIN_PASSWORD} \ | |
--cluster-ramsize=${CLUSTER_RAM_QUOTA} --cluster-index-ramsize=${CLUSTER_INDEX_RAM_QUOTA} \ | |
--index-storage-setting=default --services=data,index,query,fts | |
# create bucket | |
couchbase-cli bucket-create -c 127.0.0.1:8091 -u ${ADMIN_LOGIN} -p ${ADMIN_PASSWORD} \ | |
--bucket=${BUCKET_NAME} --bucket-type=couchbase --bucket-ramsize=${BUCKET_RAM_QUOTA} --wait | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug in CB 4.5.0 with couchbase-cli server-info? https://forums.couchbase.com/t/couchbase-cli-with-4-5-0/8905