Docker (Local)
Prerequisites
Windows Users : If you are developing on Windows, we recommend that you use a Windows 10 machine. Also, note that if you choose the Manual or Docker installation mode, you should also have administrative privileges on the Windows box so you can authorize the installation and running of the required executables.
-
Docker: downloadable from docker.com. Community edition would suffice.
Windows Users : If you are developing on Windows, you may need to install Docker as Admin user downloadable from docker.com. The Community Edition would suffice.
-
Microsoft Visual Studio 2017 (only Windows Users)
-
Git: downloadable from git-scm.org.
Try it out
-
Verify the docker installation (applicable only if you decided to use the Docker install option).
-
Run the following command from your terminal.
bash docker -v
You should see the version of docker displayed.
-
-
Verify git installation
-
Run the following command from your terminal.
bash git --version
You should see the version of git installed.
-
Workshop Repo
-
Clone the "master" branch of the workshop source from GitHub. We are doing a shallow pull with
depth
as 1 to speed the cloning process.git clone -b master --depth 1 https://github.com/couchbaselabs/mobile-travel-sample.git
Couchbase Server
-
Create a local docker network named "workshop" if one does not exist already. Open a terminal window and run the following command.
$ 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 Hub. Open a new terminal window and run the following.
$ docker pull couchbase/server-sandbox:6.5.0
-
Once the command has completed you can start the application with the following.
$ docker run -d --name cb-server --network workshop -p 8091-8094:8091-8094 -p 11210:11210 couchbase/server-sandbox:6.5.0
-
You can view the logs at any time by running the following command.
$ docker logs cb-server
-
It may take a few seconds for the server to startup. Verify that the docker image is running with following command.
$ docker ps
Sync Gateway
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 the instructions in Couchbase Server (above) 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.
$ 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.
$ docker pull couchbase/sync-gateway:2.7.3-enterprise
-
The Sync Gateway will have to be launched with the config file named
sync-gateway-config-travelsample.json
that you should have downloaded as part of the Workshop Repo step. The config file is located in/path/to/mobile-travel-sample
. -
Open the
sync-gateway-config-travelsample.json
file -
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
name
of "cb-server". Replacelocalhost
in the file withcb-server
and save."server": "couchbase://cb-server"
-
Launch the Sync Gateway with the
sync-gateway-config-travelsample.json
file.
Windows
cd /path/to/mobile-travel-sample/
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 couchbase/sync-gateway:2.7.0-enterprise -adminInterface :4985 /etc/sync_gateway/sync_gateway.json
Non-Windows platform
$ cd c:\path\to\mobile-travel-sample\
$ docker run -p 4984-4985:4984-4985 --network workshop --name sync-gateway -d -v `pwd`/sync-gateway-config-travelsample.json:/etc/sync_gateway/sync_gateway.json couchbase/sync-gateway:2.7.0-enterprise -adminInterface :4985 /etc/sync_gateway/sync_gateway.json
-
You can view the logs at any time by running the following command.
$ docker logs sync-gateway
-
Verify that the docker container named "sync-gateway" is running with the following command in the terminal window.
$ docker ps
Try it out
-
Access this URL
http://127.0.0.1:4984
in your browser -
Verify that you get back a JSON response similar to one below
{"couchdb":"Welcome","vendor":{"name":"Couchbase Sync Gateway","version":"2.7"},"version":"Couchbase Sync Gateway/2.7.0(271;bf3ddf6) EE"}
Python Travel Sample Web Backend
NOTE : If you are running the Web App in a docker container, please make sure that you have the Couchbase Server and Sync Gateway running in the same docker network as well. If not, please follow instructions in the Couchbase Server section to install the server container using docker and instructions in the Sync Gateway section to install sync gateway container.
-
Create a local docker network named "workshop" if one does not exist already. Open a terminal window and run the following command.
$ 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. Open a terminal window and run the following.
$ docker pull connectsv/try-cb-python-v2:6.5.0-server
-
Once the command has completed you can start the application with the following.
$ docker run -it -p 8080:8080 --network workshop connectsv/try-cb-python-v2:6.5.0-server
You should then see the following in the console output.
Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
Try it out
-
Open http://127.0.0.1:8080/ in your web browser.
-
Verify that you see the login screen of the Travel Sample Web App as shown below