Add certbot set up to bootstrap

This commit is contained in:
2021-04-04 22:17:13 +01:00
parent f8b2dc47f3
commit 99b7f7e05b
3 changed files with 38 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ passwd -l root
# Install necessary packages
echo "------- Installing packages -------"
pacman -S --needed --noconfirm sudo wget tmux htop vim docker docker-compose git ufw
pacman -S --needed --noconfirm sudo wget tmux htop vim docker docker-compose git ufw certbot certbot-dns-digitalocean
echo "------- Setting up SSH -------"
# Remove old SSH keys in case running again
@@ -52,6 +52,27 @@ chmod +x /app/gitea/gitea
chown -R git /app/gitea/gitea
chown -R git /var/lib/gitea
if [ $APP_ENV = "production" ]
then
echo "------- Enabling certbot service -------"
mkdir -p /root/.secret/certbot
tee /root/.secret/certbot/digitalocean.ini <<END
# DigitalOcean API credentials used by Certbot
dns_digitalocean_token = $DIGITALOCEAN_TOKEN
END
certbot certonly \
--dns-digitalocean \
--dns-digitalocean-credentials /root/.secret/certbot/digitalocean.ini \
-d *.$DOMAIN -d $DOMAIN \
-m stofflees@gmail.com \
--agree-tos \
--no-eff-email
cp /opt/scarif/certbot/* /etc/systemd/system/
systemctl enable --now certbot.timer
fi
echo "------- Adding config folders for jitsi -------"
mkdir -p /opt/jitsi/{web/letsencrypt,transcripts,prosody/config,prosody/prosody-plugins-custom,jicofo,jvb,jigasi,jibri}