GithubHelp home page GithubHelp logo

95rade / delmo-rails-pg-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from starkandwayne-attic/delmo-rails-pg-demo

0.0 1.0 0.0 220 KB

This repository is for a demonstration of Delmo

Home Page: https://github.com/bodymindarts/delmo

delmo-rails-pg-demo's Introduction

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:

  • git checkout step-1 - the original basic Rails app that fails when PostgreSQL is not available
  • git checkout step-2 - Docker-ize the Rails app and reproduce the error within a docker-compose environment
  • git checkout step-3 - Delmo test suite to show a failing test
  • git checkout step-4 - Rails app fixed to handle the PG::ConnectionBad error and show a static page (not the 500 error page).

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

Get started:

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

delmo-rails-pg-demo's People

Contributors

drnic avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.