Hello there !
I am trying to install a Couchbase instance in my local docker stack (using Docker-compose) and, if necessary, be able to set it up (creating the cluster and the bucket) by script.
Right now I’m able to start a CB Container and, by loging to the container, I can run some bash script that sets up the container to my test. Here’s the script :
#!/bin/sh
couchbase-cli cluster-init -c localhost \
--cluster-username administrator \
--cluster-password password \
--services data,index,query \
--cluster-ramsize 2048 \
--cluster-index-ramsize 256
couchbase-cli bucket-create \
--cluster localhost \
--username administrator \
--password password \
--bucket test \
--bucket-type couchbase \
--bucket-ramsize 1024 \
--max-ttl 500000000 \
--durability-min-level persistToMajority \
--enable-flush 0
This is text-book example from the documentation btw. Nothing fancy.
As said previously, I let the docker-compose up start everything, then I can just log into the container (through Portainer) and execute my commands inside. It works like a charm.
Now I want to execute that script automatically. The issue being that it seems to crash when I put it in the Entrypoint or some post entrypoint script because it tries to reach the server while it isn’t completly started. Not sure tho, I don’t have much output from the container.
Do you have an idea on how I can trigger with certainty my script when everything runs ?
Regards,