Compare commits

...

7 Commits

Author SHA1 Message Date
ce98410e51 Nginx Healthcheck endpoint + Dockerfile healthcheck (#23)
Co-authored-by: modem7 <modem7@gmail.com>
2021-09-06 11:47:10 +05:00
501d141ce7 Update CHANGELOG.md 2021-07-20 18:32:37 +05:00
8c2155407a Update Dockerfile 2021-07-20 18:29:54 +05:00
a73173309c Update CI 2021-07-20 15:05:06 +05:00
2fa41ec4b8 Update README.md 2021-05-03 12:43:09 +05:00
0efccb0187 Update CHANGELOG.md 2021-05-02 16:06:42 +05:00
914d6572b7 Update 100-setup-error-pages.sh (#12)
Random template generator, also picked up `nginx-error-pages` template, which we don't want. Proposing small patch to exclude from `allowed_templates`
2021-05-02 16:03:54 +05:00
6 changed files with 58 additions and 13 deletions

View File

@ -34,6 +34,7 @@ jobs:
with:
name: content
path: out/
retention-days: 1
- name: Switch to github pages branch
uses: actions/checkout@v2
@ -73,11 +74,18 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 # Action page: <https://github.com/docker/setup-buildx-action>
- name: Docker login in default registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin
- name: Login to default Container Registry
uses: docker/login-action@v1 # Action page: <https://github.com/docker/login-action>
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker login in ghcr.io # Auth docs: <https://git.io/JLDaw>
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u tarampampam --password-stdin
- name: Login to GitHub Container Registry
uses: docker/login-action@v1 # Action page: <https://github.com/docker/login-action>
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PASSWORD }}
- name: Generate builder values
id: values
@ -89,8 +97,8 @@ jobs:
--platform "linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7" \
--tag "tarampampam/error-pages:${{ steps.values.outputs.version }}" \
--tag "tarampampam/error-pages:latest" \
--tag "ghcr.io/tarampampam/error-pages:${{ steps.values.outputs.version }}" \
--tag "ghcr.io/tarampampam/error-pages:latest" \
--tag "ghcr.io/${{ github.actor }}/error-pages:${{ steps.values.outputs.version }}" \
--tag "ghcr.io/${{ github.actor }}/error-pages:latest" \
--file ./Dockerfile \
--push \
.

View File

@ -4,6 +4,29 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
## v1.8.0
### Added
- Nginx health-check endpoint (`/health/live`) and dockerfile `HEALTHCHECK` to utilise (thx [@modem7](https://github.com/modem7)) [#22], [#23]
[#22]:https://github.com/tarampampam/error-pages/pull/22
[#23]:https://github.com/tarampampam/error-pages/pull/23
## v1.7.2
### Changed
- Nginx updated up to `1.21` (from `1.19`)
## v1.7.1
### Fixed
- Random template selecting (thx [@xpliz](https://github.com/xpliz)) [#12]
[#12]:https://github.com/tarampampam/error-pages/pull/12
## v1.7.0
### Added

View File

@ -30,7 +30,7 @@ RUN set -x \
&& mv /src/docker/nginx-server.conf ./etc/nginx/conf.d/default.conf
# Image page: <https://hub.docker.com/_/nginx>
FROM --platform=${TARGETPLATFORM:-linux/amd64} nginx:1.19-alpine as runtime
FROM nginx:1.21.1-alpine as runtime
LABEL \
# Docs: <https://github.com/opencontainers/image-spec/blob/master/annotations.md>
@ -44,4 +44,9 @@ LABEL \
# Import from builder
COPY --from=builder /tmp/rootfs /
# Docs: <https://docs.docker.com/engine/reference/builder/#healthcheck>
HEALTHCHECK --interval=15s --timeout=2s --retries=2 --start-period=2s CMD [ \
"wget", "--spider", "-q", "http://127.0.0.1:8080/health/live" \
]
RUN chown -R nginx:nginx /opt/html

View File

@ -47,13 +47,15 @@ Also, you can use a special template name `random` - in this case template will
### Ready docker image
[![image stats](https://dockeri.co/image/tarampampam/error-pages)][link_docker_hub]
Execute in your shell:
```bash
$ docker run --rm -p "8082:8080" tarampampam/error-pages:X.X.X
```
> Important notice: do **not** use the `latest` image tag _(this is bad practice)_. Use versioned tag (like `1.2.3`) instead.
> Important notice: do **not** use the `latest` image tag _(this is bad practice)_. Use versioned tag (like `1.2.3`) instead. Docker hub mirror located [here (ghcr.io)][link_ghcr].
And open in your browser `http://127.0.0.1:8082/ghost/400.html`.

View File

@ -1,6 +1,11 @@
#!/usr/bin/env sh
set -e
# on `docker restart` next directory keep existing: <https://github.com/tarampampam/error-pages/issues/3>
if [ -d /opt/html/nginx-error-pages ]; then
rm -Rf /opt/html/nginx-error-pages;
fi;
# allows to use random template
if [ ! -z "$TEMPLATE_NAME" ] && ([ "$TEMPLATE_NAME" = "random" ] || [ "$TEMPLATE_NAME" = "RANDOM" ]); then
# find all templates in directory (only template directories must be located in /opt/html)
@ -27,11 +32,6 @@ fi;
# allows "direct access" to the error pages using URLs like "/500.html"
ln -f -s "/opt/html/$TEMPLATE_NAME/"* /opt/html;
# on `docker restart` next directory keep existing: <https://github.com/tarampampam/error-pages/issues/3>
if [ -d /opt/html/nginx-error-pages ]; then
rm -Rf /opt/html/nginx-error-pages;
fi;
# next directory is required for easy nginx `error_page` usage
mkdir /opt/html/nginx-error-pages;

View File

@ -19,6 +19,13 @@ server {
root /opt/html;
}
# Health-check (liveness probe)
location = /health/live {
access_log off;
default_type text/plain;
return 200 "healthy\n";
}
location / {
try_files $uri =404;
}