Skip to content

Commit

Permalink
Automated updates
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocicerchia committed Mar 11, 2022
1 parent 7a02854 commit 135667d
Show file tree
Hide file tree
Showing 47 changed files with 3,565 additions and 246 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ If you'd like to support this open-source project I'll appreciate any kind of [c
## Supported tags and respective `Dockerfile` links

<!-- START_SUPPORTED_TAGS -->
- [`almalinux`, `1-almalinux`, `1.21-almalinux`, `1.21.6-almalinux`, `1-almalinux8.5-20211112`, `1.21-almalinux8.5-20211112`, `1.21.6-almalinux8.5-20211112`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/almalinux/8.5-20211112/Dockerfile)
- [`1`, `1.21`, `alpine`, `1.21.6`, `latest`, `1-alpine`, `1.21-alpine`, `1.21.6-alpine`, `1-alpine3.15.0`, `1.21-alpine3.15.0`, `1.21.6-alpine3.15.0`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/alpine/3.15.0/Dockerfile)
- [`amazonlinux`, `1-amazonlinux`, `1.21-amazonlinux`, `1.21.6-amazonlinux`, `1-amazonlinux2.0.20220121.0`, `1.21-amazonlinux2.0.20220121.0`, `1.21.6-amazonlinux2.0.20220121.0`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/amazonlinux/2.0.20220121.0/Dockerfile)
- [`debian`, `1-debian`, `1.21-debian`, `1-debian11.2`, `1.21.6-debian`, `1.21-debian11.2`, `1.21.6-debian11.2`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/debian/11.2/Dockerfile)
- [`fedora`, `1-fedora`, `1-fedora35`, `1.21-fedora`, `1.21-fedora35`, `1.21.6-fedora`, `1.21.6-fedora35`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/fedora/35/Dockerfile)
- [`ubuntu`, `1-ubuntu`, `1.21-ubuntu`, `1-ubuntu20.04`, `1.21.6-ubuntu`, `1.21-ubuntu20.04`, `1.21.6-ubuntu20.04`](https://github.com/fabiocicerchia/nginx-lua/blob/main/nginx/1.21.6/ubuntu/20.04/Dockerfile)
<!-- END_SUPPORTED_TAGS -->

**Note:** The full list of supported/unsupported tags can be found on [`docs/TAGS.md`](https://github.com/fabiocicerchia/nginx-lua/blob/main/docs/TAGS.md).
Expand Down
239 changes: 0 additions & 239 deletions docs/TAGS.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh
# vim:sw=4:ts=4:et

set -e

ME=$(basename $0)
DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"

# check if we have ipv6 available
if [ ! -f "/proc/net/if_inet6" ]; then
echo >&3 "$ME: error: ipv6 not available"
exit 0
fi

if [ ! -f "/$DEFAULT_CONF_FILE" ]; then
echo >&3 "$ME: error: /$DEFAULT_CONF_FILE is not a file or does not exist"
exit 0
fi

# check if the file can be modified, e.g. not on a r/o filesystem
touch /$DEFAULT_CONF_FILE 2>/dev/null || { echo >&3 "$ME: error: can not modify /$DEFAULT_CONF_FILE (read-only file system?)"; exit 0; }

# check if the file is already modified, e.g. on a container restart
grep -q "listen \[::]\:80;" /$DEFAULT_CONF_FILE && { echo >&3 "$ME: error: IPv6 listen already enabled"; exit 0; }

if [ -f "/etc/os-release" ]; then
. /etc/os-release
else
echo >&3 "$ME: error: can not guess the operating system"
exit 0
fi

echo >&3 "$ME: Getting the checksum of /$DEFAULT_CONF_FILE"

#case "$ID" in
# "debian")
# CHECKSUM=$(dpkg-query --show --showformat='${Conffiles}\n' nginx | grep $DEFAULT_CONF_FILE | cut -d' ' -f 3)
# echo "$CHECKSUM /$DEFAULT_CONF_FILE" | md5sum -c - >/dev/null 2>&1 || {
# echo >&3 "$ME: error: /$DEFAULT_CONF_FILE differs from the packaged version"
# exit 0
# }
# ;;
# "alpine")
# CHECKSUM=$(apk manifest nginx 2>/dev/null| grep $DEFAULT_CONF_FILE | cut -d' ' -f 1 | cut -d ':' -f 2)
# echo "$CHECKSUM /$DEFAULT_CONF_FILE" | sha1sum -c - >/dev/null 2>&1 || {
# echo >&3 "$ME: error: /$DEFAULT_CONF_FILE differs from the packages version"
# exit 0
# }
# ;;
# *)
# echo >&3 "$ME: error: Unsupported distribution"
# exit 0
# ;;
#esac

# enable ipv6 on default.conf listen sockets
sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' /$DEFAULT_CONF_FILE

echo >&3 "$ME: Enabled listen on IPv6 in /$DEFAULT_CONF_FILE"

exit 0
32 changes: 32 additions & 0 deletions nginx/1.21.6/almalinux/8.5-20220306/20-envsubst-on-templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

set -e

ME=$(basename $0)

auto_envsubst() {
local template_dir="${NGINX_ENVSUBST_TEMPLATE_DIR:-/etc/nginx/templates}"
local suffix="${NGINX_ENVSUBST_TEMPLATE_SUFFIX:-.template}"
local output_dir="${NGINX_ENVSUBST_OUTPUT_DIR:-/etc/nginx/conf.d}"

local template defined_envs relative_path output_path subdir
defined_envs=$(printf '${%s} ' $(env | cut -d= -f1))
[ -d "$template_dir" ] || return 0
if [ ! -w "$output_dir" ]; then
echo >&3 "$ME: ERROR: $template_dir exists, but $output_dir is not writable"
return 0
fi
find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
relative_path="${template#$template_dir/}"
output_path="$output_dir/${relative_path%$suffix}"
subdir=$(dirname "$relative_path")
# create a subdirectory where the template file exists
mkdir -p "$output_dir/$subdir"
echo >&3 "$ME: Running envsubst on $template to $output_path"
envsubst "$defined_envs" < "$template" > "$output_path"
done
}

auto_envsubst

exit 0
Loading

0 comments on commit 135667d

Please sign in to comment.