Skip to content

Commit

Permalink
Allow deploying to heroku (#20)
Browse files Browse the repository at this point in the history
* Use pg on production

* Update Gemfile.lock

* Update databse.yml

* Allow colorize to be loaded by default by ActiveSupport

Hopefully solves this error:
 !     Could not detect rake tasks
 !     ensure you can run `$ bundle exec rake -P` against your app
 !     and using the production group of your Gemfile.
 !     rake aborted!
 !     LoadError: cannot load such file -- colorize

* And update Gemfile.lock again

* Try this other thing

* Heroku is being needy

* Add procfile

* Upgrade sprockets

Fix for this message:

sh: 2: config.assets.compile: not found
 !
 !     A security vulnerability has been detected in your application.
 !     To protect your application you must take action. Your application
 !     is currently exposing its credentials via an easy to exploit directory
 !     traversal.
 !
 !     To protect your application you must either upgrade to Sprockets version "3.7.2"
 !     or disable dynamic compilation at runtime by setting:

* Have heroku automigrate
  • Loading branch information
szhu authored Jun 25, 2018
1 parent afb9c33 commit 37b6e05
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
15 changes: 13 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source "https://rubygems.org"
ruby "2.5.0"

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
Expand All @@ -9,7 +10,8 @@ group :production, :development, :test do
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 5.1.5", require: false
# Use sqlite3 as the database for Active Record
gem "sqlite3", require: false
# sqlite is disabled here because we want to use it only for development.
# gem "sqlite3", require: false
# Use Puma as the app server
gem "puma", "~> 3.7", require: false
# Use SCSS for stylesheets
Expand Down Expand Up @@ -38,10 +40,19 @@ group :production, :development, :test do
##############################

gem "activeadmin"
gem "colorize"
gem "devise"
gem "haml"
end

group :production do
##############################
# Place all added gems below #
##############################

gem "pg"
end

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
# gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
Expand All @@ -54,12 +65,12 @@ group :development, :test do
##############################

gem "awesome_print", require: true
gem "colorize", require: false
gem "cucumber", require: false
gem "cucumber_lint", require: false
gem "pry-nav", require: true
gem "pry-rails", require: true
gem "rubocop", require: false
gem "sqlite3", require: false
end

group :development do
Expand Down
9 changes: 7 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ GEM
parallel (1.12.1)
parser (2.5.0.5)
ast (~> 2.4.0)
pg (1.0.0)
polyamorous (1.3.3)
activerecord (>= 3.0)
powerpack (0.1.1)
Expand All @@ -201,7 +202,7 @@ GEM
pry (>= 0.10.4)
public_suffix (3.0.2)
puma (3.11.3)
rack (2.0.4)
rack (2.0.5)
rack-test (0.8.3)
rack (>= 1.0, < 3)
rails (5.1.5)
Expand Down Expand Up @@ -278,7 +279,7 @@ GEM
actionpack (> 4, < 5.2)
activemodel (> 4, < 5.2)
slop (3.6.0)
sprockets (3.7.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
Expand Down Expand Up @@ -333,6 +334,7 @@ DEPENDENCIES
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
mdl
pg
pry-nav
pry-rails
puma (~> 3.7)
Expand All @@ -348,5 +350,8 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console (>= 3.3.0)

RUBY VERSION
ruby 2.5.0p0

BUNDLED WITH
1.16.1
4 changes: 4 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://devcenter.heroku.com/articles/getting-started-with-rails5#webserver
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
# https://mentalized.net/journal/2017/04/22/run-rails-migrations-on-heroku-deploy/
release: bundle exec rake db:migrate
4 changes: 2 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ test:
database: db/test.sqlite3

production:
<<: *default
database: db/production.sqlite3
url: <%= ENV["DATABASE_URL"] %>
pool: <%= ENV["DB_POOL"] || ENV['RAILS_MAX_THREADS'] || 5 %>

0 comments on commit 37b6e05

Please sign in to comment.