Sign inSign up

knowesis/persist

By knowesis

•Updated over 3 years ago

This image can be used to run couchbase in swam mode with master and slave

Image
0

4.2K

knowesis/persist repository overview

You can run the master by setting the environment variable to TYPE=MASTER. Once the master server is up, you an spin up workers by setting
TYPE=WORKER ( set the type of the node) PERSIST_MASTER=persist-master.persist ( persist-master is the master hostname and '.persist' refers to the network name) AUTO_REBALANCE=false ( setting the flag to true will automatically join and rebalance the cluster) The workers will automatically join the cluster when they are initiated.

FROM ubuntu:14.04

MAINTAINER KNOWESIS Team [email protected]⁠

LABEL system="PERSIST" LABEL version="2.7.0"

⁠Install dependencies:

⁠runit: for container process management

⁠wget: for downloading .deb

⁠python-httplib2: used by CLI tools

⁠chrpath: for fixing curl, below

⁠Additional dependencies for system commands used by cbcollect_info:

⁠lsof: lsof

⁠lshw: lshw

⁠sysstat: iostat, sar, mpstat

⁠net-tools: ifconfig, arp, netstat

⁠numactl: numactl

RUN apt-get update &&
apt-get install -yq runit wget python-httplib2 chrpath
lsof lshw sysstat net-tools numactl &&
apt-get autoremove && apt-get clean &&
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ARG CB_VERSION=4.5.0 ARG CB_RELEASE_URL=http://packages.couchbase.com/releases⁠ ARG CB_PACKAGE=couchbase-server-community_4.5.0-ubuntu14.04_amd64.deb ARG CB_SHA256=7682b2c90717ba790b729341e32ce5a43f7eacb5279f48f47aae165c0ec3a633

ENV PATH=$PATH:/opt/couchbase/bin:/opt/couchbase/bin/tools:/opt/couchbase/bin/install

⁠Create Couchbase user with UID 1000 (necessary to match default

⁠boot2docker UID)

RUN groupadd -g 1000 couchbase && useradd couchbase -u 1000 -g couchbase -M

⁠Install couchbase

RUN wget -N $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE &&
echo "$CB_SHA256 $CB_PACKAGE" | sha256sum -c - &&
dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE

⁠Add runit script for couchbase-server

COPY scripts/run /etc/service/couchbase-server/run

⁠Add dummy script for commands invoked by cbcollect_info that

⁠make no sense in a Docker container

COPY scripts/dummy.sh /usr/local/bin/ RUN ln -s dummy.sh /usr/local/bin/iptables-save &&
ln -s dummy.sh /usr/local/bin/lvdisplay &&
ln -s dummy.sh /usr/local/bin/vgdisplay &&
ln -s dummy.sh /usr/local/bin/pvdisplay

⁠Fix curl RPATH

RUN chrpath -r '$ORIGIN/../lib' /opt/couchbase/bin/curl

⁠Add bootstrap script

COPY scripts/entrypoint.sh / COPY configure-node.sh /opt/couchbase

#ENTRYPOINT ["/entrypoint.sh"] #CMD ["couchbase-server"] CMD ["/opt/couchbase/configure-node.sh"]

⁠8091: Couchbase Web console, REST/HTTP interface

⁠8092: Views, queries, XDCR

⁠8093: Query services (4.0+)

⁠8094: Full-text Search (4.5+)

⁠11207: Smart client library data node access (SSL)

⁠11210: Smart client library/moxi data node access

⁠11211: Legacy non-smart client library data node access

⁠18091: Couchbase Web console, REST/HTTP interface (SSL)

⁠18092: Views, query, XDCR (SSL)

⁠18093: Query services (SSL) (4.0+)

⁠18094: Full-text Search (SSL) (4.5+)

EXPOSE 8091 8092 8093 8094 11207 11210 11211 18091 18092 18093 18094 VOLUME /opt/couchbase/var


configure-node.sh

#!/bin/bash

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=300 -d indexMemoryQuota=300

⁠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=changeit

⁠Setup Memory Optimized Indexes

curl -i -u Administrator:password -X POST http://127.0.0.1:8091/settings/indexes⁠ -d 'storageMode=memory_optimized'

⁠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=$PERSIST_MASTER:8091 --user=Administrator --password=changeit --server-add=$IP --server-add-username=Administrator --server-add-password=changeit else couchbase-cli server-add --cluster=$PERSIST_MASTER:8091 --user=Administrator --password=changeit --server-add=$IP --server-add-username=Administrator --server-add-password=changeit fi; fi;

fg 1

Tag summary

Content type

Image

Digest

sha256:c9f4154e8…

Size

330.5 MB

Last updated

over 3 years ago

docker pull knowesis/persist:7.1.1-k8