22 feb. 2022 - โก Our Docker image was downloaded one MILLION times from the docker hub! โก
One day you may want to replace the standard error pages of your HTTP server with something more original and pretty. That's what this repository was created for :) It contains: - Simple error pages generator, written in Go - Single-page error page templates with different designs (located in the [templates](https://github.com/tarampampam/error-pages/tree/master/templates) directory) - Fast and lightweight HTTP server - Already generated error pages (sources can be [found here][preview-sources], the **demonstration** is always accessible [here][preview-demo]) ## ๐ฅ Features list - HTTP server written in Go, with the extremely fast [FastHTTP][fasthttp] under the hood - Respects the `Content-Type` HTTP header (and `X-Format`) value and responds with the corresponding format (supported formats are `json` and `xml`) - Writes logs in `json` format - Contains healthcheck endpoint (`/healthz`) - Contains metrics endpoint (`/metrics`) in Prometheus format - Lightweight docker image _(~4.6Mb compressed size)_, distroless and uses the unleveled user by default - [Go-template](https://pkg.go.dev/text/template) tags are allowed in the templates - Ready for integration with [Traefik][traefik] ([error pages customization](https://doc.traefik.io/traefik/middlewares/http/errorpages/)) and [Ingress-nginx][ingress-nginx] - Error pages can be [embedded into your own `nginx`][wiki-usage-with-nginx] docker image - Fully configurable (take a look at the [configuration file](https://github.com/tarampampam/error-pages/blob/master/error-pages.yml) and [project Wiki][wiki]) - Distributed using docker image and compiled binary files - Localized (๐บ๐ธ, ๐ซ๐ท, ๐บ๐ฆ, ๐ท๐บ, ๐ต๐น, ๐ณ๐ฑ) HTML error pages (translation process [described here](https://github.com/tarampampam/error-pages/tree/master/l10n) - other translations are welcome!) ## ๐งฉ Install Download the latest binary file for your os/arch from the [releases page][releases] or use our docker image: [![image stats](https://dockeri.co/image/tarampampam/error-pages)][docker-hub-tags] | Registry | Image | |-----------------------------------|-----------------------------------| | [Docker Hub][docker-hub] | `tarampampam/error-pages` | | [GitHub Container Registry][ghcr] | `ghcr.io/tarampampam/error-pages` | > Using the `latest` tag for the docker image is highly discouraged because of possible backward-incompatible changes during **major** upgrades. Please, use tags in `X.Y.Z` format ๐ฃ **Or** you can download **already rendered** error pages pack as a [zip][pages-pack-zip] or [tar.gz][pages-pack-tar-gz] archive. [pages-pack-zip]:https://github.com/tarampampam/error-pages/zipball/gh-pages/ [pages-pack-tar-gz]:https://github.com/tarampampam/error-pages/tarball/gh-pages/ ## ๐ Usage Please, take a look at [our Wiki][wiki] for the common usage stories: - [HTTP server][wiki-http-server] (routes, formats, flags and environment variables) - [Pages generator][wiki-generator] (build your own error page set) - [Static error pages][wiki-static-error-pages] (extract generated static error pages from the docker image) - [Usage with nginx][wiki-usage-with-nginx] (include our error pages into an image with nginx) - [Usage with Traefik and local Docker Compose][wiki-traefik-docker-compose] (it's a good starting point for the tests) - [Usage with Traefik and Docker Swarm][wiki-traefik-swarm] - [Kubernetes & ingress nginx][wiki-k8s-ingress-nginx] [wiki]:https://github.com/tarampampam/error-pages/wiki [wiki-http-server]:https://github.com/tarampampam/error-pages/wiki/HTTP-server [wiki-generator]:https://github.com/tarampampam/error-pages/wiki/Generator [wiki-static-error-pages]:https://github.com/tarampampam/error-pages/wiki/Static-error-pages [wiki-usage-with-nginx]:https://github.com/tarampampam/error-pages/wiki/Usage-with-nginx [wiki-traefik-swarm]:https://github.com/tarampampam/error-pages/wiki/Traefik-(docker-swarm) [wiki-traefik-docker-compose]:https://github.com/tarampampam/error-pages/wiki/Traefik-(docker-compose) [wiki-k8s-ingress-nginx]:https://github.com/tarampampam/error-pages/wiki/Kubernetes-&-ingress-nginx ## ๐ฆพ Performance Used hardware: - Intelยฎ Coreโข i7-10510U CPU @ 1.80GHz ร 8 - 16 GiB RAM ```shell $ ulimit -aH | grep file -f: file size (blocks) unlimited -c: core file size (blocks) unlimited -n: file descriptors 1048576 -x: file locks unlimited $ docker run --rm -p "8080:8080/tcp" -e "SHOW_DETAILS=true" error-pages:local # in separate terminal $ wrk --timeout 1s -t12 -c400 -d30s -s ./test/wrk/request.lua http://127.0.0.1:8080/ Running 30s test @ http://127.0.0.1:8080/ 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 10.84ms 7.89ms 135.91ms 79.36% Req/Sec 3.23k 785.11 6.30k 70.04% 1160567 requests in 30.10s, 4.12GB read Requests/sec: 38552.04 Transfer/sec: 140.23MB ```