Skip to content

Instantly share code, notes, and snippets.

@kubicek
Created December 14, 2008 00:13
Show Gist options
  • Save kubicek/35579 to your computer and use it in GitHub Desktop.
Save kubicek/35579 to your computer and use it in GitHub Desktop.
Pushr via capistrano
namespace :pushr do
set :pushr_path, "#{deploy_to}/pushr"
desc "Install pushr"
task :install do
run "git clone git://github.com/karmi/pushr.git #{pushr_path}"
end
task :check do
run "cd #{pushr_path}; rake app:check"
end
desc "Create config.yml"
task :configure do
set :http_auth_username, Capistrano::CLI.ui.ask("Enter new user name for http access: ")
set :http_auth_password, Capistrano::CLI.password_prompt("Enter new password for http access: ")
pushr_configuration =<<-EOF
application: #{application}
# Username/password for HTTP Auth
username: #{http_auth_username}
password: #{http_auth_password}
# Full path to your Rails application, eg. "/var/www/my_rails_app"
path: #{deploy_to}
EOF
put pushr_configuration, "#{pushr_path}/config.yml"
end
desc "Start pushr"
task :start do
run "cd #{pushr_path}; rake start"
end
desc "Stop pushr"
task :stop do
run "cd #{pushr_path}; rake stop"
end
namespace :ssh do
desc "Generate ssh key"
task :generate_key do
run "ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''"
end
desc "Authorize local key for accessing the same server"
task :authorize_key do
run "cd #{pushr_path}; rake app:add_public_key_to_localhost"
end
desc "Display public ssh key"
task :get_public_key do
run "cat ~/.ssh/id_rsa.pub"
end
end
end
= Instalace a spusteni Pushr
== Instalace
cap pushr:install
Nainstaluje pushr do adresare pushr u aplikace
== Kontrola
cap pushr:check
Vypise, zda jsou na serveru nainstalovany vsechny gemy
== Konfigurace
cap pushr:configure
Zepta se na nove prihlasovaci jmeno a heslo pro http pristup a vygeneruje konfiguracni soubor pro pushr
cap pushr:ssh:generate_key
Vygeneruje novy klic bez hesla na serveru
cap pushr:ssh:authorize_key
Umozni, aby se uzivatel na serveru (deployer) sshckoval sam na sebe (aby slo spustit capistrano)
cap pushr:ssh:get_public_key
Zobrazi verejnou cast ssh klice - pro ulozeni na githubu
== Spusteni a zastaveni pushr
cap pushr:start
Spusti pushr
cap pushr:stop
Zastavi pushr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment