Nginx container will fail to startup if the certificate is not valid or does not exist.
Solution
On startup we need to check for all required certificates and if they are not valid or existent we need to generate them. We report to the user to run the following command:
nginx_cert_check () {
# Allows us to use root domain if blank
if [[ $1 = "" ]]; then
# Check for SSL cert
if [ ! -d docker-data/letsencrypt/live/$GLOBAL_DOMAIN ]; then
echo "Certificate does exist for $GLOBAL_DOMAIN"
echo "Run ./domain-add.sh $GLOBAL_DOMAIN"
exit 1
fi
else
# Check for SSL cert
if [ ! -d docker-data/letsencrypt/live/$1.$GLOBAL_DOMAIN ]; then
echo "Certificate does exist for $1.$GLOBAL_DOMAIN"
echo "Run ./domain-add.sh $1.$GLOBAL_DOMAIN"
exit 1
fi
fi
}
Problem
Nginx container will fail to startup if the certificate is not valid or does not exist.
Solution
On startup we need to check for all required certificates and if they are not valid or existent we need to generate them. We report to the user to run the following command:
See the following link for placement:
https://github.com/SiloCityLabs/docker-nas/blob/v3/server/models/app.go#L39
Previous code in bash:
Steps to Reproduce the Problem