Sync Gateway 2.1
Manual
In this lesson, you will install and launch version 2.1 of the Sync Gateway
If you would prefer to use a docker container instead, please proceed to the docker section
-
Install Sync Gateway 2.1 following the instructions specified here. Make sure you select "Windows" from the list of platform tabs to install on.
-
By default, the Sync Gateway service will install with serviceconfig.json config file at this location
-
The Sync Gateway will have to be launched with the config file named
sync-gateway-config-travelsample.jsonthat you should have downloaded as part of the Travel Mobile App install. The config file will be located inc:/path/to/mobile-travel-sample. -
Open the sync-gateway-config-travelsample.json and confirm that the RBAC user credentials configured on the Couchbase Server are used by Sync Gateway for accessing the bucket
"username": "admin", "password": "password", -
Stop the Sync Gateway service (since it was launched with the default version of config file). To stop the service, you can use the Services application (Control Panel -→ Admin Tools -→ Services).
-
Replace the serviceconfig.json file located at C:FilesGateway with the sync-gateway-config-travelsample.json that you downloaded.
$ copy c:/path/to/mobile-travel-sample/sync-gateway-config-travelsample.json "C:\Program Files\Couchbase\Sync Gateway\serviceconfig.json" -
Start the Sync Gateway service with the new version of serviceconfig.json file. To start the service, you can use the Services application (Control Panel -→ Admin Tools -→ Services).
Try it out
-
Access this URL
http://localhost:4984in your browser -
Verify that you get back a JSON response similar to one below
{"couchdb":"Welcome","vendor":{"name":"Couchbase Sync Gateway","version":"2.1"},"version":"Couchbase Sync Gateway/2.1.0(775;9cc29c5)"}=
Docker (Local)
NOTE : If you are running the Sync Gateway in a docker container, please make sure that you have the Couchbase Server running in a container as well. If not, please follow instructions here to install the server container.
-
Create a local docker network named "workshop" if one does not exist already. Open a terminal window and run the following command
bash $ docker network ls $ docker network create -d bridge workshop -
To run the application in a container, you will first get the docker image from Docker Cloud.
bash $ docker pull connectsv/sync-gateway:2.1.0-enterprise -
The Sync Gateway will be launched with the config file named
sync-gateway-config-travelsample.jsonthat you should have downloaded as part of the Travel Mobile App install. The config file is located in/path/to/mobile-travel-sample. -
Open the
sync-gateway-config-travelsample.jsonfile -
For the app to connect to the Couchbase Server, the address of the the server needs to be specified. Note that when you launched the Couchbase Server docker container, you gave it the
nameof "cb-server". Replace thelocalhostin the file withcb-serverand save
json "server": "http://cb-server:8091"
-
Launch the Sync Gateway with the
sync-gateway-config-travelsample.jsonfile. Once the command has completed you can start the application with the following.
$ docker run -p 4984-4985:4984-4985 --network workshop --name sync-gateway -d -v %cd%/sync-gateway-config-travelsample.json:/etc/sync_gateway/sync_gateway.json connectsv/sync-gateway:2.1.0-enterprise -adminInterface :4985 /etc/sync_gateway/sync_gateway.json ``` The first time you run this on Windows, you may see an alert pop up asking for permissions to share drive.
Make sure you select "Share it" and proceed.
You would need administrator privileges for this image:https://raw.githubusercontent.com/couchbaselabs/mobile-travel-sample/master/content/assets/docker_windows.png[]
* You can view the logs at any time by running the following command `bash $ docker logs sync-gateway`
* Verify that the docker container named "sync-gateway" is running with the following command in the terminal window `bash $ docker ps`
[[_try_it_out]]
=== Try it out
* Access this URL `http://localhost:4984` in your browser
* Verify that you get back a JSON response similar to one below
+
[source,json]
----
{"couchdb":"Welcome","vendor":{"name":"Couchbase Sync Gateway","version":"2.1"},"version":"Couchbase Sync Gateway/2.1.0(775;9cc29c5)"}
----
=