parent
bd49e6e41a
commit
d2e3d60a58
@ -0,0 +1,4 @@
|
||||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
@ -0,0 +1,61 @@
|
||||
require 'capistrano/ext/multistage'
|
||||
|
||||
set :stages, %w(staging production)
|
||||
set :default_stage, "staging"
|
||||
|
||||
require "bundler/capistrano"
|
||||
|
||||
default_run_options[:pty] = true
|
||||
|
||||
set :application, 'cartodb'
|
||||
|
||||
set :scm, :git
|
||||
# set :git_enable_submodules, 1
|
||||
set :git_shallow_clone, 1
|
||||
set :scm_user, 'ubuntu'
|
||||
set :use_sudo, false
|
||||
set :repository, "git@github.com:Vizzuality/cartodb.git"
|
||||
ssh_options[:forward_agent] = true
|
||||
ssh_options[:keys] = [File.join(ENV["HOME"], ".ec2", "id-vizzuality")]
|
||||
set :keep_releases, 5
|
||||
|
||||
set :linode_staging, '184.73.254.217'
|
||||
set :linode_production, '184.73.254.217'
|
||||
set :user, 'ubuntu'
|
||||
|
||||
set(:deploy_to){
|
||||
"/home/ubuntu/www/#{stage}.#{application}.com"
|
||||
}
|
||||
|
||||
after "deploy:update_code", :run_migrations, :symlinks, :asset_packages, :set_staging_flag
|
||||
|
||||
desc "Restart Application"
|
||||
deploy.task :restart, :roles => [:app] do
|
||||
run "touch #{current_path}/tmp/restart.txt"
|
||||
end
|
||||
|
||||
desc "Migraciones"
|
||||
task :run_migrations, :roles => [:app] do
|
||||
run <<-CMD
|
||||
export RAILS_ENV=production &&
|
||||
cd #{release_path} &&
|
||||
rake db:migrate
|
||||
CMD
|
||||
end
|
||||
|
||||
task :symlinks, :roles => [:app] do
|
||||
run <<-CMD
|
||||
ln -s #{shared_path}/system #{release_path}/public/system;
|
||||
ln -s #{shared_path}/pdfs #{release_path}/public/;
|
||||
ln -s #{shared_path}/cache #{release_path}/public/;
|
||||
CMD
|
||||
end
|
||||
|
||||
desc 'Create asset packages'
|
||||
task :asset_packages, :roles => [:app] do
|
||||
run <<-CMD
|
||||
export RAILS_ENV=#{stage} &&
|
||||
cd #{release_path} &&
|
||||
rake asset:packager:build_all
|
||||
CMD
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
role :app, linode_production
|
||||
role :web, linode_production
|
||||
role :db, linode_production, :primary => true
|
||||
|
||||
set :branch, "production"
|
||||
|
||||
task :set_staging_flag, :roles => [:app] do
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
role :app, linode_staging
|
||||
role :web, linode_staging
|
||||
role :db, linode_staging, :primary => true
|
||||
|
||||
set :branch, "staging"
|
||||
|
||||
task :set_staging_flag, :roles => [:app] do
|
||||
run <<-CMD
|
||||
cd #{release_path} &&
|
||||
touch STAGING
|
||||
CMD
|
||||
end
|
Loading…
Reference in new issue