RethinkDB reseted after any change is commited

Posted April 28, 2015 2.6k views

Hi, I am having a problem using Dokku and Node.js with RethinkDB. Every time I make a commit of my Node project, the db container IP changes and I lose all the data and the tables and everything.
Can you help me to figure out why is this happening and how to solve it?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Is your rethinkDB container part of your project and managed by Dokku, or did you deploy it manually? If the container is managed by Dokku, it’s possible that Dokku destroys and recreates the container every time you push new commits to Dokku. You’d have to check the logs to make sure if this was the case.

This is actually normal behaviour for Dokku. Containers are supposed to work so that you can despose and recreate them and everything still works. However, making containers behave like this requires some thought, especially in the case of DB containers which need to persist their data. To make sure your database data is preserved even if the DB container is destroyed, you need to use data volumes. Making sure that your node.js project can find your DB container even if the IP address changes requires you to link the containers together and use environmental data rather than hard-coded addresses in your project. You can also go one step further and use some form of service discovery, but that may be overkill for a small-scale project.