jean-cloud-services/services/ns1.jean-cloud.org/deploy.sh
2023-10-31 16:42:06 +01:00

62 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
. driglibash-base
. "$(where)/helper_functions.sh"
set -euo pipefail
# Working variables
debian_bind_confdir="/etc/bind"
autoconf_separator=";;; Autogeneration. Do not write under this line! ;;;"
# File that contain "service target" lines
# With service a symbolic dns name and target an existing server hostname
servicefile="/docker/services.txt"
# The bind file containing server declarations
server_zone_file="template.db.jean-cloud.org"
# Where you want your DNS keys stored
keydir="$DATA_DIR/keys"
# IP of primary servers
# MUST end with ; if non-empty
primary_ips=""
# IP of secondary servers (for zone transfer)
secondary_ips="37.65.119.74;"
# NS name
default_dns_name="ns.jean-cloud.org."
CAA_RR='CAA 0 issue "letsencrypt.org;validationmethods=dns-01"'
runthis () {
if [ "$#" -ne 1 ] ; then
die "Usage: runthis <primary|secondary>"
fi
prepare
primary_ips="$primary_ips$(fakeresolve_ip_list tetede)"
secondary_ips="$secondary_ips$(fakeresolve_ip_list shlago)"
line_in_file "primary_ips=\"$primary_ips\"" "$DOCKER_DIR/.env"
line_in_file "secondary_ips=\"$secondary_ips\"" "$DOCKER_DIR/.env"
if [ "$1" = "primary" ] ; then
create_primary_files
else
create_secondary_files
fi
restart
}
main () {
runthis primary
}
# Do not execute main if script is sourced
! (return 0 2>/dev/null) && main "$@" || true # return 0 whatever happends