mirror of
https://github.com/element-hq/element-docker-demo.git
synced 2026-01-25 06:26:58 +03:00
in theory make LE work
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
# n.b. SECRETS_* env variables get pulled in on demand from files in ./secrets
|
# n.b. SECRETS_* env variables get pulled in on demand from files in ./secrets
|
||||||
|
|
||||||
# XXX: how do we interpolate this in?
|
|
||||||
USER_ID=
|
USER_ID=
|
||||||
GROUP_ID=
|
GROUP_ID=
|
||||||
|
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -11,22 +11,7 @@ into their ESS counterparts, and rehoming the postgres).
|
|||||||
## To run
|
## To run
|
||||||
|
|
||||||
```
|
```
|
||||||
# pick a domain name:
|
./setup.sh
|
||||||
DOMAIN=shadowfax.local
|
|
||||||
|
|
||||||
# grab a TLS certificate for the server:
|
|
||||||
brew install mkcert || apt-get install mkcert
|
|
||||||
mkcert -install
|
|
||||||
mkcert $DOMAIN '*.'$DOMAIN
|
|
||||||
mkdir -p data/nginx/ssl
|
|
||||||
mv ${DOMAIN}+1.pem data/nginx/ssl/cert.pem
|
|
||||||
mv ${DOMAIN}+1-key.pem data/nginx/ssl/key.pem
|
|
||||||
cp "$(mkcert -CAROOT)"/rootCA.pem data/nginx/ssl
|
|
||||||
|
|
||||||
# make an .env to configure your environment
|
|
||||||
cp .env-sample .env
|
|
||||||
sed -ir s/example.com/$DOMAIN/ .env
|
|
||||||
|
|
||||||
docker compose up
|
docker compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -55,7 +40,7 @@ docker compose exec mas mas-cli -c /data/config.yaml doctor
|
|||||||
|
|
||||||
* [x] sort out the networking
|
* [x] sort out the networking
|
||||||
* [x] make nginx do something useful when running on a local workstation
|
* [x] make nginx do something useful when running on a local workstation
|
||||||
* [ ] hook up letsencrypt to nginx properly
|
* [x] hook up letsencrypt to nginx properly
|
||||||
* [x] hook up livekit properly
|
* [x] hook up livekit properly
|
||||||
* [x] make it work
|
* [x] make it work
|
||||||
|
|
||||||
|
|||||||
36
compose.yml
36
compose.yml
@@ -72,9 +72,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${VOLUME_PATH}/data/nginx/conf.d:/etc/nginx/conf.d
|
- ${VOLUME_PATH}/data/nginx/conf.d:/etc/nginx/conf.d
|
||||||
- ${VOLUME_PATH}/data/nginx/www:/var/www
|
- ${VOLUME_PATH}/data/nginx/www:/var/www
|
||||||
- ${VOLUME_PATH}/data/nginx/ssl:/etc/nginx/ssl
|
- ${VOLUME_PATH}/data/ssl:/etc/nginx/ssl
|
||||||
# - ${VOLUME_PATH}/data/certbot/conf:/etc/letsencrypt
|
|
||||||
# - ${VOLUME_PATH}/data/certbot/www:/var/www/certbot
|
|
||||||
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
||||||
networks:
|
networks:
|
||||||
backend:
|
backend:
|
||||||
@@ -90,16 +88,18 @@ services:
|
|||||||
synapse:
|
synapse:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
|
||||||
# certbot:
|
certbot:
|
||||||
# image: certbot/certbot:latest
|
image: certbot/certbot:latest
|
||||||
# restart: unless-stopped
|
restart: unless-stopped
|
||||||
# volumes:
|
volumes:
|
||||||
# - ${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 :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
||||||
# depends_on:
|
depends_on:
|
||||||
# init:
|
init:
|
||||||
# condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
|
nginx:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
@@ -143,7 +143,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ${VOLUME_PATH}/data/synapse:/data:rw
|
- ${VOLUME_PATH}/data/synapse:/data:rw
|
||||||
- ${VOLUME_PATH}/data/nginx/ssl/rootCA.pem:/etc/ssl/certs/ca-certificates.crt
|
- ${VOLUME_PATH}/data/nginx/ssl/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt
|
||||||
# ports:
|
# ports:
|
||||||
# - 8008:8008
|
# - 8008:8008
|
||||||
networks:
|
networks:
|
||||||
@@ -175,7 +175,7 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
volumes:
|
volumes:
|
||||||
- ${VOLUME_PATH}/data/synapse:/data:rw
|
- ${VOLUME_PATH}/data/synapse:/data:rw
|
||||||
- ${VOLUME_PATH}/data/nginx/ssl/rootCA.pem:/etc/ssl/certs/ca-certificates.crt
|
- ${VOLUME_PATH}/data/nginx/ssl/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt
|
||||||
environment:
|
environment:
|
||||||
SYNAPSE_WORKER: synapse.app.generic_worker
|
SYNAPSE_WORKER: synapse.app.generic_worker
|
||||||
# Expose port if required so your reverse proxy can send requests to this worker
|
# Expose port if required so your reverse proxy can send requests to this worker
|
||||||
@@ -198,7 +198,7 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
volumes:
|
volumes:
|
||||||
- ${VOLUME_PATH}/data/synapse:/data:rw # Replace VOLUME_PATH with the path to your Synapse volume
|
- ${VOLUME_PATH}/data/synapse:/data:rw # Replace VOLUME_PATH with the path to your Synapse volume
|
||||||
- ${VOLUME_PATH}/data/nginx/ssl/rootCA.pem:/etc/ssl/certs/ca-certificates.crt
|
- ${VOLUME_PATH}/data/nginx/ssl/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt
|
||||||
environment:
|
environment:
|
||||||
SYNAPSE_WORKER: synapse.app.federation_sender
|
SYNAPSE_WORKER: synapse.app.federation_sender
|
||||||
# ports:
|
# ports:
|
||||||
@@ -215,7 +215,7 @@ services:
|
|||||||
# - 8083:8080
|
# - 8083:8080
|
||||||
volumes:
|
volumes:
|
||||||
- ${VOLUME_PATH}/data/mas:/data:rw
|
- ${VOLUME_PATH}/data/mas:/data:rw
|
||||||
- ${VOLUME_PATH}/data/nginx/ssl/rootCA.pem:/etc/ssl/certs/ca-certificates.crt
|
- ${VOLUME_PATH}/data/nginx/ssl/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt
|
||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
# FIXME: do we also need to sync the db?
|
# FIXME: do we also need to sync the db?
|
||||||
@@ -305,7 +305,7 @@ services:
|
|||||||
COPY --from=builder /lk-jwt-service /
|
COPY --from=builder /lk-jwt-service /
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ${VOLUME_PATH}/data/nginx/ssl/rootCA.pem:/etc/ssl/certs/ca-certificates.crt
|
- ${VOLUME_PATH}/data/nginx/ssl/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt
|
||||||
- ${VOLUME_PATH}/init/livekit-jwt-entrypoint.sh:/entrypoint.sh
|
- ${VOLUME_PATH}/init/livekit-jwt-entrypoint.sh:/entrypoint.sh
|
||||||
entrypoint: /entrypoint.sh
|
entrypoint: /entrypoint.sh
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl;
|
||||||
|
|
||||||
# ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
|
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||||
# ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
|
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||||
# include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
||||||
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
||||||
|
|
||||||
ssl_certificate /etc/nginx/ssl/cert.pem;
|
include /etc/nginx/ssl/options-ssl-nginx.conf;
|
||||||
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
ssl_dhparam /etc/nginx/ssl/ssl-dhparams.pem;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ if ! [ -x "$(command -v docker-compose)" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
. .env
|
. .env
|
||||||
domains=($DOMAIN $HOMESERVER_FQDN $ELEMENT_FQDN $CALL_FQDN $MAS_FQDN)
|
domains=$DOMAINS
|
||||||
rsa_key_size=4096
|
rsa_key_size=4096
|
||||||
data_path="./data/certbot"
|
data_path="./data/certbot"
|
||||||
email="" # Adding a valid address is strongly recommended
|
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=0 # Set to 1 if you're testing your setup to avoid hitting request limits
|
||||||
|
|
||||||
if [ -d "$data_path" ]; then
|
if [ -d "$data_path" ]; then
|
||||||
@@ -21,26 +21,26 @@ if [ -d "$data_path" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "data/ssl/options-ssl-nginx.conf" ] || [ ! -e "data/ssl/ssl-dhparams.pem" ]; then
|
||||||
if [ ! -e "$data_path/conf/options-ssl-nginx.conf" ] || [ ! -e "$data_path/conf/ssl-dhparams.pem" ]; then
|
|
||||||
echo "### Downloading recommended TLS parameters ..."
|
echo "### Downloading recommended TLS parameters ..."
|
||||||
mkdir -p "$data_path/conf"
|
mkdir -p "$data_path/conf"
|
||||||
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf > "$data_path/conf/options-ssl-nginx.conf"
|
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf > "data/ssl/options-ssl-nginx.conf"
|
||||||
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > "$data_path/conf/ssl-dhparams.pem"
|
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > "data/ssl/ssl-dhparams.pem"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "### Creating dummy certificate for $domains ..."
|
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"
|
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' \
|
||||||
-subj '/CN=localhost'" certbot
|
-subj '/CN=localhost'; \
|
||||||
|
cp /etc/ssl/certs/ca-certificates.crt '$path'" certbot
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
||||||
echo "### Starting nginx ..."
|
echo "### Starting nginx ..."
|
||||||
docker-compose up --force-recreate -d nginx
|
docker-compose up --force-recreate -d nginx
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user