Ver código fonte

Add Let's Encrypt certificate to Nextcloud

multi_domain
ßingen 8 anos atrás
pai
commit
69f8b866f4
6 arquivos alterados com 41 adições e 3 exclusões
  1. +1
    -0
      deploy.sh
  2. +1
    -1
      images/rpi-haproxy
  3. +1
    -1
      images/rpi-nextcloud
  4. +28
    -0
      letsencrypt.sh
  5. +2
    -0
      nextcloud.env.template
  6. +8
    -1
      setup.sh

+ 1
- 0
deploy.sh Ver arquivo

@@ -30,3 +30,4 @@ sleep 60
# ##### Add users to LDAP ###### #

./add_users.sh ${STACK_NAME}
./letsencrypt.sh ${STACK_NAME}

+ 1
- 1
images/rpi-haproxy

@@ -1 +1 @@
Subproject commit 33fb70215bafd1def461ddc84d2b0bd800366851
Subproject commit a735079c742cb4e0aaad9e47029f280b2dbaf0d6

+ 1
- 1
images/rpi-nextcloud

@@ -1 +1 @@
Subproject commit b61004fadf280b4884effc9a2b0d7cf7ad2fb869
Subproject commit c75f25bb9657aa862e240b6c9f13a8cc7afdb922

+ 28
- 0
letsencrypt.sh Ver arquivo

@@ -0,0 +1,28 @@
#!/bin/bash

STACK_NAME=$1

if [ $# -eq 0 ]; then
echo "You must pass stack name as a parameter"
exit 1
fi

# ##### Add Let's Encrypt certificates ###### #

# Find Nextcloud container
SERVICE=nextcloud
host=$(docker stack ps ${STACK_NAME} | grep Running | grep ${SERVICE} | awk '{ print $4 }')
#echo Host=$host
if [ -z $host ]; then
echo "No host found!";
exit 1;
fi
container=$(ssh $host 'docker ps | grep '${SERVICE}' | cut -f1 -d" "')
#echo Container=$container
if [ -z $container ]; then
echo "Qué me estás container?!";
exit 1;
fi

# Run script in container
ssh $host "docker exec ${container} sh -c '/usr/local/bin/letsencrypt.sh'"

+ 2
- 0
nextcloud.env.template Ver arquivo

@@ -15,3 +15,5 @@ MYSQL_ROOT_PWD_FILE=/run/secrets/mysql_pwd
DB_HOST=db
NEXTCLOUD_DB_NAME=nextcloud
NEXTCLOUD_DB_USER=nextcloud
# Let's Encrypt
LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}

+ 8
- 1
setup.sh Ver arquivo

@@ -54,6 +54,11 @@ if [[ ${#nextcloud_admin_pwd} -eq 0 ]]; then
nextcloud_admin_pwd=`eval "$PWD_GEN"`
fi

read -p "E-mail for Let's Encrypt account (admin@${domain}): " letsencrypt_email
if [[ ${#letsencrypt_email} -eq 0 ]]; then
letsencrypt_email=admin@${domain}
fi

echo "If you have a password salt and a secret from a previous installation, provide them here."
echo "They are used by Passman and need to remain the same for the vaults to be accessible"
read -p "Nextcloud Pwd Salt (a random one will be generated by NC if empty): " nextcloud_salt
@@ -74,6 +79,7 @@ echo Your domain is: $domain
echo Your Volumes path is: $volumes
echo Your LDAP Mail Bind DN Uid is: $ldap_mail_uid
echo Your LDAP Nextcloud Bind DN Uid is: $ldap_nextcloud_uid
echo Your Let\'s Encrypt account e-mail: $letsencrypt_email

echo $'\E[1;37m'
read -p "Are These Settings Correct? Yes (y), No (n): " confirm
@@ -115,7 +121,8 @@ for i in `ls *.env .env`; do
sed -i "s/\${VOLUMES_PATH}/${volumes//\//\\/}/g" $i
sed -i "s/\${MAIL_LDAP_UID}/${ldap_mail_uid}/g" $i
sed -i "s/\${NEXTCLOUD_LDAP_UID}/${ldap_nextcloud_uid}/g" $i
#sed -i "s/\${}/$/g" $i
sed -i "s/\${LETSENCRYPT_EMAIL}/${letsencrypt_email}/g" $i
#sed -i "s/\${}/${}/g" $i
done;

# read variables

Carregando…
Cancelar
Salvar