Public | Automated Build

Last pushed: 10 months ago
Short Description
Simple Node.js service that sends a hello response
Full Description

appcelerator/pingerjs

Simple service for demo purposes. Responds with [<hostname>]helloto anyGET` request.
It's a slight variation on the canonical Node.js example.

Running pingerjs

$ docker run -it --rm -p 3000:3000 --name pingerjs appcelerator/pingerjs

or

$ docker service create -p 3000:3000 --name pingerjs appcelerator/pingerjs

Scaling pingerjs

Try scaling scaling pingerjs up

$ docker service scale pingerjs=3

Confirm all the replicas are running as the service scales to the desired amount

$ docker service 
$ docker service ls --filter name=pingerjs
ID            NAME      REPLICAS  IMAGE                  COMMAND
bfjh7nervm3z  pingerjs  3/3       appcelerator/pingerjs

Then test

$ curl localhost:3000/
[f0afaf6c5ea5] hello

Each time you curl, you should see a different hostname in the brackets of the response
as Docker automatically load balances requests among all the service replicas.

Note

Because HTTP/1.1 defaults to persistent connections, to see the same result for
demo purposes in the browser, the ping service closes the HTTP connection with each response
by setting Connection: close in the response header.

Development

bin/build.sh - builds an alpine-based image: appcelerator/pingerjs

bin/run.sh - convenience script for docker run ...

bin/service-start.sh - convenience script for docker service create ...

bin/service-stop.sh - convenience script for docker service rm ...

Docker Pull Command
Owner
appcelerator
Source Repository

Comments (0)