mirror of
https://github.com/element-hq/element-docker-demo.git
synced 2026-01-25 06:26:58 +03:00
fix multidomain LE
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
# These env vars get templated into the configs in the respective containers via init scripts.
|
# These env vars get templated into the configs in the respective containers via init scripts.
|
||||||
#
|
#
|
||||||
# If you want to make more customisations then either edit the templates to add more env variables below
|
# If you want to make more customisations then either edit the templates to add more env variables below
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ services:
|
|||||||
- ${VOLUME_PATH}/data/ssl:/data/ssl
|
- ${VOLUME_PATH}/data/ssl:/data/ssl
|
||||||
entrypoint: "/bin/sh -c 'trap exit TERM; \
|
entrypoint: "/bin/sh -c 'trap exit TERM; \
|
||||||
while [ -e /etc/letsencrypt/live ]; \
|
while [ -e /etc/letsencrypt/live ]; \
|
||||||
do certbot --webroot -w /var/www/certbot renew; \
|
do sleep 30; certbot --webroot -w /var/www/certbot renew; \
|
||||||
cp /etc/letsencrypt/live/$DOMAIN/*.pem /data/ssl; \
|
cp /etc/letsencrypt/live/$DOMAIN/*.pem /data/ssl; \
|
||||||
sleep 12h & wait $${!}; \
|
sleep 12h & wait $${!}; \
|
||||||
done;'"
|
done;'"
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
# taken from https://raw.githubusercontent.com/wmnnd/nginx-certbot/refs/heads/master/init-letsencrypt.sh
|
# taken from https://raw.githubusercontent.com/wmnnd/nginx-certbot/refs/heads/master/init-letsencrypt.sh
|
||||||
|
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
if ! [ -x "$(command -v docker)" ]; then
|
if ! [ -x "$(command -v docker)" ]; then
|
||||||
echo 'Error: docker is not installed.' >&2
|
echo 'Error: docker is not installed.' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. .env
|
source .env
|
||||||
domains=$DOMAINS
|
domains=("${DOMAINS[@]}") # deep copy the array
|
||||||
rsa_key_size=4096
|
rsa_key_size=4096
|
||||||
data_path="./data/certbot"
|
data_path="./data/certbot"
|
||||||
read -p "admin email address for letsencrypt: " email
|
read -p "admin email address for letsencrypt: " email
|
||||||
|
|||||||
7
setup.sh
7
setup.sh
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
#set -x
|
||||||
|
|
||||||
# set up data & secrets dir with the right ownerships in the default location
|
# set up data & secrets dir with the right ownerships in the default location
|
||||||
# to stop docker autocreating them with random owners.
|
# to stop docker autocreating them with random owners.
|
||||||
@@ -25,9 +25,8 @@ if [[ ! -e .env ]]; then
|
|||||||
sed -ir s/example.com/$DOMAIN/ .env
|
sed -ir s/example.com/$DOMAIN/ .env
|
||||||
|
|
||||||
# SSL setup
|
# SSL setup
|
||||||
mkdir -p data/certbot/{conf,www} # stop broken binds
|
|
||||||
read -p "Use local mkcert CA for SSL? [y/n] " use_mkcert
|
read -p "Use local mkcert CA for SSL? [y/n] " use_mkcert
|
||||||
if [[ use_mkcert =~ [Yy] ]]; then
|
if [[ "$use_mkcert" =~ ^[Yy]$ ]]; then
|
||||||
if [[ ! -x mkcert ]]; then
|
if [[ ! -x mkcert ]]; then
|
||||||
echo "Please install mkcert from brew/apt/yum etc"
|
echo "Please install mkcert from brew/apt/yum etc"
|
||||||
exit
|
exit
|
||||||
@@ -43,7 +42,7 @@ if [[ ! -e .env ]]; then
|
|||||||
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > "data/ssl/ssl-dhparams.pem"
|
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > "data/ssl/ssl-dhparams.pem"
|
||||||
else
|
else
|
||||||
read -p "Use letsencrypt for SSL? [y/n] " use_letsencrypt
|
read -p "Use letsencrypt for SSL? [y/n] " use_letsencrypt
|
||||||
if [[ use_letsencrypt =~ [Yy] ]]; then
|
if [[ "$use_letsencrypt" =~ ^[Yy]$ ]]; then
|
||||||
mkdir -p data/ssl
|
mkdir -p data/ssl
|
||||||
touch data/ssl/ca-certificates.crt # will get overwritten by init-letsencrypt.sh
|
touch data/ssl/ca-certificates.crt # will get overwritten by init-letsencrypt.sh
|
||||||
source ./init-letsencrypt.sh
|
source ./init-letsencrypt.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user