update scripts from relevant repos

This commit is contained in:
Asif Bacchus 2019-10-19 22:27:23 -06:00
parent 410961d43e
commit 2beba0b496
3 changed files with 49 additions and 27 deletions

View File

@ -35,7 +35,8 @@ scriptHelp () {
printf "'normally': Run in detached mode with nginx automatically launched and\n"
printf "logging to stdout. If you specified certificates, nginx will serve over SSL\n"
printf "by default.\n"
printf "Note: This container removes itself upon exit.\n\n"
printf "Note: Containers (except shell) are always set to restart 'unless-stopped'. You\n"
printf "must remove them manually if desired.\n\n"
printf "${magenta}The script has the following parameters:\n"
printf "${cyan}(parameter in cyan) ${yellow}(default in yellow)${norm}\n\n"
printf "${cyan}-n|--name${norm}\n"
@ -181,7 +182,7 @@ if [ -z "$SSL_CERT" ]; then
else
# exec normally
printf "${cyan}\nRunning NGINX on %s...${norm}\n" "$container_name"
docker run --rm -d --name ${container_name} \
docker run -d --name ${container_name} \
--env-file ab-nginx-php.params \
$vmount \
-p ${HTTP_PORT}:80 \
@ -205,7 +206,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = FALSE ]; then
else
# exec normally
printf "${cyan}\nRunning NGINX on %s (TLS 1.2)...${norm}\n" "$container_name"
docker run --rm -d --name ${container_name} \
docker run -d --name ${container_name} \
--env-file ab-nginx-php.params \
$vmount \
-v "$SSL_CERT":/certs/fullchain.pem:ro \
@ -232,7 +233,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = TRUE ]; then
else
# exec normally
printf "${cyan}\nRunning NGINX on %s (TLS 1.3)...${norm}\n" "$container_name"
docker run --rm -d --name ${container_name} \
docker run -d --name ${container_name} \
--env-file ab-nginx-php.params \
$vmount \
-v "$SSL_CERT":/certs/fullchain.pem:ro \

View File

@ -35,7 +35,8 @@ scriptHelp () {
printf "'normally': Run in detached mode with nginx automatically launched and\n"
printf "logging to stdout. If you specified certificates, nginx will serve over SSL\n"
printf "by default.\n"
printf "Note: This container removes itself upon exit.\n\n"
printf "Note: Containers (except shell) are always set to restart 'unless-stopped'. You\n"
printf "must remove them manually if desired.\n\n"
printf "${magenta}The script has the following parameters:\n"
printf "${cyan}(parameter in cyan) ${yellow}(default in yellow)${norm}\n\n"
printf "${cyan}-n|--name${norm}\n"
@ -181,7 +182,7 @@ if [ -z "$SSL_CERT" ]; then
else
# exec normally
printf "${cyan}\nRunning NGINX on %s...${norm}\n" "$container_name"
docker run --rm -d --name ${container_name} \
docker run -d --name ${container_name} \
--env-file ab-nginx.params \
$vmount \
-p ${HTTP_PORT}:80 \
@ -205,7 +206,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = FALSE ]; then
else
# exec normally
printf "${cyan}\nRunning NGINX on %s (TLS 1.2)...${norm}\n" "$container_name"
docker run --rm -d --name ${container_name} \
docker run -d --name ${container_name} \
--env-file ab-nginx.params \
$vmount \
-v "$SSL_CERT":/certs/fullchain.pem:ro \
@ -232,7 +233,7 @@ elif [ "$SSL_CERT" ] && [ "$TLS13_ONLY" = TRUE ]; then
else
# exec normally
printf "${cyan}\nRunning NGINX on %s (TLS 1.3)...${norm}\n" "$container_name"
docker run --rm -d --name ${container_name} \
docker run -d --name ${container_name} \
--env-file ab-nginx.params \
$vmount \
-v "$SSL_CERT":/certs/fullchain.pem:ro \
@ -246,4 +247,4 @@ fi
### exit gracefully
exit 0
exit 0

View File

@ -41,7 +41,10 @@ scriptHelp () {
printf "'normally': Run in detached mode with openLDAP automatically launched and\n"
printf "logging to stdout. If you specified certificates, openLDAP will require a TLS\n"
printf "connection. All modes of operation allow you to enter the container and\n"
printf "connect directly using UNIX sockets also.\n\n"
printf "connect directly using UNIX sockets also.\n"
printf "Containers run in SHELL mode are ALWAYS removed upon exit as they are meant for\n"
printf "testing only. By default, containers run without '--rm' will be restarted\n"
printf "automatically unless they are manually stopped via 'docker stop...'\n\n"
printf "${magenta}The script has the following parameters:\n"
printf "${cyan}(parameter in cyan) ${yellow}(default in yellow)${norm}\n\n"
printf "${cyan}-n|--name${norm}\n"
@ -113,7 +116,7 @@ while [ $# -gt 0 ]; do
;;
--rm|--remove)
# remove container on exit
remove="--rm"
remove=1
;;
-s|--shell)
# start shell instead of default CMD
@ -142,7 +145,7 @@ while [ $# -gt 0 ]; do
done
# cleanup and running containers and volumes
# cleanup any running containers and volumes
if [ $clean = true ]; then
# get all ab-openldap containers
containers=$(docker ps -a --no-trunc --filter "label=org.label-schema.name=ab-openldap" --format "{{ .Names }}")
@ -171,25 +174,32 @@ elif [ -z "$TLS_CERT" ]; then
if [ $shell = true ]; then
# exec shell
printf "${cyan}\nRunning SHELL on %s...${norm}\n" "$container_name"
docker run ${remove} -it --name ${container_name} \
docker run --rm -it --name ${container_name} \
--env-file ab-openldap.params \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh
else
# exec normally
printf "${cyan}\nRunning OPENLDAP on %s...${norm}\n" "$container_name"
docker run ${remove} -d --name ${container_name} \
--env-file ab-openldap.params \
-p 389:389 -p 636:636 \
--restart unless-stopped \
docker.asifbacchus.app/ldap/ab-openldap:latest
if [ "$remove" -eq 1 ]; then
docker run --rm -d --name ${container_name} \
--env-file ab-openldap.params \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest
else
docker run -d --name ${container_name} \
--env-file ab-openldap.params \
-p 389:389 -p 636:636 \
--restart unless-stopped \
docker.asifbacchus.app/ldap/ab-openldap:latest
fi
fi
# run with TLS
elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
if [ $shell = true ]; then
# exec shell
printf "${cyan}\nRunning SHELL on %s (TLS)...${norm}\n" "$container_name"
docker run ${remove} -it --name ${container_name} \
docker run --rm -it --name ${container_name} \
--env-file ab-openldap.params \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
@ -199,14 +209,24 @@ elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
else
# exec normally
printf "${cyan}\nRunning OPENLDAP on %s (TLS)...${norm}\n" "$container_name"
docker run ${remove} -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
-v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \
--restart unless-stopped \
docker.asifbacchus.app/ldap/ab-openldap:latest
if [ "$remove" -eq 1 ]; then
docker run --rm -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
-v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest
else
docker run -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
-v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \
--restart unless-stopped \
docker.asifbacchus.app/ldap/ab-openldap:latest
fi
fi
fi