start.sh 709 B

12345678910111213
  1. #!/bin/bash -ex
  2. : ${DOMAIN:?is not given.}
  3. : ${UUID:?is not given.}
  4. : ${TROJAN_PASSWORD:?is not given.}
  5. : ${V2RAY_PATH:?is not given.}
  6. [[ -z $(nslookup $DOMAIN | grep $(curl -s http://checkip.amazonaws.com)) ]] && echo "fail to validate domain" && exit 1
  7. envsubst '${UUID},${V2RAY_PATH}' < config.json.template > ./appdata/etc/v2ray/config.json
  8. envsubst '${TROJAN_PASSWORD}' < trojan.config.json.template > ./appdata/config/config.json
  9. envsubst '${DOMAIN}' < docker-compose.yml.template > docker-compose.yml
  10. envsubst '${DOMAIN},${V2RAY_PATH}' < v2ray.subdomain.conf.template > appdata/config/nginx/proxy-confs/v2ray.subdomain.conf
  11. docker-compose down
  12. docker-compose pull && docker-compose up -d
  13. echo finished!