We’re currently using bash scripts to initialize single server Couchbase clusters inside Docker containers for our development machines. The script starts up Couchbase Server, initializes the configuration, creates buckets, and populates them with test data. However, we’re seeing sporadic issues with filling the buckets with sample data that seems to be related to timing.
Currently, we’re monitoring the REST API and waiting for all buckets to show a status of “healthy” before we begin posting test data via the K/V API. You can see the bash script we’re using here: https://github.com/brantburnett/couchbasefakeit/blob/master/configure-node.sh#L60
However, sporadically we’ll get this error from the NodeJS SDK (being used by FakeIt):
(node:473) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CouchbaseError: Client-Side timeout exceeded for operation. Inspect network conditions or increase the timeout
This error usually happens on the first bucket we’re loading with data, but not always. It also doesn’t happen consistently. This operation is 100% on the local machine, and the bash script is executing within the same Docker container where Couchbase Server is running.
I’ve tried adding an extra “sleep 1” after we see the buckets as healthy, but it doesn’t seem to have consistently resolved the problem.
Any ideas? Is there a better REST endpoint we can check to be sure the server is ready for K/V operations after startup?