Prepare capistrano/db migrations to support more setups (#2)

The following parameters have been added to deploy-secrets.yml:

* **use_rvm**: yes/no
* **ruby_version**: Ruby version for rvm. Defaults to 2.3.2
* **repository**: Git repository. Defaults to the oficial repository
* **branch**: Branch to deploy. Defaults to master
* **rails_env**: Defaults to the stage.

Fixed migrations that required admin rights. Now first check if the postgress extensions are available. If so finish without doing nothin.

Added support for passenger.
This commit is contained in:
Juan Salvador Pérez García
2018-06-08 11:51:44 +02:00
parent 77dd60427d
commit 1db5a00eae
10 changed files with 61 additions and 21 deletions

View File

@@ -1,9 +1,18 @@
namespace :deploy do
desc 'Commands for unicorn application'
%w(start stop force-stop restart upgrade reopen-logs).each do |command|
task command.to_sym do
desc 'Commands for passenger/unicorn application'
if File.exist?("/etc/init.d/unicorn_#{fetch(:full_app_name)}")
%w(start stop force-stop restart upgrade reopen-logs).each do |command|
task command.to_sym do
on roles(:app), in: :sequence, wait: 5 do
execute "/etc/init.d/unicorn_#{fetch(:full_app_name)} #{command}"
end
end
end
else
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute "/etc/init.d/unicorn_#{fetch(:full_app_name)} #{command}"
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end
end