start.sh 604 B

12345678910111213141516171819202122232425262728293031
  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. worker_with_beat)
  20. SCRIPT="./bin/run-celery-with-beat.sh"
  21. ;;
  22. *)
  23. echo "Unknown server role provided: $SERVER_ROLE. Should be web|worker|beat."
  24. exit 1
  25. ;;
  26. esac
  27. . "$SCRIPT"