Deploy a RethinkDB server on Azure in 15 minutes, or less

Recently, I was looking for a RethinkDB hosting service for a new startup project we are building. The project will help startups building on Meteor to setup business analytics with close to zero configuration, allowing them to monitor and understand the metrics for growth.

I thought this would also be a good chance to try something new, so I started looking into Azure. After completing the deployment, I felt compelled to share how easy and seamless the experience was.

In this post, I am going to walk you through deploying RethinkDB on a single Azure instance. It takes 15 minutes, or less.

  1. Head to https://portal.azure.com

2. On the left menu panel, select “Browse” and search for “Marketplace”

3. Now, in marketplace, search for RethinkDB

4. There you go! Now, let’s set it up, click on it, then, when prompted, click create.

5. Setting up the VM is just 4 simple steps. Let’s first set up the basics, you will need to choose a name of the service, enter your password, choose a resource group, which groups multiple resources to a group within Azure, and, lastly, choose a location for your service, pick somewhere close to your main server. Hit “Select”.

6. Then you will need to pick the size of the VM. For the purpose of illustration, let’s pick something relatively small.

7. For Step 3, we will stick with most of the defaults, except I have also picked “Remote access enabled” under Docker, so you will be able to access the VM through a remote client in the future.

8. Step 4, review the details and click OK to deploy! Now if you click on “Virtual Machines” from the left navigation panel of Azure, you will see that your app is deploying.

9. Give it around 5 mintues, the status of your VM will change from “Updating” to “Running”. You are still not done yet, for the server to be accessible from a remote client, you will need to configure a few network settings.

First of all, I will configure a custom domain name, so the server is easier to access. Go back to the screen in Step 8, click on your VM. Click ono the link under “Public IP address/DNS name label”.

10. Select “Configuration” and pick a custom DNS name label. You will then be able to use this domain name to access your VM. Remeber this domain name, you will need it in Step 15.

11. With that out of the way, I will then open up the ports that is required to access RethinkDB in the VM.

Go back to the screen in Step 8, click on your VM. And in the dashboard you see, click “All settings”. Under settings, select “Network Interface”

12. Click on the name of the first name in the “Network Interface” panel, and select the link under “Network security group”.

13. Then, select “Inbound security rules” under settings for your Network security group.

14. Follow the below configurations and setup the ports. The below are not the most secured settings, but will do for the purpose of development. You should definitely consider applying tighter security rules for deploying to production servers.

15. Now, let’s try to write a simple script to connect to the server with NodeJS. First, install rethinkdbdash on your terminal with npm install rethinkdbdash. Remember I asked you to jot down the domain name in Step 10? Replace the host name with your domain name, and execute the below script to create an “authors” table under the “test” database.

var r = require('rethinkdbdash')();

var connection;

r.connect( {host: 'xxxx.westus.cloudapp.azure.com', port: 28015}, function(err, conn) {
if (err) throw err;
connection = conn;

r.db('test').tableCreate('authors').run(connection, function (err, result) {
if (err) throw err;
console.log(JSON.stringify(result, null, 2));
})
})

16. Finally go to http://xxxx.westus.cloudapp.azure.com:8080 (replace xxx with your named DNS), click on “Tables” on the navigation bar and see if you can find the “authors” table.

You are done!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.