Permalink
Browse files

Fixing deployment. WIP (#107)

  • Loading branch information...
1 parent c89583c commit 165d88e178b5a6b1625d23f1aaa5c04d1c3e34d0 @munshkr munshkr committed Sep 3, 2013
Showing with 69 additions and 98 deletions.
  1. +67 −0 Capfile
  2. +0 −5 aphrodite/Capfile
  3. +2 −48 aphrodite/config/deploy.rb
  4. +0 −45 hephaestus/{Capfile → config/deploy.rb}
View
67 Capfile
@@ -0,0 +1,67 @@
+load 'deploy'
+
+# Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+
+require "bundler/capistrano"
+set :bundle_flags, "--deployment --quiet --binstubs"
+
+set :application, "mapa76"
+
+set :user, "deployer"
+set :domain, "184.173.160.186"
+set :environment, "production"
+set :deploy_to, "/home/deployer/apps/#{application}"
+set :scm, :git
+set :repository, "git://github.com/hhba/mapa76.git"
+set :branch, "master"
+set :scm_verbose, true
+set :use_sudo, false
+set :ssh_options, :forward_agent => true
+set :keep_releases, 5
+
+set :config_files, %w{ mongoid elasticsearch resque monit workers }
+
+default_run_options[:pty] = true
+ssh_options[:forward_agent] = true
+
+role :app, domain
+role :web, domain
+role :workers, domain
+role :db, domain, :primary => true
+
+namespace :deploy do
+ desc "Make sure local git is in sync with remote."
+ task :check_revision, roles: :web do
+ unless `git rev-parse HEAD` == `git rev-parse origin/master`
+ puts "WARNING: HEAD is not the same as origin/master"
+ puts "Run `git push` to sync changes."
+ exit
+ end
+ end
+ before "deploy", "deploy:check_revision"
+
+ desc "Symlink config files"
+ task :create_symlink_shared do
+ config_files.each do |filename|
+ run "ln -nfs #{deploy_to}/shared/config/#{filename}.yml #{release_path}/config/#{filename}.yml"
+ end
+ run "ln -nfs #{deploy_to}/shared/config/monit.conf #{release_path}/config/monit.conf"
+ run "ln -nfs #{deploy_to}/shared/thumbs #{release_path}/public/thumbs"
+ end
+ after "deploy:update_code", "deploy:create_symlink_shared"
+
+ task :migrate do
+ puts "No migrations"
+ end
+end
+
+after "deploy", "deploy:cleanup" # keep only the last 5 releases
+
+load 'aphrodite/config/deploy'
+load 'hephaestus/config/deploy'
+
+=begin
+def rake(task)
+ run "cd #{current_path} && APP_ENV=production bundle exec rake #{task} --trace"
+end
+=end
View
@@ -1,5 +0,0 @@
-load 'deploy'
-# Uncomment if you are using Rails' asset pipeline
-load 'deploy/assets'
-# Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
-load 'config/deploy' # remove this line to skip loading any of the default tasks
View
@@ -1,30 +1,7 @@
-require "bundler/capistrano"
require "capistrano-unicorn"
-set :bundle_flags, "--deployment --quiet --binstubs"
-
-server "184.173.160.186", :web, :app, :db, primary: true
-
-set :application, "mapa76"
-set :user, "deployer"
-set :deploy_to, "/home/#{user}/apps/#{application}"
-set :deploy_via, :remote_cache
-set :use_sudo, false
-
-set :scm, "git"
-set :repository, "git://github.com/hhba/mapa76.git"
-set :branch, "master"
-set :scm_verbose, true
-set :ssh_options, :forward_agent => true
-
-set :keep_releases, 5
-
-set :config_files, %w{ mongoid resque elasticsearch }
-
-default_run_options[:pty] = true
-ssh_options[:forward_agent] = true
-
-after "deploy", "deploy:cleanup" # keep only the last 5 releases
+# Uncomment if you are using Rails' asset pipeline
+load 'deploy/assets'
namespace :deploy do
%w[start stop restart].each do |command|
@@ -42,29 +19,6 @@
run "mkdir -p #{shared_path}/pids/unicorn"
end
after "deploy:setup", "deploy:setup_config"
-
- desc "Make sure local git is in sync with remote."
- task :check_revision, roles: :web do
- unless `git rev-parse HEAD` == `git rev-parse origin/master`
- puts "WARNING: HEAD is not the same as origin/master"
- puts "Run `git push` to sync changes."
- exit
- end
- end
- before "deploy", "deploy:check_revision"
-
- desc "Symlink config files"
- task :create_symlink_shared do
- config_files.each do |filename|
- run "ln -nfs #{deploy_to}/shared/config/#{filename}.yml #{release_path}/config/#{filename}.yml"
- end
- run "ln -nfs #{deploy_to}/shared/thumbs #{release_path}/public/thumbs"
- end
- after "deploy:update_code", "deploy:create_symlink_shared"
-
- task :migrate do
- puts "No migrations"
- end
end
after "deploy:restart", "unicorn:reload" # app IS NOT preloaded
@@ -1,43 +1,4 @@
-load "deploy"
-
-require "bundler/capistrano"
-
-set :application, "mapa76"
-
-set :user, "deployer"
-set :domain, "184.173.160.186"
-set :environment, "production"
-set :deploy_to, "/home/deployer/apps/#{application}"
-
-role :app, domain
-role :web, domain
-role :workers, domain
-role :db, domain, :primary => true
set :normalize_asset_timestamps, false
-set :scm, :git
-set :repository, "git://github.com/hhba/mapa76.git"
-set :branch, "master"
-set :scm_verbose, true
-set :use_sudo, false
-set :ssh_options, :forward_agent => true
-
-set :keep_releases, 5
-
-set :config_files, %w{ mongoid elasticsearch resque monit workers }
-
-namespace :deploy do
- desc "Symlink config files"
- task :create_symlink_shared do
- config_files.each do |filename|
- run "ln -nfs #{deploy_to}/shared/config/#{filename}.yml #{release_path}/config/#{filename}.yml"
- end
- run "ln -nfs #{deploy_to}/shared/config/monit.conf #{release_path}/config/monit.conf"
- end
-
- task :migrate do
- puts "No migrations"
- end
-end
namespace :monit do
desc "Start Monit daemon (rebuilding config file)"
@@ -90,11 +51,5 @@
end
end
-after "deploy:update_code", "deploy:create_symlink_shared"
after "deploy", "workers:reload"
#after "deploy", "mi:create_indexes"
-
-
-def rake(task)
- run "cd #{current_path} && APP_ENV=production bundle exec rake #{task} --trace"
-end

0 comments on commit 165d88e

Please sign in to comment.