Public Repository

Last pushed: 7 months ago
Short Description
Single Line Web Server for Raspberry Pi / Raspi
Full Description

Single Line Web Server for Raspi

  • super small microservice that is implemented as a single line web server
  • the clever server returns its own hostname and a version number (which is set to 1)
  • the server consists of two files
    • the server itself: command.sh

      #!/bin/sh
      while true; do { printf 'HTTP/1.1 200 OK\r\n\r\n'; sh response.template; } | nc -l -v -p 8888; done

    • a file response.template for the reply.

      #!/bin/sh
      printf "{ hostname: $(hostname) , version: 1 } \n"

what is it good for?

Try load balancing over this container and you should see different host names.
Also try rolling updates with a different version number in response template!

Feel free to use and modify this little example but reference this site. @frankmunz

Docker Pull Command
Owner
fmunz

Comments (0)