new sslproxy xai cli commands cerbot info and renewal

This commit is contained in:
2020-06-02 09:10:48 -04:00
parent 73ad921e3b
commit 764aa9c8ed
14 changed files with 196 additions and 53 deletions

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -e
#set -x
LETSENCRYPT_IMAGE=dkregistry.xai-corp.net:5000/xaicorp/acme-certbot
LETSENCRYPT_MOUNT=/opt/shared/letsencrypt-2-staging
export DOCKER_HOST=${DOCKER_HOST:-'dkhost:2376'}
export LETSENCRYPT_MOUNT
export LETSENCRYPT_IMAGE
run() {
docker-compose \
-f docker-compose.tools.yml \
run test $@
}
run_help() {
docker-compose \
-f docker-compose.tools.yml \
run test --help $@
}
while getopts h name
do
case $name in
h) run_help $@;;
*) run $@;;
esac
done

View File

@@ -0,0 +1,3 @@
ARGS - The arguments you wish to provide to this command
TODO: Fill out the help information for this command.

View File

@@ -0,0 +1 @@
ARGS...

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
echo -e TODO: make this work!
set -e
set -x
LETSENCRYPT_IMAGE=dkregistry.xai-corp.net:5000/xaicorp/acme-certbot
LETSENCRYPT_MOUNT=/opt/shared/letsencrypt-2-staging
if [ "$1" == 'prod' ]; then
LETSENCRYPT_MOUNT=/opt/shared/letsencrypt-2
fi
export LETSENCRYPT_MOUNT
export LETSENCRYPT_IMAGE
export DOCKER_HOST=${DOCKER_HOST:-'dkhost:2376'}
# shellcheck disable=SC2068
docker-compose \
-f docker-compose.tools.yml \
run certificates

View File

@@ -0,0 +1,3 @@
ARGS - The arguments you wish to provide to this command
TODO: Fill out the help information for this command.

View File

@@ -0,0 +1 @@
ARGS...

View File

@@ -0,0 +1,83 @@
#!/usr/bin/env bash
set -e
#set -x
LETSENCRYPT_IMAGE=dkregistry.xai-corp.net:5000/xaicorp/acme-certbot
LETSENCRYPT_MOUNT=/opt/shared/letsencrypt-2-staging
LOG=$(mktemp)
##export LOCAL_IMAGE
#export REMOTE_IMAGE
##export TAG
###
run() {
if [ "$ENVIRONMENT" == 'prod' ]; then
LETSENCRYPT_MOUNT=/opt/shared/letsencrypt-2
fi
update
}
update() {
export DOCKER_HOST=${DOCKER_HOST:-'dkhost:2376'}
export LETSENCRYPT_MOUNT
export LETSENCRYPT_IMAGE
# shellcheck disable=SC2086
docker-compose \
-f docker-compose.tools.yml \
run renew ${OPTIONS}
}
function trap_exit() {
code=$?
if [ $code -gt 0 ]; then
echo
rm "$LOG"
echo -e "\033[31mFailed updating production certs \033[39m"
exit $code
fi
rm "$LOG"
echo -e "\033[32mSuccess:\033[39m ssl certs have been updated"
}
trap trap_exit EXIT
print_usage() {
printf "Usage: %s: [-b] [-t] [-s] \n" "$0"
echo -r rollback
echo -t smoke tests
echo -s tag as latest
echo -h help
exit 0
}
######
ENVIRONMENT=dev
OPTIONS=''
while getopts de: name
do
case $name in
d)
OPTIONS="$OPTIONS --dryrun"
;;
e)
if [ $OPTARG == 'prod' ]; then
ENVIRONMENT=prod
else
OPTIONS="$OPTIONS --test-cert"
fi
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
*) print_usage;;
esac
done
# shellcheck disable=SC2068
run $@

View File

@@ -0,0 +1,3 @@
ARGS - The arguments you wish to provide to this command
TODO: Fill out the help information for this command.

View File

@@ -0,0 +1 @@
ARGS...