Skip to content

khanium/quickstart-sync-gateway

Repository files navigation

Quickstart for Sync Gateway Developer Kit (Docker Compose Quickstart)

A quick starting kit for developers deploying via Docker Compose the Sync Gateway +3.1.3 & Couchbase +7.2.3 cluster environment using Scope & Collections

overview

Pre-requisites

  • Docker Compose

Getting Starting (First Time you run it)

  1. Build SGW docker image
docker compose build

build

  1. Setup Docker Compose Couchbase Server & Sync Gateway Instances
docker-compose up

up

  1. Wait Until Buckets & Sync Gateway are ready

Sync Gateway listening in 4984

Wait until your Sync Gateway is available in the following link http://localhost:4984

Sync Gateway listening in 4984

Verify the Couchbase Server Admin Console with username: Administrator and password password on http://localhost:8091

Couchbase Console UI

Check the Couchbase Server demo bucket and custom scope with the three collections: typeA, typeB & typeC.

collections

Check the Couchbase Server User sync_gateway with mobile sync gateway role on demo bucket and metrics_user for prometheus metrics scrapping in Sync Gateway and Couchbase Server.

security

Note: This Sync Gateway configuration does not include TLS connections.

Verify Sync Gateway Database & Users

From your host CMD/terminal you can check the db database and userdb1 user creation:

curl http://localhost:4985/db/

Note: This database configuration has defined num_index_replicas: 0. Please change this parameter to the default value 1 when your Couchbase Server cluster contains at least 2 indexes service nodes.

In this example, we have setup a custom scope and collections typeA and typeB. Note: collection typeC is not synced with this Sync Gateway database.

curl http://localhost:4985/db/_config

Let´s verify the database users

curl http://localhost:4985/db/_user/

And the user userdb1 details info:

curl http://localhost:4985/db/_user/userdb1

Verify your Monitoring System

node exporter

prometheus

grafana dashboards

Let´s load the sync gateway dashboard...

grafana sync gateway

  1. Run your own Couchbase Mobile App
replication sgw url: ws://127.0.0.1:4984/db
replication scope: custom
replication collections: typeA,typeB
authenticator: 
	username: userdb1
    password: password 

Start / Stop Docker Compose

  1. Start docker compose
docker-compose up
  1. Stop docker compose

ctrl-c & then

docker-compose down
  1. Clean up logs & data from Couchbase Server mapped into localhost volume
./cleanup-data.sh

Configure Couchbase Server

-- TBD --

Buckets

Scope/Collections

Users

Configure Sync Gateway

-- TBD --

Database

Users

References

About

Developer quick start kit for deploying in Docker Compose Sync Gateway +3.1.3 Couchbase +7.2.3 using Scope & Collections

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published