difficulty connecting to cloud/capella
https://couchbase.slack.com/archives/CC6GX1CJJ/p1647340570657629
https://issues.couchbase.com/browse/JCBC-1923
solutions is:
the configureEnvironment() method in the configuration class needs to be overridden and enable TLS and specify the trustcertificate.
@Override
protected void configureEnvironment(final ClusterEnvironment.Builder builder) {
builder.securityConfig().enableTls(true).trustCertificate(Paths.get("/tmp/capella.pem"));
}
Otherwise what happens is that spring data uses a default environment - which has enableTls=false and no trustCertificate. I understand there there could be an expectation that specifying a connnection string with the certpath. couchbases://cb.gqfypprux6vrjwqm.cloud.couchbase.com?certpath=/tmp/capella.pem While that will work if no environment is set on the clusterOptions, spring-data-couchbase provides a default environment, thus the solution to set enableTls and trustCertificate on that environment. See https://issues.couchbase.com/browse/JCBC-1923 When I test this in my environment, it times out accessing the KV SSL port - which is expected : 2022-03-15 11:45:40,084 WARN com.couchbase.endpoint: 567 - [com.couchbase.endpoint][EndpointConnectionFailedEvent][10s] Connect attempt 1 failed because of TimeoutException: Did not observe any item or terminal signal within 10000ms in ‘source(MonoDefer)’ (and no fallback has been configured) {“circuitBreaker”:“DISABLED”,“coreId”:“0x2ccea4b800000003”,“remote”:“lkvya1cmvtjajvj3.gqfypprux6vrjwqm.cloud.couchbase.com:11207”,“type”:“KV”} (edited)
The trustCertificate no longer needs to be supplied - the Couchbase Java SDK provides it automatically. Just the enableTls(true) is required.
I've added a Capella example in the test directory. This should get moved to spring-data-testapp module.