Adding a local RethinkDB database

Back To Blog

In this tutorial we will add a RethinkDB database in the db/ folder working in an opeNode instance. It is worth noting that it will consume at least 20 MB extra memory, so if you use for instance the smallest instance plan, it is recommended to increase your plan. Also, we use use an alpine-based docker image. You can enable RethinkDB by adding the following instructions in your Dockerfile:

RUN apk add rethinkdb
RUN echo 'mkdir -p db' >> /
RUN echo 'rethinkdb --bind all -d db/ --no-update-check &' >> /

Further, make sure to define a storage area so that it does not get deleted on updates (persistent):

openode add-storage-area db/

And also make sure to ignore that folder by creating an .openodeignore file with:


The Complete Dockerfile we used:

FROM node:10-alpine

WORKDIR /opt/app


RUN apk add rethinkdb
RUN echo 'mkdir -p db' >> /
RUN echo 'rethinkdb --bind all -d db/ --no-update-check &' >> /

RUN echo 'npm install --production' >> /

# npm start, make sure to have a start attribute in "scripts" in package.json
RUN echo 'sleep 3' >> /
CMD sh / && npm start

We tested it with a simple Node.js TODO application, please see this repository.

Added on Wed Dec 05 2018 01:00:40 GMT+0000 (Coordinated Universal Time)