gorry-server

command module
v0.0.0-...-37f65d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2017 License: MIT Imports: 8 Imported by: 0

README

gorry-server

At some point all your backend servers might go down. Maybe your whole infra goes down, except for your load balancers. Incoming requests cannot be served as there are no servers in the host pool.

While the infra recovers, or if you are in the unfortunate position of recovering things manually, you might want to show a static web page to all frontend requests. There are many ways to achieve this:

  • Have a readily available pool of hosts capable of serving static content, in a separate infra. Running hosts all the time for this purpose is just an unnecessary cost.
  • Spin up new hosts or pods, which run a webserver such as Nginx. Use Terraform, Ansible, Kubernetes or $whatever to do this.
  • Configure a web server manually somewhere.

In any case you still have to configure and optimize your webservers and glue them into your load balancers.

Or you can just use this repo, add a single HTML file and build yourself a container! Dockerhub images available too.

Building

Build the container by running docker build -t my-gorry-server .

You can compile a static binary too just by running go build

Running

Run the pre-baked Docker image from Dockerhub by mounting a local HTML file to the container. Example:

$ docker run --rm -d \
-v /var/www/html/emergency.html:/go/src/app/index.html
vtorhonen/gorry-server

Container uses /go/bin/app as the entrypoint. Define a custom entrypoint to swim inside.

$ docker run --rm -it --entrypoint /bin/bash vtorhonen/gorry-server

Run gorry-server -h to print out the help message.

$ gorry-server -h
This program returns a given document to all incoming HTTP requests.
usage: app [--file FILE] [--port PORT] [--debug]

options:
  --file FILE, -f FILE   Path to our index file. [default: index.html]
  --port PORT, -p PORT   Listen port. Enabled on all interfaces. [default: 8080]
  --debug, -D            Enable debug logging
  --help, -h             display this help and exit

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL