diff --git a/Gemfile b/Gemfile index 90477bb..694dd25 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source 'https://rubygems.org' gem 'rails', '4.2.4' -gem 'sqlite3' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' @@ -16,9 +15,16 @@ gem 'simple_form' gem 'omniauth-reddit', :git => 'git://github.com/jackdempsey/omniauth-reddit.git' +group :production do + gem 'rails_12factor' + gem 'pg' + gem 'puma' +end + group :development, :test do gem 'dotenv-rails' gem 'byebug' + gem 'sqlite3' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index fc46d12..36c87a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -113,6 +113,8 @@ GEM omniauth-oauth2 (1.3.1) oauth2 (~> 1.0) omniauth (~> 1.2) + pg (0.18.3) + puma (2.14.0) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.4) @@ -142,6 +144,11 @@ GEM ruby-graphviz (~> 1.2) rails-html-sanitizer (1.0.2) loofah (~> 2.0) + rails_12factor (0.0.3) + rails_serve_static_assets + rails_stdout_logging + rails_serve_static_assets (0.0.4) + rails_stdout_logging (0.0.4) railties (4.2.4) actionpack (= 4.2.4) activesupport (= 4.2.4) @@ -207,9 +214,12 @@ DEPENDENCIES jbuilder (~> 2.0) jquery-rails omniauth-reddit! + pg + puma quiet_assets rails (= 4.2.4) rails-erd + rails_12factor sass-rails (~> 5.0) sdoc (~> 0.4.0) simple_form diff --git a/config/database.yml b/config/database.yml index 1c1a37c..75b202b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -21,5 +21,6 @@ test: database: db/test.sqlite3 production: - <<: *default - database: db/production.sqlite3 + adapter: postgresql + encoding: unicode + pool: 5 diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..afdb99a --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,15 @@ +workers Integer(ENV['WEB_CONCURRENCY'] || 2) +threads_count = Integer(ENV['MAX_THREADS'] || 5) +threads threads_count, threads_count + +preload_app! + +rackup DefaultRackup +port ENV['PORT'] || 3000 +environment ENV['RACK_ENV'] || 'development' + +on_worker_boot do + # Worker specific setup for Rails 4.1+ + # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot + ActiveRecord::Base.establish_connection +end