Any Docker Cloud experts able to help me with my Couchbase stackfile?

I’m quite new to docker cloud and devops. I’m trying to put a stackfile for a couchbase server + sync gateway app. I’ve left the other pieces out for now like the frontend and nodejs backend. All I want to focus on here is having a working couchbase setup that can scale when I slide the node cluster scale up and down for the “database” tagged cluster.

This what I have so far…

lb:
  deployment_strategy: every_node
  image: dockercloud/haproxy:latest
  links:
    - syncgateway
  ports:
    - "80:80"
    - "443:443"
  roles:
    - global
  restart: always
  tags:
    - loadbalancer
syncgateway:
  deployment_strategy: every_node
  image: couchbase/sync-gateway:1.3.1-community
  volumes:
    - /tmp:/tmp/config
  links:
    - couchbase
  net: host
  restart: always
  tags:
    - database
couchbase:
  deployment_strategy: every_node
  image: couchbase/server:community-4.1.0
  volumes:
    - /opt/couchbase/var
  net: host
  restart: always
  tags:
    - database

So a couple of things…

Current I’ve three “database” tagged nodes in my database cluster.

I’m running one couchbase server and one sync gateway container per node.

I’ve just added “volume” params and am not actually using these yet to pass in a sync config for example. I would like to find out the best way to do this. I imagine I might need to create another image with the sync file in it and use that as a volume. Adding command: ‘https://git.io/someShortUrlToSyncGist’ to my sync gatework service in my stackfile works.

If so, is it okay to have the database server field in the sync gateway config just as localhost? I imagine I’d need to do this do it could be re-used by each container? Looks like using localhost works, I tried using http://couchbase:8091 as that’s the name of my service, but that didn’t seem to work.

For now I’m trying to have the load balancer’s port 80 proxy sync gateways public port 4984, but this isn’t working yet.

When I visit the couchbase admin and setup a new cluster / db for the first time, I had hoped to see the other couchbase server nodes already listed in the Server Nodes section, rebalancing etc. They aren’t listed. Does this mean they would need to manually be added after scaling the cluster?

Thanks in advance for any tips…

Maybe this blog might help, it’s using tutum cloud (now docker cloud). The stack file I used was http://jamiltz.github.io/2015-10-23-continuously-deploy-couchbase-mobile-stack-with-docker-tutum/#adding-a-production-node:f0e2887ecad1652989dc1588678f7b64

James

This blog needs some updating though so not everything may still be relevant.

Regarding the addition of Couchbase Server nodes to the cluster you’ll need to run two commands, one to init the node (cluster-init command) and to add a node to the cluster (node-add command). You might need one to start the rebalance too. The Couchbase Server CLI documentation have this information and example.

James

@jamiltz Thanks for the link and the information. Yeah I read your post recently which I found interesting. You mention in your post about accessing the terminal tab to open a new session in the cb container to then run the cluster-init step manually. I wonder if this and the node-add steps could be done automatically via the docker cloud stackfile? I guess I could create my own images that add this. I imagine I need a couchbase-master service and a couchbase-slave service of some sort, one where the slaves wait for the master to setup the initial cluster, and add themselves in sequence, and the final one calls rebalance or it’s called after each node addition. I’m just guessing here… I’ll have to experiment. This is my current stackfile which has changed slightly since my original post. Do you know if I should have net: host in both the couchbase and sync gateway services? Anything there look wrong so far?

couchbase:
  deployment_strategy: high_availability
  image: 'couchbase/server:community-4.1.0'
  net: host
  ports:
    - '8091:8091'
    - '8092:8092'
    - '8093:8093'
    - '8094:8094'
    - '11207:11207'
    - '11210:11210'
    - '11211:11211'
    - '18091:18091'
    - '18092:18092'
    - '18093:18093'
  restart: always
  tags:
    - database
  volumes:
    - /opt/couchbase/var
lb:
  deployment_strategy: every_node
  image: 'dockercloud/haproxy:latest'
  links:
    - syncgateway
  ports:
    - '80:80'
    - '443:443'
  restart: always
  roles:
    - global
  tags:
    - loadbalancer
syncgateway:
  command: 'https://git.io/someUri'
  deployment_strategy: high_availability
  image: 'couchbase/sync-gateway:1.3.1-community'
  links:
    - couchbase
  net: host
  ports:
    - '4984:4984'
  restart: always
  tags:
    - database
  volumes:
    - '/tmp:/tmp/config'