mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-08 02:24:04 +00:00
Fix bash files codestyle
This commit is contained in:
@@ -6,14 +6,14 @@ set -e
|
||||
|
||||
wrapper=""
|
||||
if [[ "${RESTARTABLE}" == "yes" ]]; then
|
||||
wrapper="run-one-constantly"
|
||||
wrapper="run-one-constantly"
|
||||
fi
|
||||
|
||||
if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then
|
||||
# launched by JupyterHub, use single-user entrypoint
|
||||
exec /usr/local/bin/start-singleuser.sh "$@"
|
||||
# launched by JupyterHub, use single-user entrypoint
|
||||
exec /usr/local/bin/start-singleuser.sh "$@"
|
||||
elif [[ ! -z "${JUPYTER_ENABLE_LAB}" ]]; then
|
||||
. /usr/local/bin/start.sh $wrapper jupyter lab "$@"
|
||||
. /usr/local/bin/start.sh $wrapper jupyter lab "$@"
|
||||
else
|
||||
. /usr/local/bin/start.sh $wrapper jupyter notebook "$@"
|
||||
. /usr/local/bin/start.sh $wrapper jupyter notebook "$@"
|
||||
fi
|
||||
|
@@ -6,7 +6,7 @@ set -e
|
||||
|
||||
# set default ip to 0.0.0.0
|
||||
if [[ "$NOTEBOOK_ARGS $@" != *"--ip="* ]]; then
|
||||
NOTEBOOK_ARGS="--ip=0.0.0.0 $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--ip=0.0.0.0 $NOTEBOOK_ARGS"
|
||||
fi
|
||||
|
||||
# handle some deprecated environment variables
|
||||
@@ -14,25 +14,25 @@ fi
|
||||
# These won't be passed from DockerSpawner 0.9,
|
||||
# so avoid specifying --arg=empty-string
|
||||
if [ ! -z "$NOTEBOOK_DIR" ]; then
|
||||
NOTEBOOK_ARGS="--notebook-dir='$NOTEBOOK_DIR' $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--notebook-dir='$NOTEBOOK_DIR' $NOTEBOOK_ARGS"
|
||||
fi
|
||||
if [ ! -z "$JPY_PORT" ]; then
|
||||
NOTEBOOK_ARGS="--port=$JPY_PORT $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--port=$JPY_PORT $NOTEBOOK_ARGS"
|
||||
fi
|
||||
if [ ! -z "$JPY_USER" ]; then
|
||||
NOTEBOOK_ARGS="--user=$JPY_USER $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--user=$JPY_USER $NOTEBOOK_ARGS"
|
||||
fi
|
||||
if [ ! -z "$JPY_COOKIE_NAME" ]; then
|
||||
NOTEBOOK_ARGS="--cookie-name=$JPY_COOKIE_NAME $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--cookie-name=$JPY_COOKIE_NAME $NOTEBOOK_ARGS"
|
||||
fi
|
||||
if [ ! -z "$JPY_BASE_URL" ]; then
|
||||
NOTEBOOK_ARGS="--base-url=$JPY_BASE_URL $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--base-url=$JPY_BASE_URL $NOTEBOOK_ARGS"
|
||||
fi
|
||||
if [ ! -z "$JPY_HUB_PREFIX" ]; then
|
||||
NOTEBOOK_ARGS="--hub-prefix=$JPY_HUB_PREFIX $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--hub-prefix=$JPY_HUB_PREFIX $NOTEBOOK_ARGS"
|
||||
fi
|
||||
if [ ! -z "$JPY_HUB_API_URL" ]; then
|
||||
NOTEBOOK_ARGS="--hub-api-url=$JPY_HUB_API_URL $NOTEBOOK_ARGS"
|
||||
NOTEBOOK_ARGS="--hub-api-url=$JPY_HUB_API_URL $NOTEBOOK_ARGS"
|
||||
fi
|
||||
NOTEBOOK_BIN="jupyterhub-singleuser"
|
||||
|
||||
|
@@ -9,12 +9,12 @@ set -e
|
||||
|
||||
# Get domain and email from environment
|
||||
[ -z "$FQDN" ] && \
|
||||
echo "ERROR: Must set FQDN environment varable" && \
|
||||
exit 1
|
||||
echo "ERROR: Must set FQDN environment varable" && \
|
||||
exit 1
|
||||
|
||||
[ -z "$EMAIL" ] && \
|
||||
echo "ERROR: Must set EMAIL environment varable" && \
|
||||
exit 1
|
||||
echo "ERROR: Must set EMAIL environment varable" && \
|
||||
exit 1
|
||||
|
||||
# letsencrypt certificate server type (default is production).
|
||||
# Set `CERT_SERVER=--staging` for staging.
|
||||
@@ -25,24 +25,24 @@ set -e
|
||||
docker volume create --name $SECRETS_VOLUME 1>/dev/null
|
||||
# Generate the cert and save it to the Docker volume
|
||||
docker run --rm -it \
|
||||
-p 80:80 \
|
||||
-v $SECRETS_VOLUME:/etc/letsencrypt \
|
||||
quay.io/letsencrypt/letsencrypt:latest \
|
||||
certonly \
|
||||
--non-interactive \
|
||||
--keep-until-expiring \
|
||||
--standalone \
|
||||
--standalone-supported-challenges http-01 \
|
||||
--agree-tos \
|
||||
--domain "$FQDN" \
|
||||
--email "$EMAIL" \
|
||||
$CERT_SERVER
|
||||
-p 80:80 \
|
||||
-v $SECRETS_VOLUME:/etc/letsencrypt \
|
||||
quay.io/letsencrypt/letsencrypt:latest \
|
||||
certonly \
|
||||
--non-interactive \
|
||||
--keep-until-expiring \
|
||||
--standalone \
|
||||
--standalone-supported-challenges http-01 \
|
||||
--agree-tos \
|
||||
--domain "$FQDN" \
|
||||
--email "$EMAIL" \
|
||||
$CERT_SERVER
|
||||
|
||||
# Set permissions so nobody can read the cert and key.
|
||||
# Also symlink the certs into the root of the /etc/letsencrypt
|
||||
# directory so that the FQDN doesn't have to be known later.
|
||||
docker run --rm -it \
|
||||
-v $SECRETS_VOLUME:/etc/letsencrypt \
|
||||
ubuntu:18.04 \
|
||||
bash -c "ln -s /etc/letsencrypt/live/$FQDN/* /etc/letsencrypt/ && \
|
||||
find /etc/letsencrypt -type d -exec chmod 755 {} +"
|
||||
-v $SECRETS_VOLUME:/etc/letsencrypt \
|
||||
ubuntu:18.04 \
|
||||
bash -c "ln -s /etc/letsencrypt/live/$FQDN/* /etc/letsencrypt/ && \
|
||||
find /etc/letsencrypt -type d -exec chmod 755 {} +"
|
||||
|
@@ -15,8 +15,8 @@ MACHINE_NAME=$1 && [ -z "$MACHINE_NAME" ] && echo "$USAGE" && exit $E_BADARGS
|
||||
|
||||
# Use SOFTLAYER_DOMAIN env var if domain name not set as second arg
|
||||
DOMAIN="${2:-$SOFTLAYER_DOMAIN}" && [ -z "$DOMAIN" ] && \
|
||||
echo "Must specify domain or set SOFTLAYER_DOMAIN environment varable" && \
|
||||
echo "$USAGE" && exit $E_BADARGS
|
||||
echo "Must specify domain or set SOFTLAYER_DOMAIN environment varable" && \
|
||||
echo "$USAGE" && exit $E_BADARGS
|
||||
|
||||
IP=$(docker-machine ip "$MACHINE_NAME")
|
||||
|
||||
|
@@ -11,8 +11,7 @@ USAGE="Usage: `basename $0` [--secure | --letsencrypt] [--password PASSWORD] [--
|
||||
# Parse args to determine security settings
|
||||
SECURE=${SECURE:=no}
|
||||
LETSENCRYPT=${LETSENCRYPT:=no}
|
||||
while [[ $# > 0 ]]
|
||||
do
|
||||
while [[ $# > 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
--secure)
|
||||
@@ -37,25 +36,25 @@ shift # past argument or value
|
||||
done
|
||||
|
||||
if [[ "$LETSENCRYPT" == yes || "$SECURE" == yes ]]; then
|
||||
if [ -z "${PASSWORD:+x}" ]; then
|
||||
echo "ERROR: Must set PASSWORD if running in secure mode"
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$LETSENCRYPT" == yes ]; then
|
||||
CONFIG=letsencrypt-notebook.yml
|
||||
if [ -z "${SECRETS_VOLUME:+x}" ]; then
|
||||
echo "ERROR: Must set SECRETS_VOLUME if running in letsencrypt mode"
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
if [ -z "${PASSWORD:+x}" ]; then
|
||||
echo "ERROR: Must set PASSWORD if running in secure mode"
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
CONFIG=secure-notebook.yml
|
||||
fi
|
||||
export PORT=${PORT:=443}
|
||||
if [ "$LETSENCRYPT" == yes ]; then
|
||||
CONFIG=letsencrypt-notebook.yml
|
||||
if [ -z "${SECRETS_VOLUME:+x}" ]; then
|
||||
echo "ERROR: Must set SECRETS_VOLUME if running in letsencrypt mode"
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
CONFIG=secure-notebook.yml
|
||||
fi
|
||||
export PORT=${PORT:=443}
|
||||
else
|
||||
CONFIG=notebook.yml
|
||||
export PORT=${PORT:=80}
|
||||
CONFIG=notebook.yml
|
||||
export PORT=${PORT:=80}
|
||||
fi
|
||||
|
||||
# Setup environment
|
||||
|
Reference in New Issue
Block a user