d2ray/image/run.sh
quackerd 551ab9e886
Some checks failed
continuous-integration/drone/push Build is failing
new
2021-04-19 03:51:22 -04:00

39 lines
844 B
Bash

#!/bin/sh
set +xe
mkdir -p /opt/config
mkdir -p /opt/config/logs
mkdir -p /opt/config/certs
mkdir -p /opt/config/logs/nginx
mkdir -p /opt/config/logs/xray
mkdir -p /opt/config/logs/crond
echo ""
echo "===== Checking Environment Variables ====="
if [ -z "$FQDN" ]; then
echo "FQDN must be set"
exit 1
else
echo "FQDN = $FQDN"
fi
echo ""
echo "===== Checking Certificates ===="
if [ ! -d "/etc/letsencrypt/live/$FQDN" ]; then
echo "Generating new certificates..."
certbot certonly -n --standalone -m dummy@dummy.com --agree-tos --no-eff-email -d $FQDN
else
echo "Certificate exists. Checking renewal..."
certbot renew
fi
echo ""
echo "===== Starting services ====="
crond -L /opt/config/logs/crond/log.txt
nginx -c /opt/nginx.conf
echo ""
echo "===== Starting xray ====="
exec /opt/xray/xray -c /opt/config.json