Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: Restore ability to generate SSL certs with LetsEncrypt. #391

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@ RUN \
rm -f /etc/zulip/zulip-secrets.conf /etc/zulip/settings.py && \
apt-get -qq autoremove --purge -y && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
mv /etc/letsencrypt /etc/letsencrypt.zulip
# ^ Zulip Server installs LetsEncrypt with some default settings. We want to
# allow /etc/letsencrypt to be volume mountable from the host while retaining
# these settings unless overridden, so let's unclobber this path so that
# entrypoint.sh can symlink from the volume mount and repopulate any missing
# default files.
#
# This incantation must be part of the same layer that creates
# /etc/letsencrypt/renewal-hooks to avoid Directory Not Empty / Invalid
# Argument errors attempting to rename or unlink it.

COPY entrypoint.sh /sbin/entrypoint.sh
COPY certbot-deploy-hook /sbin/certbot-deploy-hook
Expand Down
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ SETTINGS_PY="/etc/zulip/settings.py"
# === initialConfiguration ===
prepareDirectories() {
mkdir -p "$DATA_DIR" "$DATA_DIR/backups" "$DATA_DIR/certs" "$DATA_DIR/letsencrypt" "$DATA_DIR/uploads"
[ -e /etc/letsencrypt ] || ln -ns "$DATA_DIR/letsencrypt" /etc/letsencrypt

# See commentary in the Dockerfile about this process.
ln -Ts "${DATA_DIR}/letsencrypt" /etc/letsencrypt
cp -an /etc/letsencrypt.zulip/* /etc/letsencrypt/

echo "Preparing and linking the uploads folder ..."
rm -rf /home/zulip/uploads
ln -sfT "$DATA_DIR/uploads" /home/zulip/uploads
Expand Down