/config/deploy/demo.rb
Ruby | 81 lines | 44 code | 21 blank | 16 comment | 0 complexity | 2cea61019cd952e262e37f91e113a040 MD5 | raw file
- # This is a sample Capistrano config file for EC2 on Rails.
- # It should be edited and customized.
- set :rails_env, "demo"
- set :application, "empowerproject_demo"
- set :repository, "ssh://hg@bitbucket.org/empower/empowerproject_demo"
- set :deploy_to, "/var/www/sites/#{application}"
- set :user, "deploy"
- set :password, "emp!dep2"
- set :use_sudo, false
- set :scm, "mercurial"
- set :keep_releases, 3
- # NOTE: for some reason Capistrano requires you to have both the public and
- # the private key in the same folder, the public key should have the
- # extension ".pub".
- ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/id_rsa"]
- #ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/your-ec2-key"]
- # Your EC2 instances. Use the ec2-xxx....amazonaws.com hostname, not
- # any other name (in case you have your own DNS alias) or it won't
- # be able to resolve to the internal IP address.
- role :web, "ec2-204-236-133-244.us-west-1.compute.amazonaws.com"
- role :app, "ec2-204-236-133-244.us-west-1.compute.amazonaws.com"
- role :db, "ec2-204-236-133-244.us-west-1.compute.amazonaws.com", :primary => true
- ## alternate syntax for one server
- #server "ec2-204-236-166-36.us-west-1.compute.amazonaws.com", :app, :web, :db, :primary => true
- #role :web, "ec2-12-xx-xx-xx.z-1.compute-1.amazonaws.com"
- #role :app, "ec2-34-xx-xx-xx.z-1.compute-1.amazonaws.com"
- #role :db, "ec2-56-xx-xx-xx.z-1.compute-1.amazonaws.com", :primary => true
- #role :memcache, "ec2-12-xx-xx-xx.z-1.compute-1.amazonaws.com"
- namespace :deploy do
- after "deploy:symlink", "custom:resourcelink"
- desc "Apache"
- task :restart, :roles => [:web] do
- default_run_options[:pty] = true
- run "sudo /etc/init.d/httpd restart" do |ch, steam, out|
- ch.send_data "#{password}\n" if out =~/password/
- end
- end
- end
- namespace(:custom) do
- task :resourcelink, :roles => [:web] do
- run "rm -rf #{release_path}/public/resource_store; ln -s #{shared_path}/resource_store #{release_path}/public/resource_store"
- end
- end
- desc "Schema Load"
- task :schemaload, :roles => [:web] do
- run "cd #{current_path}; rake RAILS_ENV=demo db:schema:load"
- end
- desc "DB Migrate"
- task :dbmigrate, :roles => [:web] do
- run "cd #{current_path}; rake RAILS_ENV=demo db:migrate"
- end
- desc "DB Create"
- task :dbcreate, :roles => [:web] do
- run "cd #{current_path}; rake RAILS_ENV=demo db:create"
- end
- desc "DB Migrate Reset"
- task :dbmigrate_reset, :roles => [:web] do
- run "cd #{current_path}; rake RAILS_ENV=demo db:migrate:reset"
- end
- #after "deploy", "dbmigrate_reset"