new sslproxy xai cli commands cerbot info and renewal
This commit is contained in:
31
dockerfiles/services/sslproxy/cli/certbot/certbot
Executable file
31
dockerfiles/services/sslproxy/cli/certbot/certbot
Executable 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
|
||||
3
dockerfiles/services/sslproxy/cli/certbot/certbot.help
Normal file
3
dockerfiles/services/sslproxy/cli/certbot/certbot.help
Normal file
@@ -0,0 +1,3 @@
|
||||
ARGS - The arguments you wish to provide to this command
|
||||
|
||||
TODO: Fill out the help information for this command.
|
||||
1
dockerfiles/services/sslproxy/cli/certbot/certbot.usage
Normal file
1
dockerfiles/services/sslproxy/cli/certbot/certbot.usage
Normal file
@@ -0,0 +1 @@
|
||||
ARGS...
|
||||
22
dockerfiles/services/sslproxy/cli/certbot/info
Executable file
22
dockerfiles/services/sslproxy/cli/certbot/info
Executable 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
|
||||
3
dockerfiles/services/sslproxy/cli/certbot/info.help
Normal file
3
dockerfiles/services/sslproxy/cli/certbot/info.help
Normal file
@@ -0,0 +1,3 @@
|
||||
ARGS - The arguments you wish to provide to this command
|
||||
|
||||
TODO: Fill out the help information for this command.
|
||||
1
dockerfiles/services/sslproxy/cli/certbot/info.usage
Normal file
1
dockerfiles/services/sslproxy/cli/certbot/info.usage
Normal file
@@ -0,0 +1 @@
|
||||
ARGS...
|
||||
83
dockerfiles/services/sslproxy/cli/certbot/renew
Executable file
83
dockerfiles/services/sslproxy/cli/certbot/renew
Executable 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 $@
|
||||
3
dockerfiles/services/sslproxy/cli/certbot/renew.help
Normal file
3
dockerfiles/services/sslproxy/cli/certbot/renew.help
Normal file
@@ -0,0 +1,3 @@
|
||||
ARGS - The arguments you wish to provide to this command
|
||||
|
||||
TODO: Fill out the help information for this command.
|
||||
1
dockerfiles/services/sslproxy/cli/certbot/renew.usage
Normal file
1
dockerfiles/services/sslproxy/cli/certbot/renew.usage
Normal file
@@ -0,0 +1 @@
|
||||
ARGS...
|
||||
Reference in New Issue
Block a user