refactor: lego outputs to /opt/backup/certs/, one backup directory
This commit is contained in:
parent
c7d25c0107
commit
6d87718b43
2 changed files with 2 additions and 10 deletions
10
deploy.sh
10
deploy.sh
|
|
@ -113,19 +113,11 @@ if [ "$GREENFIELD" = true ]; then
|
||||||
echo "[INFO] .env deployed from backup"
|
echo "[INFO] .env deployed from backup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy certificates from backup vault or lego cache to Zoraxy cert dir
|
# Copy certificates from backup vault to Zoraxy cert dir
|
||||||
for DOMAIN_SUB in app dns www; do
|
for DOMAIN_SUB in app dns www; do
|
||||||
FQDN="${DOMAIN_SUB}.${DOMAIN}"
|
FQDN="${DOMAIN_SUB}.${DOMAIN}"
|
||||||
CERT_SRC="$BACKUP_DIR/certs/${FQDN}/fullchain.pem"
|
CERT_SRC="$BACKUP_DIR/certs/${FQDN}/fullchain.pem"
|
||||||
KEY_SRC="$BACKUP_DIR/certs/${FQDN}/privkey.pem"
|
KEY_SRC="$BACKUP_DIR/certs/${FQDN}/privkey.pem"
|
||||||
# Fallback to lego's SAN cert (named after first domain)
|
|
||||||
if [ ! -f "$CERT_SRC" ] && [ -d "$BACKUP_DIR/lego/certificates" ]; then
|
|
||||||
LECHO=$(ls "$BACKUP_DIR/lego/certificates/"*.crt 2>/dev/null | grep -v issuer | head -1)
|
|
||||||
if [ -n "$LECHO" ]; then
|
|
||||||
CERT_SRC="$LECHO"
|
|
||||||
KEY_SRC="${LECHO%.crt}.key"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -f "$CERT_SRC" ] && [ -f "$KEY_SRC" ]; then
|
if [ -f "$CERT_SRC" ] && [ -f "$KEY_SRC" ]; then
|
||||||
cp "$CERT_SRC" "$TARGET_DIR/config/zoraxy/conf/certs/${FQDN}.crt"
|
cp "$CERT_SRC" "$TARGET_DIR/config/zoraxy/conf/certs/${FQDN}.crt"
|
||||||
cp "$KEY_SRC" "$TARGET_DIR/config/zoraxy/conf/certs/${FQDN}.key"
|
cp "$KEY_SRC" "$TARGET_DIR/config/zoraxy/conf/certs/${FQDN}.key"
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ func runCert(args []string) {
|
||||||
domainsStr := fs.String("domains", "", "Comma-separated domain list")
|
domainsStr := fs.String("domains", "", "Comma-separated domain list")
|
||||||
email := fs.String("email", "", "ACME email")
|
email := fs.String("email", "", "ACME email")
|
||||||
backupDir := fs.String("backup-dir", "/opt/backup/certs", "Backup directory for certs")
|
backupDir := fs.String("backup-dir", "/opt/backup/certs", "Backup directory for certs")
|
||||||
legoDir := fs.String("lego-dir", "/opt/backup/lego", "Lego working directory")
|
legoDir := fs.String("lego-dir", "/opt/backup/certs", "Lego working directory")
|
||||||
fs.Parse(args)
|
fs.Parse(args)
|
||||||
|
|
||||||
if *domainsStr == "" || *email == "" {
|
if *domainsStr == "" || *email == "" {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue