Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. # === Documentation === #
  2. # This is just a standard shell script, which is loaded from the
  3. # post-receive hook each time a branch is updated.
  4.  
  5. # Just don't forget that gems you have on your local machine probably
  6. # aren't installed at the server, at least before you run gem bundle.
  7.  
  8. # Your working directory is root of your application which was just cloned
  9. # here. (Probably) unlike to your local machine, basename is name of the branch,
  10. # not name of the application. It shouldn't matter in most cases, but sometimes
  11. # it does, for example in Python where you are using import myapp.something.
  12. # 1) Write an awful perl-ish script with sed -i / perl -i / ruby -i and just replace
  13. # the name in your code. It might work, but come on, you don't want to do that.
  14. # 2) Your application will be as a subdirectory of the root of the repository,
  15. # so you may call it whatever you want.
  16. # 3) Obviously the best solution is to change the post-receive script, for example:
  17. # Task["deployer:compile_hook"].config[:target] = "myappname"
  18.  
  19. # Make sure this script isn't executable, otherwise the script will simply run,
  20. # so you won't have access to shell functions from the post-receive hook.
  21. # However this is useful if you want to run this script under another interpret.
  22. # If you want to install hooks which will be executed rather than just
  23. # loaded, use ./tasks.rb deployer:install --executable or add
  24. # Task["deployer:install"].config[:executable] = false to your tasks.rb
  25.  
  26. # === Setup === #
  27. # If we have everything bundled in bin, we have to put bin to the beginning of the PATH
  28. # variable, so all commands like rake etc will be loaded from bin, if they are in there
  29. export PATH="bin:$PATH" # TODO: maybe you are using script directory instead of bin?
  30.  
  31. # Rango
  32. export RACK_ENV="staging" # if you are deploying to more servers, you might want to setup this in your /etc/profile
  33.  
  34. info "Upgrading gems ..."
  35. bundle install --deployment --binstubs
  36.  
  37. info "Upgrading database ..."
  38. ./tasks.rb db:autoupgrade
  39. #./tasks.rb db:seed
  40.  
  41. # (Re)start Thin
  42. if test -f tmp/pids/thin.pid ; then
  43. # thin restart # doesn't work
  44. info "Restarting Thin ..."
  45. kill -9 $(cat tmp/pids/thin.pid)
  46. rm tmp/pids/thin.pid
  47. thin start -p 4000 --debug --daemon
  48. else
  49. info "Starting Thin on port 4000 ..."
  50. thin start -p 4000 --debug --daemon
  51. fi
Add Comment
Please, Sign In to add comment