mirror of
https://github.com/element-hq/element-docker-demo.git
synced 2026-01-25 06:26:58 +03:00
more LE fixes
This commit is contained in:
@@ -85,8 +85,6 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
init:
|
init:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
synapse:
|
|
||||||
condition: service_started
|
|
||||||
|
|
||||||
certbot:
|
certbot:
|
||||||
image: certbot/certbot:latest
|
image: certbot/certbot:latest
|
||||||
@@ -95,11 +93,6 @@ services:
|
|||||||
- ${VOLUME_PATH}/data/certbot/conf:/etc/letsencrypt
|
- ${VOLUME_PATH}/data/certbot/conf:/etc/letsencrypt
|
||||||
- ${VOLUME_PATH}/data/certbot/www:/var/www/certbot
|
- ${VOLUME_PATH}/data/certbot/www:/var/www/certbot
|
||||||
entrypoint: "/bin/sh -c 'trap exit TERM; while [ -e /etc/letsencrypt/live ]; do certbot renew; sleep 12h & wait $${!}; done;'"
|
entrypoint: "/bin/sh -c 'trap exit TERM; while [ -e /etc/letsencrypt/live ]; do certbot renew; sleep 12h & wait $${!}; done;'"
|
||||||
depends_on:
|
|
||||||
init:
|
|
||||||
condition: service_completed_successfully
|
|
||||||
nginx:
|
|
||||||
condition: service_started
|
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
|
|||||||
@@ -14,14 +14,12 @@ server {
|
|||||||
|
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
# location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
# root /var/www/certbot;
|
root /var/www/certbot;
|
||||||
# add_header Access-Control-Allow-Origin *;
|
}
|
||||||
# }
|
|
||||||
|
|
||||||
location /.well-known/matrix/ {
|
location /.well-known/matrix/ {
|
||||||
root /var/www;
|
root /var/www;
|
||||||
#add_header Access-Control-Allow-Origin *;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# XXX: is this right? or should auth.$DOMAIN be the issuer?
|
# XXX: is this right? or should auth.$DOMAIN be the issuer?
|
||||||
@@ -29,7 +27,6 @@ server {
|
|||||||
proxy_pass http://mas:8080;
|
proxy_pass http://mas:8080;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header X-Forwarded-For ${DOLLAR}remote_addr;
|
proxy_set_header X-Forwarded-For ${DOLLAR}remote_addr;
|
||||||
#add_header Access-Control-Allow-Origin *;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@@ -45,7 +42,6 @@ server {
|
|||||||
|
|
||||||
location /.well-known/matrix/ {
|
location /.well-known/matrix/ {
|
||||||
root /var/www;
|
root /var/www;
|
||||||
#add_header Access-Control-Allow-Origin *;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# XXX: is this right? or should auth.$DOMAIN be the issuer?
|
# XXX: is this right? or should auth.$DOMAIN be the issuer?
|
||||||
@@ -53,7 +49,6 @@ server {
|
|||||||
proxy_pass http://mas:8080;
|
proxy_pass http://mas:8080;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header X-Forwarded-For ${DOLLAR}remote_addr;
|
proxy_set_header X-Forwarded-For ${DOLLAR}remote_addr;
|
||||||
#add_header Access-Control-Allow-Origin *;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
if ! [ -x "$(command -v docker-compose)" ]; then
|
set -x
|
||||||
echo 'Error: docker-compose is not installed.' >&2
|
|
||||||
|
if ! [ -x "$(command -v docker)" ]; then
|
||||||
|
echo 'Error: dockeris not installed.' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -12,7 +14,7 @@ domains=$DOMAINS
|
|||||||
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
|
||||||
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
|
if [ -d "$data_path" ]; then
|
||||||
read -p "Existing data found for $domains. Continue and replace existing certificate? (y/N) " decision
|
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:
|
# 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"
|
path="/etc/letsencrypt/live/$domains"
|
||||||
mkdir -p "$data_path/conf/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\
|
openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\
|
||||||
-keyout '$path/privkey.pem' \
|
-keyout '$path/privkey.pem' \
|
||||||
-out '$path/fullchain.pem' \
|
-out '$path/fullchain.pem' \
|
||||||
@@ -42,11 +44,13 @@ docker-compose run --rm --entrypoint "\
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
echo "### Starting nginx ..."
|
echo "### Starting nginx ..."
|
||||||
docker-compose up --force-recreate -d nginx
|
docker compose up --force-recreate -d nginx
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
echo "### Deleting dummy certificate for $domains ..."
|
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/live/$domains && \
|
||||||
rm -Rf /etc/letsencrypt/archive/$domains && \
|
rm -Rf /etc/letsencrypt/archive/$domains && \
|
||||||
rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot
|
rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot
|
||||||
@@ -69,7 +73,7 @@ esac
|
|||||||
# Enable staging mode if needed
|
# Enable staging mode if needed
|
||||||
if [ $staging != "0" ]; then staging_arg="--staging"; fi
|
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 \
|
certbot certonly --webroot -w /var/www/certbot \
|
||||||
$staging_arg \
|
$staging_arg \
|
||||||
$email_arg \
|
$email_arg \
|
||||||
@@ -80,4 +84,4 @@ docker-compose run --rm --entrypoint "\
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
echo "### Reloading nginx ..."
|
echo "### Reloading nginx ..."
|
||||||
docker-compose exec nginx nginx -s reload
|
docker compose exec nginx nginx -s reload
|
||||||
|
|||||||
Reference in New Issue
Block a user