2014-03-23 00:22:25 +00:00
|
|
|
lock '3.1.0'
|
|
|
|
|
|
|
|
set :application, 'ensl'
|
2014-03-23 04:13:19 +00:00
|
|
|
set :deploy_user, 'deploy'
|
|
|
|
set :pty, true
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
set :scm, :git
|
|
|
|
set :repo_url, 'git@github.com:ENSL/ensl.org.git'
|
|
|
|
set :keep_releases, 10
|
|
|
|
|
|
|
|
set :rbenv_type, :user
|
|
|
|
set :rbenv_ruby, '2.1.1'
|
2014-03-23 04:13:19 +00:00
|
|
|
set :rbenv_sudo, "sudo /home/#{fetch(:deploy_user)}/.rbenv/bin/rbenv sudo"
|
|
|
|
|
|
|
|
set :linked_files, %w{.env}
|
|
|
|
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle
|
|
|
|
public/system public/local public/uploads}
|
|
|
|
|
|
|
|
set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
namespace :deploy do
|
|
|
|
desc 'Restart application'
|
|
|
|
task :restart do
|
2014-03-23 04:13:19 +00:00
|
|
|
invoke 'foreman:export'
|
|
|
|
invoke 'foreman:restart'
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
after :publishing, :restart
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :foreman do
|
|
|
|
desc "Export the Procfile to Ubuntu's upstart scripts"
|
2014-03-23 00:56:13 +00:00
|
|
|
task :export do
|
|
|
|
on roles(:app) do |host|
|
2014-03-23 04:13:19 +00:00
|
|
|
within release_path do
|
|
|
|
execute "#{fetch(:rbenv_sudo)} bundle exec foreman export upstart /etc/init -a #{fetch(:application)} -u #{fetch(:deploy_user)} -l #{fetch(:deploy_to)}/shared/log"
|
|
|
|
end
|
2014-03-23 00:56:13 +00:00
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Start the application services"
|
2014-03-23 00:56:13 +00:00
|
|
|
task :start do
|
|
|
|
on roles(:app) do |host|
|
2014-03-23 04:13:19 +00:00
|
|
|
execute "sudo service #{fetch(:application)} start"
|
2014-03-23 00:56:13 +00:00
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Stop the application services"
|
2014-03-23 00:56:13 +00:00
|
|
|
task :stop do
|
|
|
|
on roles(:app) do |host|
|
2014-03-23 04:13:19 +00:00
|
|
|
execute "sudo service #{fetch(:application)} stop"
|
2014-03-23 00:56:13 +00:00
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Restart the application services"
|
2014-03-23 00:56:13 +00:00
|
|
|
task :restart do
|
|
|
|
on roles(:app) do |host|
|
2014-03-23 04:13:19 +00:00
|
|
|
execute "sudo service #{fetch(:application)} start || #{sudo} service #{fetch(:application)} restart"
|
2014-03-23 00:56:13 +00:00
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|
|
|
|
end
|