From 3b4f9f8f1ced3d1c4793e0ceb2e6e2f1f524398f Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 19 Mar 2013 17:46:21 +0000 Subject: [PATCH 1/6] Migrate to Heroku Cedar stack --- Gemfile | 9 +++++---- Gemfile.lock | 7 +++++++ config/initializers/mail.rb | 20 +++++++++++--------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index aa2c8c9..8a0af10 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' - +ruby "1.9.2" gem 'rails', '3.2.12' # Gems used only for assets and not required @@ -22,9 +22,6 @@ gem 'jquery-rails' # To use Jbuilder templates for JSON # gem 'jbuilder' -# Use unicorn as the app server -# gem 'unicorn' - # Deploy with Capistrano # gem 'capistrano' @@ -39,6 +36,10 @@ gem 'will_paginate', '~> 3.0' gem 'activerecord-postgresql-adapter' gem 'pg' +group :production do + gem 'unicorn' +end + group :development do gem 'meta_request' gem 'better_errors' diff --git a/Gemfile.lock b/Gemfile.lock index 269c60d..7508b69 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,6 +81,7 @@ GEM json (1.7.7) jwt (0.1.5) multi_json (>= 1.0) + kgio (2.8.0) loofah (1.0.0) nokogiri (>= 1.3.3) mail (2.4.4) @@ -127,6 +128,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) + raindrops (0.10.0) rake (10.0.3) rdoc (3.12.1) json (~> 1.4) @@ -155,6 +157,10 @@ GEM uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) + unicorn (4.6.2) + kgio (~> 2.6) + rack + raindrops (~> 0.7) will_paginate (3.0.4) PLATFORMS @@ -175,4 +181,5 @@ DEPENDENCIES sass-rails (~> 3.2.3) sorcery uglifier (>= 1.0.3) + unicorn will_paginate (~> 3.0) diff --git a/config/initializers/mail.rb b/config/initializers/mail.rb index 01a3439..ae8cabb 100644 --- a/config/initializers/mail.rb +++ b/config/initializers/mail.rb @@ -1,9 +1,11 @@ -ActionMailer::Base.smtp_settings = { - :address => 'smtp.sendgrid.net', - :port => '587', - :authentication => :plain, - :user_name => ENV['SENDGRID_USERNAME'], - :password => ENV['SENDGRID_PASSWORD'], - :domain => 'heroku.com' -} -ActionMailer::Base.delivery_method = :smtp +if(Rails.env.production?) + ActionMailer::Base.smtp_settings = { + :address => 'smtp.sendgrid.net', + :port => '587', + :authentication => :plain, + :user_name => ENV['SENDGRID_USERNAME'], + :password => ENV['SENDGRID_PASSWORD'], + :domain => 'heroku.com' + } + ActionMailer::Base.delivery_method = :smtp +end \ No newline at end of file From 0ea729457b7c30bd775afe876a8d832fe5b4cb35 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 19 Mar 2013 18:14:05 +0000 Subject: [PATCH 2/6] Add Procfile --- Procfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..4364d40 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec unicorn -p -E From 00b3c46758778fc149738c5cc7b5ab159bceb2c7 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 19 Mar 2013 18:25:59 +0000 Subject: [PATCH 3/6] Fix omitted vars --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 4364d40..3daf4f2 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: bundle exec unicorn -p -E +web: bundle exec unicorn -p $PORT -E $RACK_ENV From ff152512c0485bd733def407174dcb9c79ce3834 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 19 Mar 2013 18:39:02 +0000 Subject: [PATCH 4/6] Don't precompile pipeline assets (fix for Heroku Cedar) --- config/application.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/application.rb b/config/application.rb index 57fa486..52bc9f2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -65,6 +65,9 @@ module Apollo # Enable the asset pipeline config.assets.enabled = true + # https://devcenter.heroku.com/articles/rails-asset-pipeline#troubleshooting + config.assets.initialize_on_precompile = false # Fix for Heroku Cedar + # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.1' From 58a217b121b898e5944ee692c9303b41899a1807 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 19 Mar 2013 18:42:50 +0000 Subject: [PATCH 5/6] Disable old MongoMapper code --- app/models/error_log.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/error_log.rb b/app/models/error_log.rb index e2cd07d..7d1be41 100644 --- a/app/models/error_log.rb +++ b/app/models/error_log.rb @@ -1,8 +1,8 @@ -class ErrorLog - include MongoMapper::Document +# class ErrorLog +# include MongoMapper::Document - key :ts, Time - key :params, Hash - key :pois_returned, Integer +# key :ts, Time +# key :params, Hash +# key :pois_returned, Integer -end +# end From 657e4c2c67b65387b953e8b9e593747821d5de26 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Wed, 20 Mar 2013 16:41:41 +0000 Subject: [PATCH 6/6] Require login for layers controller --- app/controllers/layers_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/layers_controller.rb b/app/controllers/layers_controller.rb index b69537d..167b0ae 100644 --- a/app/controllers/layers_controller.rb +++ b/app/controllers/layers_controller.rb @@ -1,4 +1,6 @@ class LayersController < ApplicationController + before_filter :require_login + # GET /layers # GET /layers.json def index