Skip to content

EngineerBetter/stateful-k8s-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stateful-k8s-app

A containerised stateful application for use in the Kubernetes for Cloud Foundry course.

It has been pushed to Dockerhub and can be pulled at engineerbetter/stateful-app.

Stateful app using a Redis

Usage

Without Redis

When deployed without a Redis, the stateful-app utilises Sinatra's sessions, storing information in the app's memory.

With Redis

When deployed to a Kubernetes Cluster where a Redis instance can be detected, the application, upon starting, will use the Redis to store state.

How does this work you ask? When and service is deployed to a Kubernetes cluster, a series of environment variables are set to enable service discovery. The stateful-app uses one of these (REDIS_MASTER_SERVICE_HOST) to determine whether to use a deployed Redis.

Running Locally

$ git clone [email protected]:EngineerBetter/stateful-k8s-app.git
$ rackup

Visit the application at localhost:9292

Running on Docker

$ git clone [email protected]:EngineerBetter/stateful-k8s-app.git
$ docker build -t engineerbetter/stateful-app .

# Get the image of the recently built image
$ docker images

# Run the image and expose it on port 9292
$ docker run -p 9292:9292 <IMAGE ID>

Visit the app at 0.0.0.0:9292

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •