mirror of
https://github.com/element-hq/element-docker-demo.git
synced 2026-01-25 14:31:09 +03:00
more LE fixes
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
# taken from https://raw.githubusercontent.com/wmnnd/nginx-certbot/refs/heads/master/init-letsencrypt.sh
|
||||
|
||||
if ! [ -x "$(command -v docker-compose)" ]; then
|
||||
echo 'Error: docker-compose is not installed.' >&2
|
||||
set -x
|
||||
|
||||
if ! [ -x "$(command -v docker)" ]; then
|
||||
echo 'Error: dockeris not installed.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -12,7 +14,7 @@ domains=$DOMAINS
|
||||
rsa_key_size=4096
|
||||
data_path="./data/certbot"
|
||||
read -p "admin email address for letsencrypt: " email
|
||||
staging=0 # Set to 1 if you're testing your setup to avoid hitting request limits
|
||||
staging=1 # Set to 1 if you're testing your setup to avoid hitting request limits
|
||||
|
||||
if [ -d "$data_path" ]; then
|
||||
read -p "Existing data found for $domains. Continue and replace existing certificate? (y/N) " decision
|
||||
@@ -33,7 +35,7 @@ echo "### Creating dummy certificate for $domains ..."
|
||||
# N.B. in bash, $domains will return the first value of the array in string context, so this is not a bug:
|
||||
path="/etc/letsencrypt/live/$domains"
|
||||
mkdir -p "$data_path/conf/live/$domains"
|
||||
docker-compose run --rm --entrypoint "\
|
||||
docker compose run --rm --entrypoint "\
|
||||
openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\
|
||||
-keyout '$path/privkey.pem' \
|
||||
-out '$path/fullchain.pem' \
|
||||
@@ -42,11 +44,13 @@ docker-compose run --rm --entrypoint "\
|
||||
echo
|
||||
|
||||
echo "### Starting nginx ..."
|
||||
docker-compose up --force-recreate -d nginx
|
||||
docker compose up --force-recreate -d nginx
|
||||
echo
|
||||
|
||||
exit
|
||||
|
||||
echo "### Deleting dummy certificate for $domains ..."
|
||||
docker-compose run --rm --entrypoint "\
|
||||
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
|
||||
@@ -69,7 +73,7 @@ esac
|
||||
# Enable staging mode if needed
|
||||
if [ $staging != "0" ]; then staging_arg="--staging"; fi
|
||||
|
||||
docker-compose run --rm --entrypoint "\
|
||||
docker compose run --rm --entrypoint "\
|
||||
certbot certonly --webroot -w /var/www/certbot \
|
||||
$staging_arg \
|
||||
$email_arg \
|
||||
@@ -80,4 +84,4 @@ docker-compose run --rm --entrypoint "\
|
||||
echo
|
||||
|
||||
echo "### Reloading nginx ..."
|
||||
docker-compose exec nginx nginx -s reload
|
||||
docker compose exec nginx nginx -s reload
|
||||
|
||||
Reference in New Issue
Block a user