GithubHelp home page GithubHelp logo

xperimental / goecho Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 46 KB

Simple echo service for testing (for example orchestrators)

Home Page: https://hub.docker.com/r/xperimental/goecho/

Shell 3.95% Go 91.60% Dockerfile 4.44%
hacktoberfest echo-handler testing-tool

goecho's Introduction

goecho

This is a simple HTTP server built in Go that suited us good in testing our orchestration so far. It will answer to every path and method and will echo information about the request back to the client.

Currently it has the following endpoints:

  • /metrics – prometheus metrics about the service
  • /version – Version information
  • /_ready - Readiness check
  • /* – Echo handler (will echo information about the request back)

The echo handler understands one query parameter: "env". When set to any non-zero-length value the response will also contain the environment variables set for the server.

Installation

For our purposes we typically use the Docker image, which can be found on Docker Hub:

docker run --rm --interactive --tty --publish 8080:8080 xperimental/goecho:$TAG

If you have Go installed it is also very simple to build the binary yourself:

git clone https://github.com/xperimental/goecho.git
cd goecho
go build

If you want to build the Docker image instead, download the sources and run the provided script:

git clone https://github.com/xperimental/goecho.git
cd goecho
./build.sh

The image will be called "xperimental/goecho" and have a tag based on the git repository ("latest" if you have made any uncommitted changes).

Usage

Some configuration options can be either set by using command-line options or environment variables. If both are set, environment variables will override the command-line options:

Option Environment Variable Default Description
-addr LISTEN_ADDR :8080 Address and port to listen on.
-allow-env ALLOW_ENV Allow retrieval of environment variables.
-graceful-delay GRACEFUL_DELAY 2s Delay between receiving a shutdown signal and starting shutdown.
-tls-cert TLS_CERT Path to TLS certificate file.
-tls-key TLS_KEY Path to TLS key file.

TLS Support

goecho will by default only run a HTTP server, but if you provide a TLS certificate and key either using command-line flags or environment variables it will instead provide a HTTPS server.

When TLS is enabled and TLS requests reach the server the echo handler will also return information about the TLS version and the hostname used for the connection.

goecho's People

Contributors

gottwald avatar mjeri avatar xperimental avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mjeri gottwald

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.