Market Data Service is a high-performance financial data API that provides comprehensive Symbol prices of different markets through both RESTful endpoints and real-time WebSocket connections.

init-ssl.sh 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. # SSL Certificate Initialization Script
  3. # This script obtains the initial SSL certificate using certbot
  4. set -e
  5. DOMAIN_NAME="${DOMAIN_NAME:-}"
  6. SSL_EMAIL="${SSL_EMAIL:-}"
  7. STAGING="${SSL_STAGING:-0}"
  8. if [ -z "$DOMAIN_NAME" ]; then
  9. echo "ERROR: DOMAIN_NAME environment variable is required"
  10. echo "Usage: DOMAIN_NAME=yourdomain.com SSL_EMAIL=your@email.com docker-compose -f docker-compose.prod.yml run --rm certbot-init"
  11. exit 1
  12. fi
  13. if [ -z "$SSL_EMAIL" ]; then
  14. echo "ERROR: SSL_EMAIL environment variable is required"
  15. echo "Usage: DOMAIN_NAME=yourdomain.com SSL_EMAIL=your@email.com docker-compose -f docker-compose.prod.yml run --rm certbot-init"
  16. exit 1
  17. fi
  18. echo "Obtaining SSL certificate for domain: $DOMAIN_NAME"
  19. echo "Email: $SSL_EMAIL"
  20. # Use staging server if SSL_STAGING=1 (for testing)
  21. STAGING_FLAG=""
  22. if [ "$STAGING" = "1" ]; then
  23. echo "WARNING: Using Let's Encrypt staging server (for testing only)"
  24. STAGING_FLAG="--staging"
  25. fi
  26. # Obtain certificate using webroot method
  27. certbot certonly \
  28. --webroot \
  29. --webroot-path=/var/www/certbot \
  30. --email "$SSL_EMAIL" \
  31. --agree-tos \
  32. --no-eff-email \
  33. --force-renewal \
  34. $STAGING_FLAG \
  35. -d "$DOMAIN_NAME"
  36. echo "SSL certificate obtained successfully!"
  37. echo "Certificate location: /etc/letsencrypt/live/$DOMAIN_NAME/"
  38. echo ""
  39. echo "Next steps:"
  40. echo "1. Restart nginx container: docker-compose -f docker-compose.prod.yml restart nginx"
  41. echo "2. Verify HTTPS is working: curl https://$DOMAIN_NAME/health"