Hi,
I am totally new to Couchbase but have to take over an application that includes both a mobile client and a web client. The app uses outdated Couchbase server (couchbase-server-enterprise_4.5.0) and sync gateway (sync-gateway-enterprise_1.4.0-2) software. The previous owner of the project is no longer reachable, and did not have any documentation whatsoever, so I have had to learn everything myself.
So, I want to update the server and sync gateway software to the latest releases, specifically server 6.0.x and sync gateway 2.6. One big issue I face is the bucket shadowing feature has been deprecated, and I do not fully understand the Mobile-Web Data Sync migration instructions here https://docs.couchbase.com/sync-gateway/current/shared-bucket-access.html#migrating-from-bucket-shadowing. Specifically, I am not sure which of my buckets correspond to bucket 1 and bucket 2 in the instructions.
I will describe below my current understanding of the my app, and then hopefully you can help me map it to the instructions.
I really really appreciate any help at all! Thanks!
- I see from the Couchbase admin interface that the app has two buckets: the
my_app
bucket and thesync_gateway
bucket. - The web client is a rails application that talks to the Couchbase server on port 8091. Here’s the config snippet:
common: &common
hostname: localhost
port: 8091
...
pool: default
production:
<<: *common
bucket: my_app
I believe that means that the web client talks to the Couchbase server directly without going through the sync gateway.
- The Android client does this:
import com.couchbase.lite.Database;
import com.couchbase.lite.replicator.Replication;
import com.couchbase.lite.Manager;
...
Database database = manager.getDatabase("sync-gateway"); // yes, it's "-" not "_" between sync and gateway
URL sync_url = new URL("http://<hostname>:4984/my_app/");
Replication PULL_replication = database.createPullReplication(sync_url);
Replication PUSH_replication = database.createPushReplication(sync_url);
And the sync gateway has configuration sync_gateway.json like this (only showing relevant bits):
{
"interface":":4984",
"databases": {
"my_app": {
"server":"http://localhost:8091",
"bucket":"sync_gateway",
"shadow": {
"server":"http://localhost:8091",
"bucket":"my_app"
}
}
}
}
- It seems that the sync is not happening/configured properly, because in the backup dump of the database, I see the sync_gateway bucket is 40 times larger than the my_app bucket:
$ du -hs bucket-sync_gateway bucket-my_app
422M bucket-sync_gateway
9.8M bucket-my_app
$
The Android app does store photos into the database, so it looks like all the photos and data written by the mobile clients go into the sync_gateway bucket without being synced to the my_app bucket?