Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
fix(chef): Removed broken deployer cookbook
Browse files Browse the repository at this point in the history
Resolves #155
  • Loading branch information
ajgon committed May 22, 2018
1 parent 8ea8eee commit 51a4942
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PreCommit:
- RELEASING.md
Foodcritic:
enabled: true
flags: ['-t', '~FC101']
flags: ['-t', '~chef13', '-t', '~chef14', '-t', '~chef15', '-t', '~chef16']
HardTabs:
enabled: true
exclude:
Expand Down
6 changes: 5 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# frozen_string_literal: true

# ruby
# deployer
default['deployer']['user'] = 'deploy'
default['deployer']['group'] = 'deploy'
default['deployer']['home'] = "/home/#{default['deployer']['user']}"

# ruby
default['build-essential']['compile_time'] = true
default['ruby-ng']['ruby_version'] = node['ruby'].try(:[], 'version') || '2.5'
default['nginx']['source']['modules'] = %w[
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
chef_version '~> 12.0' if respond_to?(:chef_version)

depends 'apt', '< 7'
depends 'deployer'
depends 'nginx'
depends 'logrotate'
depends 'ruby-ng'
depends 's3_file'
depends 'sudo'

supports 'amazon', '>= 2017.03'
supports 'ubuntu', '>= 16.04'
Expand Down
22 changes: 21 additions & 1 deletion recipes/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@

prepare_recipe

# Create deployer user
group node['deployer']['group'] do
gid 5000
end

user node['deployer']['user'] do
comment 'The deployment user'
uid 5000
gid 5000
shell '/bin/bash'
home node['deployer']['home']
end

sudo node['deployer']['user'] do
user node['deployer']['user']
group node['deployer']['group']
commands %w[ALL]
host 'ALL'
nopasswd true
end

# Monit and cleanup
if node['platform_family'] == 'debian'
execute 'mkdir -p /etc/monit/conf.d'
Expand All @@ -21,7 +42,6 @@
end

# Ruby and bundler
include_recipe 'deployer'
if node['platform_family'] == 'debian'
include_recipe 'ruby-ng::dev'
else
Expand Down
22 changes: 20 additions & 2 deletions spec/unit/recipes/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,26 @@
stub_command('which nginx').and_return(false)
end

it 'includes recipes' do
expect(chef_run).to include_recipe('deployer')
context 'Deployer' do
it 'debian user' do
expect(chef_run).to create_group('deploy').with(gid: 5000)
expect(chef_run).to create_user('deploy').with(
comment: 'The deployment user',
uid: 5000,
gid: 5000,
home: '/home/deploy'
)
end

it 'rhel user' do
expect(chef_run).to create_group('deploy').with(gid: 5000)
expect(chef_run).to create_user('deploy').with(
comment: 'The deployment user',
uid: 5000,
gid: 5000,
home: '/home/deploy'
)
end
end

context 'Rubies' do
Expand Down

0 comments on commit 51a4942

Please sign in to comment.