aboutsummaryrefslogtreecommitdiffstats
path: root/config/deploy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/deploy.rb')
-rw-r--r--config/deploy.rb82
1 files changed, 24 insertions, 58 deletions
diff --git a/config/deploy.rb b/config/deploy.rb
index 4e2e2d586..5b26e4ea1 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,35 +1,26 @@
require 'capistrano/ext/multistage'
require './config/boot'
-set :stages, %w(sandbox unstable staging production sismo)
-set :application, "chouette2"
+set :stages, %w(sandbox dev staging production)
+set :application, "stif-boiv"
set :scm, :git
-set :repository, "https://github.com/afimb/chouette2.git"
-set :maven_repo, "http://maven.chouette.cityway.fr"
-set :deploy_to, "/var/www/chouette2"
+set :repository, "git@github.com:AF83/stif-boiv.git"
+set :deploy_to, "/var/www/stif-boiv"
set :use_sudo, false
default_run_options[:pty] = true
set :group_writable, true
-set :rake, "bundle exec rake"
-set :keep_releases, 4
-set :rails_env, "production" #added for delayed job
-set :user, "metienne"
-set :deploy_via, :copy
-set :copy_via, :scp
-set :copy_exclude, ".git/*"
-ssh_options[:forward_agent] = true
-ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")]
+set :bundle_cmd, "/var/lib/gems/2.2.0/bin/bundle"
+set :rake, "#{bundle_cmd} exec /var/lib/gems/2.2.0/bin/rake"
-after "deploy:update", "deploy:cleanup", "deploy:group_writable"
-after "deploy:update_code", "deploy:symlink_shared", "deploy:chouette_command", "deploy:gems"
-# ugly workaround for bug https://github.com/capistrano/capistrano/issues/81
-before "deploy:assets:precompile", "deploy:symlink_shared"
-after "deploy:restart", "delayed_job:restart"
+set :keep_releases, 5
+after "deploy:update", "deploy:cleanup"
-# If you want to use command line options, for example to start multiple workers,
-# define a Capistrano variable delayed_job_args:
-#
-# set :delayed_job_args, "-n 2"
+set :rails_env, -> { fetch(:stage) }
+set :deploy_via, :remote_cache
+set :copy_exclude, [ '.git' ]
+ssh_options[:forward_agent] = true
+
+require "bundler/capistrano"
namespace :deploy do
task :start do ; end
@@ -45,58 +36,33 @@ namespace :deploy do
run "mkdir -p #{dirs.join(' ')} && (chmod g+w #{dirs.join(' ')} || true)"
end
- desc "Install gems"
- task :gems, :roles => :app do
- run "cd #{release_path} && umask 02 && bundle install --path=#{shared_path}/bundle --without=development:test:cucumber"
+ task :bundle_link do
+ run "ln -fs #{bundle_cmd} #{release_path}/script/bundle"
end
+ after "bundle:install", "deploy:bundle_link"
desc "Symlinks shared configs and folders on each release"
task :symlink_shared, :except => { :no_release => true } do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/"
- run "ln -nfs #{shared_path}/config/production.rb #{release_path}/config/environments/"
+ run "ln -nfs #{shared_path}/config/environments/#{rails_env}.rb #{release_path}/config/environments/"
run "ln -nfs #{shared_path}/config/secrets.yml #{release_path}/config/"
run "ln -nfs #{shared_path}/config/newrelic.yml #{release_path}/config/"
- run "ln -nfs #{shared_path}/config/devise_async.rb #{release_path}/config/initializers/"
- end
- desc "Install chouette command"
- task :chouette_command, :except => { :no_release => true } do
- # run "mkdir -p /var/lib/chouette/imports"
- # run "mkdir -p /var/lib/chouette/exports"
- # run "mkdir -p /var/lib/chouette/validations"
- # run "mkdir -p /usr/local/opt/chouette-command/"
- # run "cd /usr/local/opt/chouette-command && rm -f chouette-gui-command-#{gui_cmd}.zip"
- # run "cd /usr/local/opt/chouette-command && wget #{maven_repo}/fr/certu/chouette/chouette-gui-command/#{gui_cmd}/chouette-gui-command-#{gui_cmd}.zip"
- # run "cd /usr/local/opt/chouette-command && rm -rf chouette-cmd_#{gui_cmd}"
- # run "cd /usr/local/opt/chouette-command && unzip chouette-gui-command-#{gui_cmd}.zip"
- # run "cd /usr/local/opt/chouette-command/chouette-cmd_#{gui_cmd} && chmod a+w . && sudo chgrp -R wheel ."
- # run "cd /usr/local/opt/chouette-command && rm -f chouette-cmd-current"
- # run "cd /usr/local/opt/chouette-command && ln -s chouette-cmd_#{gui_cmd} chouette-cmd-current"
+ run "ln -nfs #{shared_path}/tmp/imports #{release_path}/tmp/imports"
end
+ after 'deploy:update_code', 'deploy:symlink_shared'
+ before 'deploy:assets:precompile', 'deploy:symlink_shared'
desc "Make group writable all deployed files"
task :group_writable do
run "sudo /usr/local/sbin/cap-fix-permissions /var/www/chouette2"
end
-
- # desc "Generate jekyll static sites"
- # task :jekyll, :except => { :no_release => true } do
- # run "cd #{release_path} && jekyll --auto doc/functional public/help"
- # end
-
- desc "tail log files"
- task :tail, :roles => :app do
- #run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
- run "tail -f /var/log/syslog" do |channel, stream, data|
- puts "#{channel[:host]}: #{data}"
- break if stream == :err
- end
- end
-
+ after "deploy:update", "deploy:group_writable"
end
namespace :delayed_job do
task :restart do
- run "sudo /etc/init.d/chouette2 restart"
+ run "sudo /etc/init.d/stif-boiv restart"
end
+ # after "deploy:restart", "delayed_job:restart"
end