From 5462a1f664dad8f6d110d89a4378305781f90a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=D0=B0ramtamt=C4=81m?= <7326800+tarampampam@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:37:34 +0000 Subject: [PATCH] Readme file update --- README.md | 317 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 162 insertions(+), 155 deletions(-) diff --git a/README.md b/README.md index f323ace..8557a7d 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,149 @@ Download the latest binary file for your OS/architecture from the [releases page [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/ +## 🪂 Templates (themes) + +The following templates are built-in and available for use without any additional setup: + +> [!NOTE] +> The `cats` template is the only one of those that fetches resources (the actual cat pictures) from external +> servers - all other templates are self-contained. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TemplatePreview
+ app-down

+ used times +
+ + + + +
+ cats

+ used times +
+ + + + +
+ connection

+ used times +
+ + + + +
+ ghost

+ used times +
+ + + + +
+ hacker-terminal

+ used times +
+ + + +
+ l7

+ used times +
+ + + + +
+ lost-in-space

+ used times +
+ + + + +
+ noise

+ used times +
+ + + +
+ orient

+ used times +
+ + + + +
+ shuffle

+ used times +
+ + + + +
+ +> [!NOTE] +> The "used times" counter increments when someone start the server with the specified template. Stats service does +> not collect any information about location, IP addresses, and so on. Moreover, the stats are open and available for +> everyone at [error-pages.goatcounter.com](https://error-pages.goatcounter.com/). This is simply a counter to display +> how often a particular template is used, nothing more. + ## 🛠 Usage scenarios ### HTTP server starting, utilizing either a binary file or Docker image @@ -75,9 +218,9 @@ First, ensure you have a precompiled binary file on your machine or have Docker/ server with the following command: ```bash -./error-pages serve -# or -docker run --rm -p '8080:8080/tcp' tarampampam/error-pages serve +$ ./error-pages serve +# --- or --- +$ docker run --rm -p '8080:8080/tcp' tarampampam/error-pages serve ``` That's it! The server will begin running and listen on address `0.0.0.0` and port `8080`. Access error pages using @@ -86,7 +229,7 @@ URLs like `http://127.0.0.1:8080/{page_code}.html`. To retrieve different error page codes using a static URL, use the `X-Code` HTTP header: ```bash -curl -H 'X-Code: 500' http://127.0.0.1:8080/ +$ curl -H 'X-Code: 500' http://127.0.0.1:8080/ ``` The server respects the `Content-Type` HTTP header (and `X-Format`), delivering responses in requested formats @@ -128,10 +271,15 @@ First, create your own template file, for example `my-super-theme.html`: And simply start the server with the following command: ```bash -docker run --rm \ +$ docker run --rm \ -v "$(pwd)/my-super-theme.html:/opt/my-template.html:ro" \ - -p '8080:8080/tcp' ghcr.io/tarampampam/error-pages:3 \ - serve --add-template /opt/my-template.html --template-name my-template + -p '8080:8080/tcp' ghcr.io/tarampampam/error-pages:3 serve \ + --add-template /opt/my-template.html \ + --template-name my-template +# --- or --- +$ ./error-pages serve \ + --add-template /opt/my-template.html \ + --template-name my-template ``` And test it: @@ -173,8 +321,8 @@ Create a file like this: Save it as `my-template.html` and use it as your custom template. Then, generate your error pages using the command: ```bash -mkdir -p /path/to/output -./error-pages build --add-template /path/to/your/my-template.html --target-dir /path/to/output +$ mkdir -p /path/to/output +$ ./error-pages build --add-template /path/to/your/my-template.html --target-dir /path/to/output ``` This will create error pages based on your template in the specified output directory: @@ -272,14 +420,15 @@ COPY --chown=nginx \ Now, we can build the image: ```bash -docker build --tag your-nginx:local -f ./Dockerfile . +$ docker build --tag your-nginx:local -f ./Dockerfile . ``` And voilà! Let's start the image and test if everything is working as expected: ```bash -docker run --rm -p '8081:80/tcp' your-nginx:local -curl http://127.0.0.1:8081/foobar | head -n 15 # in another terminal +$ docker run --rm -p '8081:80/tcp' your-nginx:local + +$ curl http://127.0.0.1:8081/foobar | head -n 15 # in another terminal ``` @@ -369,6 +518,7 @@ controller: config: custom-http-errors: >- 401,403,404,500,501,502,503 + defaultBackend: enabled: true image: @@ -519,149 +669,6 @@ The following flags are supported: -## 🪂 Templates (themes) - -The following templates are built-in and available for use without any additional setup: - -> [!NOTE] -> The `cats` template is the only one of those that fetches resources (the actual cat pictures) from external -> servers - all other templates are self-contained. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TemplatePreview
- app-down

- used times -
- - - - -
- cats

- used times -
- - - - -
- connection

- used times -
- - - - -
- ghost

- used times -
- - - - -
- hacker-terminal

- used times -
- - - -
- l7

- used times -
- - - - -
- lost-in-space

- used times -
- - - - -
- noise

- used times -
- - - -
- orient

- used times -
- - - - -
- shuffle

- used times -
- - - - -
- -> [!NOTE] -> The "used times" counter increments when someone start the server with the specified template. Stats service does -> not collect any information about location, IP addresses, and so on. Moreover, the stats are open and available for -> everyone at [error-pages.goatcounter.com](https://error-pages.goatcounter.com/). This is simply a counter to display -> how often a particular template is used, nothing more. - ## 🦾 Contributors I want to say a big thank you to everyone who contributed to this project: