Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # === Documentation === #
- # This is just a standard shell script, which is loaded from the
- # post-receive hook each time a branch is updated.
- # Just don't forget that gems you have on your local machine probably
- # aren't installed at the server, at least before you run gem bundle.
- # Your working directory is root of your application which was just cloned
- # here. (Probably) unlike to your local machine, basename is name of the branch,
- # not name of the application. It shouldn't matter in most cases, but sometimes
- # it does, for example in Python where you are using import myapp.something.
- # 1) Write an awful perl-ish script with sed -i / perl -i / ruby -i and just replace
- # the name in your code. It might work, but come on, you don't want to do that.
- # 2) Your application will be as a subdirectory of the root of the repository,
- # so you may call it whatever you want.
- # 3) Obviously the best solution is to change the post-receive script, for example:
- # Task["deployer:compile_hook"].config[:target] = "myappname"
- # Make sure this script isn't executable, otherwise the script will simply run,
- # so you won't have access to shell functions from the post-receive hook.
- # However this is useful if you want to run this script under another interpret.
- # If you want to install hooks which will be executed rather than just
- # loaded, use ./tasks.rb deployer:install --executable or add
- # Task["deployer:install"].config[:executable] = false to your tasks.rb
- # === Setup === #
- # If we have everything bundled in bin, we have to put bin to the beginning of the PATH
- # variable, so all commands like rake etc will be loaded from bin, if they are in there
- export PATH="bin:$PATH" # TODO: maybe you are using script directory instead of bin?
- # Rango
- export RACK_ENV="staging" # if you are deploying to more servers, you might want to setup this in your /etc/profile
- info "Upgrading gems ..."
- bundle install --deployment --binstubs
- info "Upgrading database ..."
- ./tasks.rb db:autoupgrade
- #./tasks.rb db:seed
- # (Re)start Thin
- if test -f tmp/pids/thin.pid ; then
- # thin restart # doesn't work
- info "Restarting Thin ..."
- kill -9 $(cat tmp/pids/thin.pid)
- rm tmp/pids/thin.pid
- thin start -p 4000 --debug --daemon
- else
- info "Starting Thin on port 4000 ..."
- thin start -p 4000 --debug --daemon
- fi
Add Comment
Please, Sign In to add comment