mirror of
https://github.com/michelleDeko/scalelite-run.git
synced 2025-12-16 14:22:11 +01:00
Changed init-letsencrypt.sh
This commit is contained in:
@@ -79,23 +79,45 @@ fi
|
||||
echo "### Creating dummy certificate for $domains ..."
|
||||
path="/etc/letsencrypt/live/$domains"
|
||||
mkdir -p "$data_path/conf/live/$domains"
|
||||
if [ -x "$(command -v docker-compose)" ]; then
|
||||
docker-compose run --rm --entrypoint "\
|
||||
openssl req -x509 -nodes -newkey rsa:2048 -days 1\
|
||||
-keyout '$path/privkey.pem' \
|
||||
-out '$path/fullchain.pem' \
|
||||
-subj '/CN=localhost'" certbot
|
||||
echo
|
||||
elif [ -x "$(command -v docker compose)" ]; then
|
||||
docker compose run --rm --entrypoint "\
|
||||
openssl req -x509 -nodes -newkey rsa:2048 -days 1\
|
||||
-keyout '$path/privkey.pem' \
|
||||
-out '$path/fullchain.pem' \
|
||||
-subj '/CN=localhost'" certbot
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "### Starting scalelite-proxy ..."
|
||||
if [ -x "$(command -v docker-compose)" ]; then
|
||||
docker-compose up --force-recreate -d scalelite-proxy
|
||||
echo
|
||||
elif [ -x "$(command -v docker compose)" ]; then
|
||||
docker compose up --force-recreate -d scalelite-proxy
|
||||
fi
|
||||
echo
|
||||
|
||||
echo "### Deleting dummy certificate for $domains ..."
|
||||
if [ -x "$(command -v docker-compose)" ]; then
|
||||
docker-compose run --rm --entrypoint "\
|
||||
rm -Rf /etc/letsencrypt/live/$domains && \
|
||||
rm -Rf /etc/letsencrypt/archive/$domains && \
|
||||
rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot
|
||||
echo
|
||||
elif [ -x "$(command -v docker compose)" ]; then
|
||||
docker compose run --rm --entrypoint "\
|
||||
rm -Rf /etc/letsencrypt/live/$domains && \
|
||||
rm -Rf /etc/letsencrypt/archive/$domains && \
|
||||
rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "### Requesting Let's Encrypt certificate for $domains ..."
|
||||
#Join $domains to -d args
|
||||
@@ -113,6 +135,7 @@ esac
|
||||
# Enable staging mode if needed
|
||||
if [ $staging != "0" ]; then staging_arg="--staging"; fi
|
||||
|
||||
if [ -x "$(command -v docker-compose)" ]; then
|
||||
docker-compose run --rm --entrypoint "\
|
||||
certbot certonly --webroot -w /var/www/certbot \
|
||||
$staging_arg \
|
||||
@@ -124,6 +147,19 @@ docker-compose run --rm --entrypoint "\
|
||||
--debug-challenges \
|
||||
--force-renewal" certbot
|
||||
echo
|
||||
elif [ -x "$(command -v docker compose)" ]; then
|
||||
docker-compose run --rm --entrypoint "\
|
||||
certbot certonly --webroot -w /var/www/certbot \
|
||||
$staging_arg \
|
||||
$([ "$interactive" -ne 1 ] && echo '--non-interactive') \
|
||||
$email_arg \
|
||||
$domain_args \
|
||||
--rsa-key-size $rsa_key_size \
|
||||
--agree-tos \
|
||||
--debug-challenges \
|
||||
--force-renewal" certbot
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "### Reloading scalelite-proxy..."
|
||||
docker-compose exec $([ "$interactive" -ne 1 ] && echo "-T") scalelite-proxy nginx -s reload
|
||||
|
||||
Reference in New Issue
Block a user