diff options
Diffstat (limited to 'config')
| -rw-r--r-- | config/deploy.rb | 82 | ||||
| -rw-r--r-- | config/deploy/dev.rb | 1 | ||||
| -rw-r--r-- | config/deploy/sandbox.rb | 2 | ||||
| -rw-r--r-- | config/deploy/staging.rb | 9 | ||||
| -rw-r--r-- | config/deploy/unstable.rb | 3 |
5 files changed, 28 insertions, 69 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 diff --git a/config/deploy/dev.rb b/config/deploy/dev.rb new file mode 100644 index 000000000..400f1d787 --- /dev/null +++ b/config/deploy/dev.rb @@ -0,0 +1 @@ +server "stif-boiv-dev.af83.priv", :app, :web, :db, :primary => true diff --git a/config/deploy/sandbox.rb b/config/deploy/sandbox.rb index f9e1354d6..0b1d17088 100644 --- a/config/deploy/sandbox.rb +++ b/config/deploy/sandbox.rb @@ -1,2 +1,2 @@ server "sandbox", :app, :web, :db, :primary => true -set :deploy_via, :remote_cache +set :rails_env, "dev" diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 983e4ec68..c4f1dec2c 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,7 +1,2 @@ -server "chouette-int.aix.cityway.fr", :app, :web, :db, :primary => true -set :deploy_via, :copy -set :copy_cache, true -set :copy_via, :scp -set :copy_exclude, ".git/*" -set :branch, "V3_1" -set :gui_cmd, "3.0.0" +server "stif-boiv-staging.af83.priv", :app, :web, :db, :primary => true +set :branch, 'master' diff --git a/config/deploy/unstable.rb b/config/deploy/unstable.rb deleted file mode 100644 index d363a6fa4..000000000 --- a/config/deploy/unstable.rb +++ /dev/null @@ -1,3 +0,0 @@ -server "chouette-p.aix.cityway.fr", :app, :web, :db, :primary => true -set :branch, "master" -#set :gui_cmd, "2.5.2" |
