setup.sh 653 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. sed -i 's|mongodb://.*/hello_world|mongodb://'"${DBHOST}"'/hello_world|g' app.js
  3. sed -i 's|localhost|'"${DBHOST}"'|g' app.js
  4. export NODE_ENV=production
  5. export NVM_HOME=${IROOT}/nvm
  6. # Used to avoid nvm's return 2 error.
  7. # Sourcing this functions if 0 is returned.
  8. source $NVM_HOME/nvm.sh || 0
  9. nvm install 0.10.8
  10. nvm use 0.10.8
  11. # run app
  12. npm install
  13. node app &
  14. # !DO NOT REMOVE!
  15. #
  16. # It takes `node app` a few seconds to turn on and
  17. # then fork. If you remove this sleep, the parent shell
  18. # executing this script will be terminated before the
  19. # application has time to awaken and be forked, and
  20. # express will fail to be started
  21. sleep 5