Permalink
Browse files

feat: `app['rollback_on_error']` implemented

Resolves #54
  • Loading branch information...
ajgon committed Oct 26, 2016
1 parent 5fc42c3 commit e6934a7be8e463b04c0393b0717ed1a77f98257c
View
@@ -11,6 +11,7 @@
default['defaults']['deploy']['create_dirs_before_symlink'] =
%w(tmp public config ../../shared/cache ../../shared/assets)
default['defaults']['deploy']['purge_before_symlink'] = %w(log tmp/cache tmp/pids public/system public/assets)
default['defaults']['deploy']['rollback_on_error'] = true
# ruby
View
@@ -6,7 +6,7 @@
prepare_recipe
every_enabled_application do |application, _deploy|
every_enabled_application do |application, _app_data|
create_deploy_dir(application, File.join('shared'))
create_deploy_dir(application, File.join('shared', 'config'))
create_deploy_dir(application, File.join('shared', 'log'))
View
@@ -5,7 +5,7 @@
include_recipe 'opsworks_ruby::configure'
# rubocop:disable Metrics/BlockLength
every_enabled_application do |application, deploy|
every_enabled_application do |application, app_data|
databases = []
every_enabled_rds(self, application) do |rds|
databases.push(Drivers::Db::Factory.build(self, application, rds: rds))
@@ -24,18 +24,25 @@
deploy_to deploy_dir(application)
user node['deployer']['user'] || 'root'
group www_group
rollback_on_error true
environment application['environment'].merge(framework.out[:deploy_environment] || {})
keep_releases deploy[:keep_releases]
if app_data[:rollback_on_error].nil?
rollback_on_error node['defaults']['deploy']['rollback_on_error']
else
rollback_on_error app_data[:rollback_on_error]
end
keep_releases app_data[:keep_releases]
create_dirs_before_symlink(
(node['defaults']['deploy']['create_dirs_before_symlink'] + Array.wrap(deploy[:create_dirs_before_symlink])).uniq
(
node['defaults']['deploy']['create_dirs_before_symlink'] + Array.wrap(app_data[:create_dirs_before_symlink])
).uniq
)
purge_before_symlink(
(node['defaults']['deploy']['purge_before_symlink'] + Array.wrap(deploy[:purge_before_symlink])).uniq
(node['defaults']['deploy']['purge_before_symlink'] + Array.wrap(app_data[:purge_before_symlink])).uniq
)
symlink_before_migrate deploy[:symlink_before_migrate]
symlinks(node['defaults']['deploy']['symlinks'].merge(deploy[:symlinks] || {}))
symlink_before_migrate app_data[:symlink_before_migrate]
symlinks(node['defaults']['deploy']['symlinks'].merge(app_data[:symlinks] || {}))
scm.out.each do |scm_key, scm_value|
send(scm_key, scm_value) if respond_to?(scm_key)
View
@@ -39,7 +39,7 @@
execute 'yum-config-manager --enable epel' if node['platform_family'] == 'rhel'
every_enabled_application do |application, _deploy|
every_enabled_application do |application, _app_data|
databases = []
every_enabled_rds(self, application) do |rds|
databases.push(Drivers::Db::Factory.build(self, application, rds: rds))
View
@@ -6,7 +6,7 @@
prepare_recipe
every_enabled_application do |application, _deploy|
every_enabled_application do |application, _app_data|
databases = []
every_enabled_rds(self, application) do |rds|
databases.push(Drivers::Db::Factory.build(self, application, rds: rds))
View
@@ -2,7 +2,7 @@
prepare_recipe
every_enabled_application do |application, _deploy|
every_enabled_application do |application, _app_data|
databases = []
every_enabled_rds(self, application) do |rds|
databases.push(Drivers::Db::Factory.build(self, application, rds: rds))
@@ -43,6 +43,7 @@
revision: 'master',
scm_provider: Chef::Provider::Git,
enable_submodules: false,
rollback_on_error: true,
environment: aws_opsworks_app['environment'].merge('RAILS_ENV' => 'staging'),
ssh_wrapper: '/tmp/ssh-git-wrapper.sh',
symlinks: {
@@ -135,6 +135,12 @@
end
end
context 'apt_repository' do
it 'debian' do
expect(chef_run).to add_apt_repository('apache2')
end
end
context 'Postgresql + git + nginx + sidekiq' do
it 'installs required packages for debian' do
expect(chef_run).to install_package('nginx')

0 comments on commit e6934a7

Please sign in to comment.