Progressing investigation in https://github.com/david-martin/CouchbaseTest. WIll update this comment with more info as I go along. The majority of below is based on what I disovered while using the Android SDK.
h2. Licensing of components
* Apache-2.0 - https://github.com/couchbase/couchbase-lite-android * Apache-2.0 - https://github.com/couchbase/couchbase-lite-ios * MIT - https://github.com/couchbase/couchbase-lite-net * Apache-2.0 - https://github.com/couchbase/sync_gateway
More repos: https://github.com/couchbase
Info on differences between 'Enterprise' & 'Community' https://www.couchbase.com/products/editions
h2. Mobile API
API documentation https://developer.couchbase.com/documentation/mobile/1.5/references/couchbase-lite/couchbase-lite/index.html
The API looks to be the same across SDK platforms. A `Manager` is used to create/access a `Database` on device. You can create/modify a `Document` in the `Database`. You can get a `View` of a set of `Documents` based on a `Query`. A `Replication` can be setup to push and pull `Database` changes to the Sync Gateway. An `Authenticator` can be configured for auth when doing replication.
h2. Mobile platforms
* Android - https://github.com/couchbase/couchbase-lite-android * iOS - https://github.com/couchbase/couchbase-lite-ios * .NET - https://github.com/couchbase/couchbase-lite-net
h2. Syncing mechanism to a remote database & other mobile apps
The `Repliation` class is responsible for replicating/syncing data between a local & remote `Database`. https://developer.couchbase.com/documentation/mobile/1.5/references/couchbase-lite/couchbase-lite/replication/replication/index.html Mobile Apps talk to the Sync Gateway, which notifies any interested connected clients of changes to `Documents`. This is done in realtime i.e. Realtime Sync.
h2. Offline capability
The Mobile SDKs include/allow access to a lightweight database (sqlite or forestdb). The developer has full access to this database while offline. The database gets 'replicated' to/from the sync gateway by creating a Push & Pull Replication instance.
h2. Conflicts
There's documentation on how to programatically list conflicts and ways to resolve them https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/resolving-conflicts/index.html https://developer.couchbase.com/documentation/mobile/current/guides/couchbase-lite/native-api/document/index.html#document-conflict-faq
For the server, it seems possible to have automated timestamp based conflict resolution. https://developer.couchbase.com/documentation/server/current/xdcr/xdcr-timestamp-based-conflict-resolution.html
h2. Authentication & Authorisation (e.g. OIDC integration)
The Sync Gateway has the ability to manage users & permissions.
It is also possible to integrate with an external OIDC provider. https://developer.couchbase.com/documentation/mobile/1.5/guides/authentication/openid/index.html
Couchbase docs has general info on OIDC and examples with cloud providers. As part of investigation, the sample Android App has Keycloak working for authentication https://github.com/david-martin/CouchbaseTest.
For dynamic authorisation, there is a 'sync function' that can be defined. https://developer.couchbase.com/documentation/mobile/1.5/guides/sync-gateway/sync-function-api-guide/index.html "The sync function is the core API you interact with on Sync Gateway. For simple applications it might be the only server-side code you need to write. For more complex applications it is still a primary touchpoint for managing data routing and access control."
I don't fully understand the scope of what can be done with the sync function. There is also scope for an app server sitting in front of the sync gateway (as a proxy) to provide authentication. More info at https://developer.couchbase.com/documentation/mobile/1.5/guides/authentication/custom-authentication/index.html. Again, I'm not sure how much is possible this way. For example, is it possible to define 'middleware' in your own server that could check keycloak roles of the user to see if they are authorised to access/modify certain data.
(Possibly needs a spike to see whats possible around custom authorisation)
h2. Compatibility with Kubernetes/OpenShift
Docker images compatible with OpenShift were created as a result of a partnership with Couchbase. This was demoed in Red Hat Summit 2017. Kubernetes templates are also available from this demo.
* https://www.youtube.com/watch?v=fxox6DD96HQ * https://github.com/couchbase-partners/redhat-openshift * https://github.com/couchbase-partners/couchbase-kubernetes-openshift
I haven't tried this out. However, it might be a good way to proceed i.e. try create an APB that uses these images & templates, and allows couchbase-lite-android to hook up to it.
This could be extended, if successful, to try use the mobile cli & mobile-config.json along with the Aerogear Android Core SDK to hook up automatically to what the APB provisions.
It could be extended further to add authentication to the App leveraging Keycloak. This would involve updating the sync gateway's sync-config.json file to add keycloak client/secret details when keycloak and couchbase are bound. |
|