Multiple Local Couchbase Servers

I am attempting to set up a local testing environment. We’re using Couchbase in Docker for our local dev. The company I’ve begun working for doesn’t have any automated testing, and the testing they do have runs against their dev db. This is causing problems and occasionally breaks a devs db unexpectedly. We are working in Ruby and using the Ruby SDK, for reference.

The other problem I have is that our bucket names are most often hard-coded in the DB. So, it would be a large lift (and fairly risky) to go through our codebase and attempt to move all of our bucket names to env variables.

The solution I figured would be easiest is to have two different couchbase containers - one for dev and one for test - and just point our test env at the test cluster and otherwise each cluster (dev and test) could be entirely identical. I’ve been trying to accomplish this with HAProxy, but having a lot of issues. It seems like there’s something about it that Couchbase doesn’t like.

My idea was to use HAProxy to have something like “localhost/dev” and “localhost/test”. However, whenever I attempt to set that up, couchbase issues a 404. If I set up HAProxy to forward traffic directly to one of the servers, that seems to work though.

So, I guess I have a few questions.

  1. What is the ‘right’ way to do this? Should we just be doing this with buckets, and the fact that our buckets are hardcoded is a problem?
  2. Does anyone know what might be going on with HAProxy that couchbase doesn’t like?

Edit: Oh, one additional note. Our first thought was to just expose all the necessary ports and remap them, avoiding HAProxy altogether. It seems like there are some ports that are searched for by either phoning home or the RubySDK though, and so they only work for one container. Remapping those ports just causes errors.

and just point our test env at the test cluster and otherwise each cluster (dev and test) could be entirely identical. I’ve been trying to accomplish this with HAProxy
My idea was to use HAProxy to have something like “localhost/dev” and “localhost/test”.

Instead of a proxy mapping localhost/test and localhost/dev, why not just define in your DNS cbserver_test and cbserver_dev?

When using a proxy to server to serve couchbase servers, the couchbase servers will need alternate addresses configured to provide the proxy(s) to use. See ‘nodes’ in http://localhost:8091/pools/default for what the couchbase clients use to connect to couchbase services.