Select Page

Couchbase Mobile Stack

Introduction

In this fourth post about the Couchbase Mobile stack, we’ll go over installing Sync Gateway. Look for other posts in my “Getting Comfortable with Couchbase Mobile” series to learn everything you need to get the whole Couchbase Mobile stack up and running on your development machine.

Background

To get comfortable with the whole stack, it’s great to install and run everything on one machine. In this series of posts, I’ll walk through the steps get to started with each component. I’ll show how to do a little extra exploring along the way, too.

I’ll only do minimal configuration. This is not intended to explain what you need for a production environment. I assume you’re familiar with some basics of NoSQL, have some understanding of Couchbase, and know how to build apps in something like Java, Android, or iOS. If you want to read up on NoSQL databases or Couchbase, you can find lots of resources on the Couchbase site.

Couchbase is open-source. Everything I’ll use here is free to try out. See the end of the post for more resources if you need help.

Sync Gateway

Sync Gateway is a secure web gateway application with synchronization, REST, stream, batch and event APIs for accessing and synchronizing data over the web. Sync Gateway enables, among other things, secure data replication between Couchbase Server and Couchbase Lite.

Sync Gateway has few dependencies, and can run on most Linux distributions (even on the Raspberry Pi), Windows, and OSX/macOS. The specific steps for installation vary with platform. See the downloads site for all the available packages, and the full installation guide for complete details. To install on Linux distributions other than the supported ones, see this post.

I will walk through a simplified installation on OSX next.

OSX

Initial Installation Steps

To install Sync Gateway, first download the gzipped tar file for Mac here. You’ll get a file named something like couchbase-sync-gateway-enterprise_1.3.1.1-1_x86_64.tar.gz.

Unpack the archive, either by double-clicking on the file in Finder, or, from the command line, using the following:

This creates a number of files. We’ll only be concerned with the sync_gateway binary and the example configuration files.

Open a command line shell (e.g. Terminal). Change your working directory to the location where you unpacked the archive. In my case, I put them under my home directory in workspace/servers/couchbase-sync-gateway.

Start Sync Gateway running using one of the example configuration files.

You should see output that looks something like this:

That’s all it takes to get Sync Gateway up and going. The example configuration file I used here has the settings you need to use the other examples I will give in this and the related blogs.

Checking Your Installation

To verify Sync Gateway is running, you can do a couple of things.
From the command line, use curl to check the welcome message as follows:

You should see output that looks something like this:

Access the administrative interface by navigating in a browser to http://localhost:4985/_admin/.

You’ll see this top level page:

Sync Gateway Admin Welcome

If you click on db under the database list, you’ll see this page:
Sync Gateway Admin Database View
The links here will allow you to see quite a lot of interesting information while Sync Gateway is running. We’ll explore more when we look at the full stack operating together.

Useful Links

Finally, here are some other pages to explore to find out more about Sync Gateway.

https://developer.couchbase.com/documentation/mobile/current/installation/sync-gateway/index.html

https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/index.html

https://developer.couchbase.com/documentation/mobile/current/references/sync-gateway/rest-common/index.html

https://github.com/couchbase/sync_gateway/wiki

Next Steps

In the next post in this series I’ll show some ways to work with Sync Gateway from the command line. This will help both under how Sync Gateway works, and give you some tools for diagnosing common problems and mistakes. Then we’ll look at a sample app using Couchbase Lite. Finally, we’ll use that sample app to loop back and see how everything ties together.

This post originally appeared on http://blog.couchbase.com/.

Share This