| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | #!/bin/bash# used to start couchbase server - can't get around this as docker compose only allows you to start one command - so we have to start couchbase like the standard couchbase Dockerfile would # https://github.com/couchbase/docker/blob/master/enterprise/couchbase-server/7.2.0/Dockerfile#L88/entrypoint.sh couchbase-server & # track if setup is complete so we don't try to setup againFILE=/opt/couchbase/init/setupComplete.txtif ! [ -f "$FILE" ]; then  # used to automatically create the cluster based on environment variables  # https://docs.couchbase.com/server/current/cli/cbcli/couchbase-cli-cluster-init.html  echo $COUCHBASE_ADMINISTRATOR_USERNAME ":"  $COUCHBASE_ADMINISTRATOR_PASSWORD  sleep 20s  /opt/couchbase/bin/couchbase-cli cluster-init -c 127.0.0.1 \  --cluster-username $COUCHBASE_ADMINISTRATOR_USERNAME \  --cluster-password $COUCHBASE_ADMINISTRATOR_PASSWORD \  --services data,index,query,fts \  --cluster-ramsize $COUCHBASE_RAM_SIZE \  --cluster-index-ramsize $COUCHBASE_INDEX_RAM_SIZE \  --cluster-eventing-ramsize $COUCHBASE_EVENTING_RAM_SIZE \  --cluster-fts-ramsize $COUCHBASE_FTS_RAM_SIZE \  --index-storage-setting default  sleep 2s  # used to auto create the bucket based on environment variables  # https://docs.couchbase.com/server/current/cli/cbcli/couchbase-cli-bucket-create.html  /opt/couchbase/bin/couchbase-cli bucket-create -c localhost:8091 \  --username $COUCHBASE_ADMINISTRATOR_USERNAME \  --password $COUCHBASE_ADMINISTRATOR_PASSWORD \  --bucket $COUCHBASE_BUCKET \  --bucket-ramsize $COUCHBASE_BUCKET_RAMSIZE \  --bucket-type couchbase  # create file so we know that the cluster is setup and don't run the setup again   touch $FILEfi   # docker compose will stop the container from running unless we do this  # known issue and workaround  tail -f /dev/null
 |