Setup RavenDB 4.0 Cluster using Ubuntu on Digital Ocean

Today I have built a RavenDB 4.0 cluster that spanned over 3 machines. This post is to document the process needed to build and secure the cluster on Ubuntu 16.x using Digital Ocean droplets with custom SSL certificates.

This is a completely manual process from creating the user, setting ravendb settings.json and setting LetsEncrypt certificates.

Getting Ready

Digital Ocean Droplets

Let’s start by creating 3 droplets with the following spec:

Ubuntu 16.x operating system

2GB Ram, 1 vCPU, 50GB SSD

You can choose to increase the specs as you require. However, for RavenDB community, license 3 vCPU are included in the community license. Any more are not available unless you have a paid license. https://ravendb.net/buy

SSL Certificates

For this demo, we will be using LetsEncrypt ssl certificate for each of the nodes in the cluster.

However, you could use your own paid wildcard ssl certificates without any change in the process outlined here.

If you are not using a wildcard certificate, you will need to obtain a certificate for each ravendb node you have in the cluster. You are required to have an active and valid domain name for this process.

Go through this process of validating the sub-domain names and downloading the certificate files.

Once you downloaded the certificates, you must generate a PFX file to be able to use the certificates with RavenDB.

Use openssl to generate the PFX file. On windows 10, run “bash” to get a bash command line, which have openssl already installed.

Navigate to the location of the extracted certificates. I placed mine somewhere easy and simple to get to “c:\temp\certs”

Make sure to change the sub-domain, certificate file name and password based on what you have specified

This script will prepare your environment, download ravendb linux packages (currently version RavenDB-4.0.3-patch-40033-linux-x64 *at the time of writing*) and configure ravendb settings with the correct certificate details and data folder location.

After the scripts completes successfully, make sure to add your FQDN/sub-domain in hosts file so ravendb service can bind to the correct domain.

cmd> echo “128.199.224.104 db01.sarmaad.com” >> /etc/hosts

Change the IP address and sub-domain to match your droplet!

Then start ravendb service by executing:

cmd> systemctl start ravendb

Check the logs to make sure the service started correctly and without any issue:

cmd> tail /var/log/syslog

You are looking for ravendb service started and listening for requests.

This is what you are looking for in the logs for a successful ravendb service installation/running

Step 4 – Test the Node

Type in the sub-domain directly in your browser and test that the browser prompting for client certificate. If you are prompted, then you have successfully installed a ravendb node.

If you have installed the certificate in your system, choose the certificate from the list and access the node.

Repeat these steps in all nodes updating the sub-domain, certificate and ip address.

Cluster Configuration

Now that we have the 3 nodes up and running (db01, db02 and db03) we are going to login to db01 and start the cluster formation.