Follow the steps below to create a Sync Gateway + Couchbase Server cluster running under AWS with the following architecture:
There is a youtube video (12 mins) which walks through this entire setup process, or you can follow the instructions below.
Kick off Couchbase Server + Sync Gateway cluster
Launch EC2 instances
Go to the Cloudformation Wizard
- ClusterSize: 3 nodes (default)
- Discovery URL: as it says, you need to grab a new token from https://discovery.etcd.io/new and paste it in the box.
- KeyPair: the name of the AWS keypair you want to use. If you haven’t already, you’ll want to upload your local ssh key into AWS and create a named keypair.
ssh into a CoreOS instance
Go to the AWS console under EC2 instances and find the public ip of one of your newly launched CoreOS instances.
Choose any one of them (it doesn’t matter which), and ssh into it as the core user with the cert provided in the previous step:
Let’s make sure the CoreOS cluster is healthy first:
This should return a list of machines in the cluster, like this:
1 2 3 4
Kick off cluster
From the CoreOS machine you ssh’d into in the previous step:
1 2 3 4
You’ll want to use your own config URL for the SG_CONFIG_URL value. For example, a file hosted in github or on your own webserver.
After the above script finishes, run
fleetctl list-units to list the services in your cluster, and you should see:
1 2 3 4 5 6 7
Find internal ip
On the CoreOS instance you are already ssh’d into, Use the ip found above and run a curl request against the server root:
Find external ip
Using the internal ip found above, go to the EC2 Instances section of the AWS console, and hunt around until you find the instance with that internal ip, and then get the public ip for that instance, eg:
From your laptop, use the ip found above and run a curl request against the server root:
Congratulations! You now have a Couchbase Server + Sync Gateway cluster running.
Appendix A: Kicking off more Sync Gateway nodes.
To launch two more Sync Gateway nodes, run the following command:
Appendix B: Setting up Elastic Load Balancer.
Setup an Elastic Load Balancer with the following settings:
Note that it forwards to port 4984.
Once the Load Balancer has been created, go to its configuration to get its DNS name:
Now you should be able to run curl against that: