Commit 3dcccb8

mo khan <mo@mokhan.ca>
2015-05-23 02:35:11
update .env to include the rails_env in the name.
1 parent c6993e4
Changed files (5)
attributes/default.rb
@@ -57,9 +57,6 @@ default['unicorn']['rails_env'] = node.chef_environment
 default['monit']['application'] = 'app'
 #default['rbenv']['ruby_version'] = '2.2.2'
 default['rbenv']['rubies'] = [ "2.2.2" ]
-default['rbenv']['plugins'] = [
-  { 'name' => 'rbenv-gem-rehash', 'git_url' => 'https://github.com/sstephenson/rbenv-gem-rehash.git' }
-]
 default['aws']['username'] = node['user']['username']
 default['aws']['profiles']['default']['region'] = 'us-east-1'
 default['aws']['profiles']['default']['aws_access_key_id'] = 'secret'
recipes/capistrano.rb
@@ -26,7 +26,7 @@ directories.each do |dir_name|
   end
 end
 
-template "#{shared_path}/.env" do
+template "#{shared_path}/.env.#{node.chef_environment}" do
   source "env.erb"
   owner configuration['username']
   group configuration['username']
@@ -40,7 +40,7 @@ template "#{shared_path}/config/database.yml" do
   variables({
     rails_env: node.chef_environment,
     database: node['postgres']["database"],
-    username: node['postgres']['user'],
+    username: node['postgres']['username'],
     password: node['postgres']["password"],
     host: node['postgres']['host'],
   })
recipes/rbenv.rb
@@ -1,8 +1,10 @@
 include_recipe "ruby_build::default"
 include_recipe "rbenv::system"
 
+configuration = node['rbenv']
+rbenv_global configuration['rubies'].first
+
 #include_recipe "apt"
-#configuration = node['rbenv']
 
 #items = [ "build-essential", "tklib", "zlib1g-dev", "libssl-dev", "libreadline-gplv2-dev", "libxml2", "libxml2-dev", "libxslt1-dev" ]
 #items.each do |item|
templates/default/unicorn.erb
@@ -17,7 +17,8 @@ TIMEOUT=${TIMEOUT-60}
 APP_ROOT=<%= @current_path %>
 PID=$APP_ROOT/tmp/pids/unicorn.pid
 ENVIRONMENT=<%= @rails_env %>
-CMD="cd $APP_ROOT; bin/unicorn -E $ENVIRONMENT -D -c $APP_ROOT/config/unicorn.rb"
+#CMD="cd $APP_ROOT; bin/unicorn -E $ENVIRONMENT -D -c $APP_ROOT/config/unicorn.rb"
+CMD="cd $APP_ROOT; bin/foreman -e .env"
 action="$1"
 set -u
 
.kitchen.yml
@@ -53,4 +53,9 @@ suites:
       unicorn:
         username: 'rails'
         current_path: '/var/www/app/current'
+      postgres:
+        database: "mydb"
+        username: "rails"
+        password: "password"
+        host: "localhost"