start.sh 664 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env sh
  2. set -e
  3. SERVER_ROLE="${SERVER_ROLE:-web}"
  4. HEROKU_DYNO="${DYNO:-no}"
  5. case "$HEROKU_DYNO" in
  6. web*) ./manage.py migrate ;;
  7. worker*) SERVER_ROLE=worker_with_beat ;;
  8. esac
  9. case $SERVER_ROLE in
  10. web)
  11. SCRIPT="./bin/run-uwsgi.sh"
  12. ;;
  13. worker)
  14. SCRIPT="./bin/run-celery.sh"
  15. ;;
  16. beat)
  17. SCRIPT="./bin/run-beat.sh"
  18. ;;
  19. flower)
  20. SCRIPT="./bin/run-flower.sh"
  21. ;;
  22. worker_with_beat)
  23. SCRIPT="./bin/run-celery-with-beat.sh"
  24. ;;
  25. *)
  26. echo "Unknown server role provided: $SERVER_ROLE. Should be web|worker|beat."
  27. exit 1
  28. ;;
  29. esac
  30. . "$SCRIPT"