starkandwayne/delmo-rails-pg-demo

Name: delmo-rails-pg-demo

Owner: Stark & Wayne

Description: This repository is for a demonstration of Delmo

Created: 2017-05-23 23:59:35.0

Updated: 2017-05-24 01:19:04.0

Pushed: 2017-05-24 01:18:37.0

Homepage: https://github.com/bodymindarts/delmo

Size: 220

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Demo of Delmo

This repository is for a demonstration of Delmo. Delmo was originally written to help us test the failover and disaster recovery modes of Dingo PostgreSQL clusters. It has subsequently been used to test Stark & Wayne Habitat plans for clustered services such as Redis, PostgreSQL, Consul and more.

The demo overview

In this repo is a Ruby on Rails app that uses PostgreSQL: a distributed system of two things. The web app requires the db database. But what is the right behavior if the db is missing? An ugly 500 status page for the user to see? Or can we put in some behavior within the app to specifically handle the db temporarily being unavailable (downtime, network partition, HA failover).

First step is to write a system test that runs the web and db components of the system, turns off the db and confirms that the web app fails horribly.

webapp-dev-500

The next step is to reproduce the problem in controlled environment that we can programmatically manipulate. Delmo uses docker-compose. In this production-esque environment, the Rails app shows a more cryptic error:

webapp-prod-500prod

Then we can fix the Rails app so that it does something useful whilst the database is missing - say display a static-only version of the site, without any dynamic interactive features. Whatever is useful to your users.

The third step is to write a failing test using Delmo - to programmatically deploy the application and its database, stop the database and show that the application fails, when we'd rather that it worked.

Finally, we will upgrade the application to work if the database is missing. Our Delmo test scenario will run and show that web app no longer fails when db is missing.

The system test will be run by Delmo, and the web and db components are containers within a docker-compose deployment that Delmo will manage.

Tutorial

This repo has four branches representing the four stages of the tutorial/demo:

The read me of each step will lead on to the next step/branch.

Get started:

clone https://github.com/starkandwayne/delmo-rails-pg-demo
elmo-rails-pg-demo
checkout step-1
README.md

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.