Commit 2374521
Changed files (6)
attributes/default.rb
@@ -0,0 +1,43 @@
+default['user']['username'] = 'rails'
+default['capistrano']['root_path'] = '/var/www/app'
+default['capistrano']['username'] = default['user']['username']
+default['capistrano']['env'] = {
+ aws: {
+ access_key: '',
+ secret_access_key: '',
+ product_key: '',
+ associate_id: '',
+ s3_backup_bucket: '',
+ s3_bucket: '',
+ },
+ asset_host: '',
+ smtp: {
+ host: '',
+ port: '',
+ domain: '',
+ username: '',
+ password: '',
+ },
+ mix_panel_api_key: '',
+ secret_token: '',
+ google_analytics: '',
+ embedly_key: '',
+ facebook_app_id: '',
+ disqus: {
+ api_key: '',
+ secret_key: '',
+ short_name: '',
+ },
+ exception_email_address: '',
+ mailchimp: {
+ api_key: '',
+ list_id: '',
+ },
+ twitter: {
+ consumer_key: '',
+ consumer_secret: '',
+ access_token: '',
+ access_secret: '',
+ },
+ newrelic_key: '',
+}
recipes/capistrano.rb
@@ -1,8 +1,11 @@
+include_recipe "mokhan-myface::user"
+
configuration = node['capistrano']
root_path = configuration['root_path']
shared_path = File.join(root_path, "shared")
+
directories = [
- configuration['root_path'],
+ root_path,
shared_path,
"#{shared_path}/backups",
"#{shared_path}/bundle",
recipes/user.rb
@@ -0,0 +1,8 @@
+configuration = node['user']
+
+user configuration['username'] do
+ comment "rails user"
+ home "/home/#{configuration['username']}"
+ shell "/bin/bash"
+end
+
spec/default_spec.rb
@@ -1,21 +1,2 @@
describe 'mokhan-myface::default' do
- let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04').converge(described_recipe) }
-
- it 'installs apache2' do
- expect(chef_run).to install_package('apache2')
- end
-
- it 'starts the apache2 service' do
- expect(chef_run).to start_service('apache2')
- end
-
- it 'enables apache2 to start on boot' do
- expect(chef_run).to enable_service('apache2')
- end
-
- it 'creates the default template' do
- expect(chef_run).to create_template('/var/www/index.html')
- .with_owner('root')
- .with_group('root')
- end
end
spec/user_spec.rb
@@ -0,0 +1,13 @@
+describe "mokhan-myface::user" do
+ subject do
+ ChefSpec::SoloRunner.new do |node|
+ node.set['user']['username'] = username
+ end.converge(described_recipe)
+ end
+
+ let(:username) { FFaker::Internet.user_name }
+
+ it 'creates the rails user' do
+ expect(subject).to create_user(username)
+ end
+end
.kitchen.yml
@@ -7,10 +7,13 @@ provisioner:
platforms:
- name: ubuntu-14.04
- - name: centos-6.4
suites:
- name: default
run_list:
- recipe[mokhan-myface::default]
+ - recipe[mokhan-myface::capistrano]
+ #- recipe[mokhan-myface::delayed_job]
+ #- recipe[mokhan-myface::nginx]
+ #- recipe[mokhan-myface::unicorn]
attributes: