Commit 9472eb6

mo khan <mo@mokhan.ca>
2015-05-22 21:31:57
add example attributes to test kitchen and dynamically build out .env.
1 parent f3e2c34
Changed files (3)
recipes
templates
default
recipes/nginx.rb
@@ -25,7 +25,7 @@ cookbook_file "/etc/nginx/ssl/#{configuration['domain']}.crt" do
   mode "0644"
 end
 
-cookbook_file "/etc/nginx/ssl/#{configuration[:domain]}.key" do
+cookbook_file "/etc/nginx/ssl/#{configuration['domain']}.key" do
   source "#{node.chef_environment}.key"
   mode "0644"
 end
@@ -35,14 +35,14 @@ cookbook_file "/etc/nginx/conf.d/blacklist.conf" do
   mode "0644"
 end
 
-template "/etc/nginx/sites-available/#{configuration[:domain]}" do
+template "/etc/nginx/sites-available/#{configuration['domain']}" do
   source "nginx_unicorn.erb"
   mode "0644"
   variables(configuration)
   notifies :restart, "service[nginx]"
 end
 
-link "/etc/nginx/sites-enabled/#{configuration[:domain]}" do
+link "/etc/nginx/sites-enabled/#{configuration['domain']}" do
   to "/etc/nginx/sites-available/cakeside"
 end
 
templates/default/env.erb
@@ -1,32 +1,3 @@
-AWS_ACCESS_KEY_ID=<%= @aws[:access_key] %>
-AWS_SECRET_ACCESS_KEY=<%= @aws[:secret_access_key] %>
-AWS_PRODUCT_KEY=<%= @aws[:product_key] %>
-AWS_PRODUCT_SECRET=<%= @aws[:product_secret] %>
-AWS_PRODUCT_ASSOCIATE_ID=<%= @aws[:associate_id] %>
-AWS_S3_BACKUPS_BUCKET=<%= @aws[:s3_backup_bucket] %>
-FOG_DIRECTORY=<%= @aws[:s3_bucket] %>
-ASSET_SYNC_GZIP_COMPRESSION=true
-ASSET_SYNC_EXISTING_REMOTE_FILES=keep
-ASSET_HOST=<%= @asset_host %>
-SMTP_HOST=<%= @smtp[:host] %>
-SMTP_PORT=<%= @smtp[:port] %>
-SMTP_DOMAIN=<%= @smtp[:domain] %>
-SMTP_USERNAME=<%= @smtp[:username] %>
-SMTP_PASSWORD=<%= @smtp[:password] %>
-MIXPANEL_API_KEY=<%= @mix_panel_api_key %>
-SECRET_TOKEN=<%= @secret_token %>
-SECRET_KEY_BASE=<%= @secret_token %>
-GOOGLE_ANALYTICS=<%= @google_analytics %>
-EMBEDLY_KEY=<%= @embedly_key %>
-FACEBOOK_APP_ID=<%= @facebook_app_id %>
-DISQUS_API_KEY=<%= @disqus[:api_key] %>
-DISQUS_SECRET_KEY=<%= @disqus[:secret_key] %>
-DISQUS_SHORTNAME=<%= @disqus[:short_name] %>
-EXCEPTION_EMAIL_ADDRESS=<%= @exception_email_address %>
-MAILCHIMP_API_KEY=<%= @mailchimp[:api_key] %>
-MAILCHIMP_LIST_ID=<%= @mailchimp[:list_id] %>
-TWITTER_CONSUMER_KEY=<%= @twitter[:consumer_key] %>
-TWITTER_CONSUMER_SECRET=<%= @twitter[:consumer_secret] %>
-TWITTER_ACCESS_TOKEN=<%= @twitter[:access_token] %>
-TWITTER_ACCESS_SECRET=<%= @twitter[:access_secret] %>
-NEWRELIC_KEY=<%= @newrelic_key %>
+<% @env.each do |key, value| %>
+<%= key.to_s.upcase %>=<%= value %>
+<% end %>
.kitchen.yml
@@ -29,3 +29,28 @@ suites:
           postgres: 'password'
       rbenv:
         ruby_version: '2.2.2'
+  - name: web
+    run_list:
+      - recipe[mokhan-myface::default]
+      - recipe[mokhan-myface::rails]
+    attributes:
+      rbenv:
+        ruby_version: '2.2.2'
+      user:
+        username: 'rails'
+      aws:
+        username: 'rails'
+      monit:
+        application: 'mokhan-myface'
+      capistrano:
+        root_path: '/var/www/app/'
+        username: 'rails'
+        env:
+          app_api_key: 'api-key'
+          app_secret_key: 'secret-key'
+      nginx:
+        domain: 'www.mokhan.ca'
+      unicorn:
+        username: 'rails'
+        current_path: '/var/www/app/current'
+