Sign inSign up

briceburg/ping-pong

By briceburg

•Updated over 5 years ago

A simple Express app that responds to /ping with "pong" -- useful for debugging http services.

Image
1

50K+

briceburg/ping-pong repository overview

⁠ping-pong

ping-pong is a simple Express⁠ app that responds to /ping with "pong" -- useful for debugging http services.

⁠usage

⁠cli
docker run -p 7777:80 -it --rm briceburg/ping-pong

binds ping-pong to :7777 on localhost. ctrl-c to exit. test in a new terminal

~ curl localhost:7777/ping
pong
⁠docker-compose + nginx-proxy

I use ping-pong to test upstream load balancers like nginx-proxy⁠ and automatic LetsEncrypt⁠ SSL cert generation via the letsencrypt-nginx-proxy-companion⁠ container.

Here's an example v1 docker-compose.yml assuming nginx-proxy + letsencrypt companion are running on the docker host.

---
ping-pong:
  image: briceburg/ping-pong
  #ports:
    #- "7777:80"

  environment:

    # ROUTING (for nginx-proxy container)
    #####################################
    VIRTUAL_HOST: ssl-test.mydomain.net
    LETSENCRYPT_HOST: ssl-test.mydomain.net
    LETSENCRYPT_EMAIL: [email protected]
docker-compose up

⁠custom route handlers

As a convenience, the Express routes have been abstracted to an include file. This allows you to build an image based on briceburg/ping-pong with custom behavior. Here, we build an image based on the provided Dockerfile⁠ and routefile⁠ examples.

cd /path/to/ping-pong repo

docker build -t custom-ping-pong -f custom-Dockerfile .
docker run -it --rm -p 7777:80 custom-ping-pong

&& viola! a 204 is returned.

~ curl -I localhost:7777
HTTP/1.1 204 No Content
X-Powered-By: Express
Date: Tue, 05 Jul 2016 21:05:05 GMT
Connection: keep-alive

Tag summary

Content type

Image

Digest

Size

11.1 MB

Last updated

about 10 years ago

docker pull briceburg/ping-pong