1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/quay-entrypoint.sh
Henry Donnay 2735d348ac quay-entrypoint.sh: fix openssl commandline (#264)
Turns out `--` isn't in the openssl in rhel7.

This is my bad to begin with, as this argument terminator isn't
documented even on versions where it works.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
2020-03-12 12:18:26 -04:00

91 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
QUAYENTRY=${QUAYENTRY:=$1}
QUAYENTRY=${QUAYENTRY:=registry}
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
display_usage() {
echo "Usage: ${0} <registry|config|migrate|repomirror|shell|help>"
echo
echo "If the first argument isn't one of the above modes,"
echo "the arguments will be exec'd directly, i.e.:"
echo
echo " ${0} uptime"
}
if [[ "${QUAYENTRY}" = "help" ]]
then
display_usage
exit 0
fi
cat << "EOF"
__ __
/ \ / \ ______ _ _ __ __ __
/ /\ / /\ \ / __ \ | | | | / \ \ \ / /
/ / / / \ \ | | | | | | | | / /\ \ \ /
\ \ \ \ / / | |__| | | |__| | / ____ \ | |
\ \/ \ \/ / \_ ___/ \____/ /_/ \_\ |_|
\__/ \__/ \ \__
\___\ by Red Hat
Build, Store, and Distribute your Containers
EOF
# Custom environment variables for use in conf/supervisord.conf
# The gunicorn-registry process DB_CONNECTION_POOLING must default to true
export DB_CONNECTION_POOLING_REGISTRY=${DB_CONNECTION_POOLING:-"true"}
# Forcibly export the scl environment
eval "$(scl enable python27 rh-nginx112 'export -p')"
case "$QUAYENTRY" in
"shell")
echo "Entering shell mode"
exec /bin/bash
;;
"config")
echo "Entering config mode, only copying config-app entrypoints"
: "${CONFIG_APP_PASSWORD:=$2}"
: "${CONFIG_APP_PASSWORD:?Missing password argument for configuration tool}"
printf '%s' "${CONFIG_APP_PASSWORD}" | openssl passwd -apr1 -stdin >> "$QUAYDIR/config_app/conf/htpasswd"
"${QUAYPATH}/config_app/init/certs_create.sh" || exit
exec supervisord -c "${QUAYPATH}/config_app/conf/supervisord.conf" 2>&1
;;
"migrate")
: "${MIGRATION_VERSION:=$2}"
: "${MIGRATION_VERSION:?Missing version argument}"
echo "Entering migration mode to version: ${MIGRATION_VERSION}"
PYTHONPATH="${QUAYPATH}" alembic upgrade "${MIGRATION_VERSION}"
;;
"repomirror")
echo "Entering repository mirroring mode"
export QUAY_SERVICES="${QUAY_SERVICES}${QUAY_SERVICES:+,}repomirrorworker,pushgateway"
;&
"registry")
if [ -z "${QUAY_SERVICES}" ]; then
echo "Running all default registry services"
else
echo "Running services ${QUAY_SERVICES}"
fi
for f in "${QUAYCONF}"/init/*.sh; do
echo "Running init script '$f'"
"$f" || exit
done
exec supervisord -c "${QUAYCONF}/supervisord.conf" 2>&1
;;
*)
echo "Running '$QUAYENTRY'"
eval exec "$@"
;;
esac