Created
December 7, 2012 22:46
-
-
Save dmalikov/4237146 to your computer and use it in GitHub Desktop.
deploy liblastfm haddocks to budueba.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploying haddocks | |
# | |
# cap deploy:haddocks | |
load 'deploy' | |
ssh_options[:forward_agent] = true | |
after "deploy:create_symlink", "deploy:cleanup" | |
# initializen | |
default_run_options[:pty] = true | |
set :use_sudo, false | |
set :keep_releases, 10 | |
set :deploy_via, :copy | |
set :application, "liblastfm" | |
set :deploy_to, "/var/www/budueba.com/data" | |
set :current_path, "/var/www/budueba.com/htdocs" | |
role :jws, "jws" | |
namespace :deploy do | |
desc "Deploy haddock documentation" | |
task :haddock do | |
arch_fn = "haddock.tar.gz" | |
arch_path = File.join( Dir.pwd(), arch_fn ) | |
# pack haddocks | |
system "cabal-dev haddock --hyperlink-source" | |
system "tar cjf #{arch_path} -C dist/doc/html/ liblastfm" | |
# upload archive | |
run "mkdir -p #{release_path}" | |
top.upload arch_path, "#{release_path}/", :via => :scp, :recursive => true | |
# unpack archive | |
run "rm -rf liblastfm" | |
run "tar --extract --file #{release_path}/#{arch_fn} --directory=#{release_path} " | |
run "rm -v #{release_path}/#{arch_fn}" | |
create_symlink | |
# remove archive locally | |
system "rm -v #{arch_path}" | |
end | |
end |
Author
dmalikov
commented
Dec 7, 2012
/var/www/budueba.com/
├── data
│ └── releases
│ ├── 20121207222946
│ ├── 20121207223134
│ ├── 20121207223504
│ ├── 20121207223714
│ ├── 20121207223736
│ ├── 20121207223854
│ ├── 20121207224011
│ ├── 20121207224124
│ └── 20121207224404
└── htdocs -> /var/www/budueba.com/data/releases/20121207224404
How to rollback
$> cap deploy:rollback
* executing `deploy:rollback'
* executing `deploy:rollback:revision'
* executing "ls -x /var/www/budueba.com/data/releases"
servers: ["jws"]
[jws] executing command
command finished in 31ms
* executing "rm /var/www/budueba.com/htdocs; ln -s /var/www/budueba.com/data/releases/20121207224124 /var/www/budueba.com/htdocs"
servers: ["jws"]
[jws] executing command
command finished in 35ms
* executing `deploy:restart'
* executing `deploy:rollback:cleanup'
* executing "if [ `readlink /var/www/budueba.com/htdocs` != /var/www/budueba.com/data/releases/20121207224404 ]; then rm -rf /var/www/budueba.com/data/releases/20121207224404; fi"
servers: ["jws"]
[jws] executing command
command finished in 53ms
👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment