Sign inSign up

thomasbjackson/simple-server

By thomasbjackson

•Updated about 11 years ago

Image
0

628

thomasbjackson/simple-server repository overview

⁠Simple-Server (a web app stub)

A Docker container that provides a simple web server that can be toggled between good and bad states.

In its good state it returns code 200. In bad, returns 500

Useful for testing load balancers and other network gear that route based on the state of a web server

Uses a redis DB to save current good/bad state

Toggles are requested via the /toggle uri

⁠Provision a Host

First start a redis container using the default port (latest version will do nicely)

`` sudo docker run -d --name redis redis:latest


Next, start the simple server and link to the redis server
The --link argument is formatted as <redis container name>:<resource name>

Per docker docs, the <resource name> provided will result in a bunch of environment variables in the simple-server container. Because we used <resource name>=redis, our simple-server container will include variables with a 'REDIS' prefix that describe stuff like the redis container IP address (which is different than the host IP), the ports exposed, etc. See config/simple-server.py to see how these are leveraged to read/write data to/from redis.

So, this launch ...

sudo docker run --name simple-server --link redis:redis -e "WELCOME_MESSAGE=Welcome weary traveller!" -t -p 80:8090 thomasbjackson/simple-server


Will yield us a simple-server container named "simple-server" listening on host port 80, and using the redis server to store up/down state.

## Provision a Host Behind a Proxy

Include environment variables in the docker run command (see commented out variable examples in Dockerfile)

Tag summary

Content type

Image

Digest

sha256:c75f77863…

Size

283.9 MB

Last updated

about 11 years ago

docker pull thomasbjackson/simple-server