1.14.0-rhel-7-r14 release

This commit is contained in:
Bitnami Bot
2019-01-22 15:59:00 +00:00
parent 58ab6a1616
commit 8b9b97a308
8 changed files with 195 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
FROM gcr.io/helm-publish-ci/redhat-extras-base:7-r92
FROM registry.rhc4tp.openshift.com/bitnami/rhel-extras-base-7:latest
LABEL maintainer "Bitnami <containers@bitnami.com>"
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
@@ -13,14 +13,16 @@ RUN install_packages glibc keyutils-libs krb5-libs libcom_err libselinux nss-sof
RUN . ./libcomponent.sh && component_unpack "nginx" "1.14.0-5" --checksum 9bd2b1045d82829c5bbe1b286a43e11b6a0e1e19c5c34b7ad20b8df5bab2ca71
RUN ln -sf /opt/bitnami/nginx/html /app
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/access.log
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/error.log
RUN ln -sf /dev/stderr /opt/bitnami/nginx/logs/error.log
COPY rootfs /
RUN /prepare.sh
ENV BITNAMI_APP_NAME="nginx" \
BITNAMI_IMAGE_VERSION="1.14.0-rhel-7-r13" \
BITNAMI_IMAGE_VERSION="1.14.0-rhel-7-r14" \
NAMI_PREFIX="/.nami" \
NGINX_DAEMON_GROUP="" \
NGINX_DAEMON_USER="" \
NGINX_HTTPS_PORT_NUMBER="443" \
NGINX_HTTP_PORT_NUMBER="8080" \
PATH="/opt/bitnami/nginx/sbin:$PATH"

View File

@@ -4,15 +4,22 @@ set -o errexit
set -o nounset
set -o pipefail
#set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /libbitnami.sh
. /libnginx.sh && eval "$(nginx_env)"
. /libnginx.sh
# Load NGINX env. variables
eval "$(nginx_env)"
print_welcome_page
if [ "$*" = "/run.sh" ]; then
if [[ "$*" = "/run.sh" ]]; then
info "** Starting NGINX setup **"
/setup.sh
info "** NGINX setup finished! **"
fi
echo ""
exec "$@"

View File

@@ -1,102 +1,173 @@
#!/bin/bash -e
#!/bin/bash
#
# Bitnami NGINX library
# shellcheck disable=SC1091
# Load Generic Libraries
. /libfile.sh
. /liblog.sh
. /libos.sh
. /libservice.sh
. /libvalidations.sh
# Echo env vars for nginx global configuration.
nginx_env() {
cat <<"EOF"
export NGINX_EXTRAS_DIR=/opt/bitnami/extra/nginx
export NGINX_TEMPLATES_DIR=/opt/bitnami/extra/nginx/templates
export NGINX_BASEDIR=/opt/bitnami/nginx
export NGINX_VOLUME=/bitnami/nginx
export NGINX_TMPDIR=$NGINX_BASEDIR/tmp
export NGINX_CONFDIR=$NGINX_BASEDIR/conf
export NGINX_LOGDIR=$NGINX_BASEDIR/logs
export PATH=$NGINX_BASEDIR/sbin:$PATH
EOF
}
# Functions
# Validate settings in NGINX_* env vars.
nginx_validate() {
local validate_args=""
if ! am_i_root; then
validate_args="-unprivileged"
fi
if ! err=$(validate_port $validate_args "$NGINX_HTTP_PORT_NUMBER"); then
error "The $var environment variable is invalid: $err"
exit 1
fi
for var in NGINX_DAEMON_GROUP NGINX_DAEMON_USER; do
local value=${!var}
if am_i_root; then
if [ -z "$value" ]; then
error "The $var environment variable cannot be empty when running as root"
exit 1
fi
else
if [ -n "$value" ]; then
error "The $var environment variable must be empty when running as non-root"
exit 1
fi
fi
done
}
# Ensure the mariadb volume is initialised.
nginx_initialize() {
# Add support for legacy config file location
if [ -f "$NGINX_VOLUME/conf/nginx.conf" ]; then
info "WARNING: nginx.conf was found in a legacy location: $NGINX_VOLUME/conf/nginx.conf"
info "WARNING: This path will not be supported in future releases"
info "WARNING: please use $NGINX_CONFDIR/nginx.conf instead"
cp "$NGINX_VOLUME/conf/nginx.conf" "$NGINX_CONFDIR/nginx.conf"
fi
if [ -d "$NGINX_VOLUME/conf/vhosts" ]; then
info "WARNING: nginx.conf was found in a legacy location: $NGINX_VOLUME/conf/vhosts"
info "WARNING: this path will not be supported in future releases"
info "WARNING: please use $NGINX_CONFDIR/vhosts instead"
cp -r "$NGINX_VOLUME/conf/vhosts" "$NGINX_CONFDIR"
fi
if [ -e "$NGINX_CONFDIR/nginx.conf" ]; then
return
fi
info "nginx.conf not found. Applying bitnami configuration..."
for dir in "$NGINX_TMPDIR" "$NGINX_CONFDIR" "$NGINX_CONFDIR/vhosts"; do
ensure_dir_exists "$dir" "$NGINX_DAEMON_USER"
done
render-template "$NGINX_TEMPLATES_DIR/nginx.conf.tpl" > "$NGINX_CONFDIR/nginx.conf"
echo 'fastcgi_param HTTP_PROXY "";' >> "$NGINX_CONFDIR/fastcgi_params"
}
# Checks if nginx is running
########################
# Check if NGINX is running
# Globals:
# NGINX_TMPDIR
# Arguments:
# None
# Returns:
# Boolean
#########################
is_nginx_running() {
local pid
pid=$(get_pid "$NGINX_TMPDIR/nginx.pid")
pid=$(get_pid_from_file "${NGINX_TMPDIR}/nginx.pid")
if [ -z "$pid" ]; then
if [[ -z "$pid" ]]; then
false
else
is_service_running "$pid"
fi
}
# Stops nginx
########################
# Stop NGINX
# Globals:
# NGINX_TMPDIR
# Arguments:
# None
# Returns:
# None
#########################
nginx_stop() {
stop_service_using_pid "$NGINX_TMPDIR/nginx.pid"
! is_nginx_running && return
debug "Stopping NGINX..."
stop_service_using_pid "${NGINX_TMPDIR}/nginx.pid"
}
# Starts nginx
########################
# Start NGINX and wait until it's ready
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# None
#########################
nginx_start() {
if is_nginx_running ; then
return
is_nginx_running && return
debug "Starting NGIX..."
if am_i_root; then
gosu "$NGINX_DAEMON_USER" "${NGINX_BASEDIR}/sbin/nginx" -c "${NGINX_CONFDIR}/nginx.conf"
else
"${NGINX_BASEDIR}/sbin/nginx" -c "${NGINX_CONFDIR}/nginx.conf"
fi
local counter=3
while ! is_nginx_running ; do
if [[ "$counter" -ne 0 ]]; then
break
fi
sleep 1;
counter=$((counter - 1))
done
}
########################
# Load global variables used on NGINX configuration
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# Series of exports to be used as 'eval' arguments
#########################
nginx_env() {
cat <<"EOF"
export NGINX_BASEDIR="/opt/bitnami/nginx"
export NGINX_VOLUME="/bitnami/nginx"
export NGINX_EXTRAS_DIR="/opt/bitnami/extra/nginx"
export NGINX_TEMPLATES_DIR="${NGINX_EXTRAS_DIR}/templates"
export NGINX_TMPDIR="${NGINX_BASEDIR}/tmp"
export NGINX_CONFDIR="${NGINX_BASEDIR}/conf"
export NGINX_LOGDIR="${NGINX_BASEDIR}/logs"
export PATH="${NGINX_BASEDIR}/sbin:$PATH"
EOF
}
########################
# Validate settings in NGINX_* env vars
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# None
#########################
nginx_validate() {
info "Validating settings in NGINX_* env vars..."
local validate_port_args=()
! am_i_root && validate_port_args+=("-unprivileged")
if ! err=$(validate_port "${validate_port_args[@]}" "$NGINX_HTTP_PORT_NUMBER"); then
error "An invalid port was specified in the environment variable NGINX_HTTP_PORT_NUMBER: $err"
exit 1
fi
for var in "NGINX_DAEMON_USER" "NGINX_DAEMON_GROUP"; do
if am_i_root; then
if [[ -z "${!var}" ]]; then
error "The $var environment variable cannot be empty when running as root"
exit 1
fi
else
if [[ -n "${!var}" ]]; then
warn "The $var environment variable will be ignored when running as non-root"
fi
fi
done
}
########################
# Ensure NGINX is initialized
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# None
#########################
nginx_initialize() {
info "Initializing NGINX..."
# Persisted configuration files from old versions
if [[ -f "$NGINX_VOLUME/conf/nginx.conf" ]]; then
warn "'nginx.conf' was found in a legacy location: ${NGINX_VOLUME}/conf/nginx.conf"
warn " Please use ${NGINX_CONFDIR}/nginx.conf instead"
debug "Moving 'nginx.conf' file to new location..."
cp "$NGINX_VOLUME/conf/nginx.conf" "$NGINX_CONFDIR/nginx.conf"
fi
if ! is_dir_empty "$NGINX_VOLUME/conf/vhosts"; then
warn "Custom vhosts config files were found in a legacy directory: $NGINX_VOLUME/conf/vhosts"
warn " Please use ${NGINX_CONFDIR}/vhosts instead"
debug "Moving vhosts config files to new location..."
cp -r "$NGINX_VOLUME/conf/vhosts" "$NGINX_CONFDIR"
fi
if [[ -e "${NGINX_CONFDIR}/nginx.conf" ]]; then
debug "Custom configuration detected. Using it..."
return
else
debug "'nginx.conf' not found. Applying bitnami configuration..."
debug "Ensuring expected directories/files exist..."
for dir in "$NGINX_TMPDIR" "$NGINX_CONFDIR" "${NGINX_CONFDIR}/vhosts"; do
ensure_dir_exists "$dir" "$NGINX_DAEMON_USER"
done
debug "Rendering 'nginx.conf.tpl' template..."
render-template "${NGINX_TEMPLATES_DIR}/nginx.conf.tpl" > "${NGINX_CONFDIR}/nginx.conf"
echo 'fastcgi_param HTTP_PROXY "";' >> "${NGINX_CONFDIR}/fastcgi_params"
fi
"$NGINX_BASEDIR/sbin/nginx" -c "$NGINX_CONFDIR/nginx.conf"
}

View File

@@ -1,5 +1,6 @@
{
"httpPort": "{{$global.env.NGINX_HTTP_PORT_NUMBER}}",
"httpsPort": "{{$global.env.NGINX_HTTPS_PORT_NUMBER}}",
"systemGroup": "{{$global.env.NGINX_DAEMON_GROUP}}",
"systemUser": "{{$global.env.NGINX_DAEMON_USER}}"
}

View File

@@ -1,16 +1,20 @@
#!/bin/bash
# shellcheck disable=SC1091
# Load libraries
. /libnginx.sh
# Load NGINX env. variables
eval "$(nginx_env)"
# TODO: This is super annoying, with all the "non root" thing with all privileges
# Volume must be world writable so container's user has full access.
for dir in /bitnami "$NGINX_VOLUME" "$NGINX_CONFDIR" "$NGINX_BASEDIR" "$NGINX_TMPDIR"; do
mkdir -p "$dir"
for dir in "/bitnami" "$NGINX_VOLUME" "$NGINX_CONFDIR" "$NGINX_BASEDIR" "$NGINX_TMPDIR"; do
ensure_dir_exists "$dir"
chmod -R g+rwX "$dir"
done
# Users can mount their html sites at /app
ln -sf "$NGINX_BASEDIR/html" /app
# Redirect all logging to stdout/stderr
ln -sf /dev/stdout "$NGINX_LOGDIR/access.log"
ln -sf /dev/stderr "$NGINX_LOGDIR/error.log"

View File

@@ -4,11 +4,18 @@ set -o errexit
set -o nounset
set -o pipefail
#set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /liblog.sh
. /libnginx.sh
info "Starting nginx... "
# Load NGINX env. variables
eval "$(nginx_env)"
exec "$NGINX_BASEDIR/sbin/nginx" -c "$NGINX_CONFDIR/nginx.conf" -g "daemon off;"
info "** Starting NGINX **"
if am_i_root; then
exec gosu "$NGINX_DAEMON_USER" "$NGINX_BASEDIR/sbin/nginx" -c "$NGINX_CONFDIR/nginx.conf" -g "daemon off;"
else
exec "$NGINX_BASEDIR/sbin/nginx" -c "$NGINX_CONFDIR/nginx.conf" -g "daemon off;"
fi

View File

@@ -4,21 +4,20 @@ set -o errexit
set -o nounset
set -o pipefail
#set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /libos.sh
. /libfs.sh
. /libnginx.sh
# ensure nginx env var settings are valid
# Load NGINX env. variables
eval "$(nginx_env)"
# Ensure NGINX env. variables settings are valid
nginx_validate
# ensure nginx is stopped when this script ends.
# Ensure NGINX is stopped when this script ends
trap "nginx_stop" EXIT
if am_i_root; then
ensure_user_exists "$NGINX_DAEMON_USER" "$NGINX_DAEMON_GROUP"
fi
# ensure nginx is initialized
am_i_root && ensure_user_exists "$NGINX_DAEMON_USER" "$NGINX_DAEMON_GROUP"
# Ensure NGINX is initialized
nginx_initialize

View File

@@ -48,7 +48,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t
* [`1.14-ol-7`, `1.14.2-ol-7-r53` (1.14/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.2-ol-7-r53/1.14/ol-7/Dockerfile)
* [`1.14-debian-9`, `1.14.2-debian-9-r46`, `1.14`, `1.14.2`, `1.14.2-r46`, `latest` (1.14/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.2-debian-9-r46/1.14/debian-9/Dockerfile)
* [`1.14-rhel-7`, `1.14.0-rhel-7-r13` (1.14/rhel-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.0-rhel-7-r13/1.14/rhel-7/Dockerfile)
* [`1.14-rhel-7`, `1.14.0-rhel-7-r14` (1.14/rhel-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.0-rhel-7-r14/1.14/rhel-7/Dockerfile)
# Get this image