Error processing DCP stream

Hi I’m running SG 2.7 on localhost and Couchbase CE 6.5 on a remote server (deployed using docker). Below is my config settings:

{
  "log": ["*"],
  "CORS": {
    "Origin": [
      "http://localhost:1234",
      "http://localhost:4200",
      "http://localhost:4300"
    ],
    "LoginOrigin": [
      "http://localhost:1234",
      "http://localhost:4200",
      "http://localhost:4300"
    ],
    "Headers": ["Content-Type", "Authorization"]
  },
  "databases": {
    "fs_db_v0": {
      "server": "http://159.203.117.96:8091/",
      "bucket": "fs-bucket-v0",
      "username": "bucket_user",
      "password": "password",
      "enable_shared_bucket_access": true,
      "import_docs": true,
      "num_index_replicas": 0,
      "sync": "function(doc, oldDoc) {\n  if (doc.replRole) {\n    requireRole('replicator');\n    if (doc.replRole !== 'replicator') {\n      requireRole(doc.replRole);\n      channel(doc.replRole);\n      if (doc.channels && doc.channels.length) {\n        doc.channels.each(function(channel) {\n          channel(doc.replRole + '_' + channel);\n        });\n      }\n    }\n  } else {\n    requireRole('sync_daemon');\n    channel(doc.channels);\n  }\n}",
      "users": {
        "test": {
          "password": "password",
          "admin_channels": ["repayments_2404_260_159"]
        },
        "sync_daemon_user": {
          "password": "password",
          "admin_roles": ["sync_daemon"],
          "admin_channels": ["*"]
        }
      }
    }
  }
}

I am however getting the following warning in the SG Logs

2020-05-20T13:18:56.745+02:00 [WRN] Error processing DCP stream - will attempt to restart/reconnect if appropriate: worker connect, server: 172.17.0.2:11210, err: dial tcp 172.17.0.2:11210: connect: operation timed out. -- base.(*DCPReceiver).OnError() at dcp_feed.go:134

I believe this is preventing changes made by the SDK to be propagated into Sync Gateway and I cannot see and documents via the /_all_docs endpoint or even the /_changes endpoint.

I need helping with networking Sync Gateway to the correct tcp service in the docker container running Couchbase Server.

Any reason your sync gateway and couchbase server are not co-located in same data center. And any reason you want your database server directly exposed over public network ?

In general, when you use docker you would deploy Sync Gateway and Couchbase Server continuers on same docker network. Otherwise you need to figure out a way to expose the service to clients outside your container and in your case, outside of localhost …

You can consider have a reverse proxy or load balancer in front of the server that Sync Gateway can then connect to…

Let me try to deploy Sync Gateway and Couchbase Server in the same docker network.

We use a Managed Couchbase Server for the whole organization, so it might not be possible to deploy Sync Gateway on that Server for every application we will need a SG for.

How would you advise I deploy the Couchbase Server other that making it publicly available over a network? To use a VPN? Should I not expose its port outside the docker network? If I do this, will it be possible for me to still login the Admin Portal?

Regards

Refer to this blog as a staring point. It’s for a dev localhost environment but you could translate it to a cloud environment. That said, I would recommend that you discuss the security implications with your network infrastructure /security team.

Also, have you considered using a container orchestration engine like kubernetes for managing all of this ? That would probably be the preferred approach instead of manually setting up docker networks etc