Heroku Installfest


#1

Hey all!

The Heroku Installfest has been a barrier to newcomers since time immemorial.

Post here to ask for and/or give help.

Most importantly, don’t get discouraged! Setting things up is often complicated and frustrating.

We’re here to help.


#2

heroku run rails db:migrate

Gem::LoadError: Specified ‘postgresql’ for database adapter, but the gem is not loaded. Add gem ‘pg’ to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

Solution Credit: mindovermiles262
Explanation: A recent PostgreSQL update broke heroku. Changing your gem to an older version makes it work again.

  1. In your Gemfile, change:
group :production do
  gem 'pg'
end

to:

group :production do
  gem 'pg', '~> 0.20.0'
end
  1. Delete the file called Gemfile.lock
  2. Run bundle install --without production
  3. Run git commit -am "add version to pg"
  4. Run git push heroku master
  5. Try again

Need help with adding gem 'postgresql'
#5

[Reserved for Future Expansion]


#6

I’m doing the Installfest and everything has been ok so far (a few problems, but I managed to fix them googling for the sollutions). But now I’m stuck in the deplyoing the app to Heroku part! I think the problem starts when I type git push heroku master in the terminal, a series of warning messages come up:

! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.

remote: Detected buildpacks: Ruby,Node.js

remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order

Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running gem install bundler.

Yarn executable was not detected in the system.

remote: Download Yarn at https://yarnpkg.com/en/docs/install

WARNING:

remote: You have not declared a Ruby version in your Gemfile.

remote: To set your Ruby version add this line to your Gemfile:

remote: ruby ‘2.3.4’

remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.

WARNING:

remote: No Procfile detected, using the default web server.

remote: We recommend explicitly declaring how to boot your server process via a Procfile.

remote: https://devcenter.heroku.com/articles/ruby-default-web-server

So I ran gem install bundler and downloaded Yarn, as suggested , but I have no clue as to how to fix the other problems. In case I want to declare the Ruby version in the Gemfile (it’s ruby 2.3.4) where should I insert it? I visited those two webpages they mention in the warnings, but it doesn’t make much sense to me, because there’s too many technical terms :frowning:

Then when I run heroku run rails db:migrate I get these Error messages:

Gem::LoadError: Specified ‘postgresql’ for database adapter, but the gem is not loaded. Add gem 'pg' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

Gem::LoadError: can’t activate pg (~> 0.18), already activated pg-1.0.0. Make sure all dependencies are added to Gemfile.


#7

The warnings are just fine… you can comfortably ignore them for now.

The error at the end can probably be solved by the solution posted by @JonathanYiv above: Heroku Installfest


#8

Oh, I forgot to mention I had already tried it and it hadn’t worked. Turns out I was in the wrong directory (?) :see_no_evil: Now it worked! Thanks a lot, guys! :smiley:


#9

Hey guys, looking for some help! I just started the Odin Project, and was finishing off with the rails installfest, but during the deployment of the test_app, I keep getting an application error screen (After numerous attempts), can anyone provide some help please? I have restarted the project, copied and pasted the exact code, to make sure it was not an error on my side and still getting no where.


#10

Hey RDB931, I hope this isn’t too late.
Can you copy and paste what error you are getting via screenshot/text?


#11

Hey @JonathanYiv, Its all sorted! :smiley: I reinstalled all the software on ubuntu and ta da it worked. Thanks


#12

Hi guys, like so many I am at the end of the installfest and heroku just won’t let me push my app. That I set it all up on Fedora didn’t make the process any easier, but I got everything to work after some hours of googling, up until now

remote: Fetching mail 2.7.0
remote: Installing mail 2.7.0
remote: Downloading nokogiri-1.8.2 revealed dependencies not in the API or the lockfile
remote: (mini_portile2 (~> 2.3.0)).
remote: Either installing with --full-index or running bundle update nokogiri should
remote: fix the problem.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy…
remote:
remote: ! Push rejected to quiet-retreat-30444.
remote:

It also says I have a newer version of Bundler (1.16.1) versus the trusted version of 1.15.2 so should I set my version to the earlier one? It also says I should update everything (which I tried to no avail). Should I wipe my whole project and start anew?

I’d like to get around wiping my Linux and getting Ubuntu instead, btw, but if I have to do it, I will.

Thanks so far! o7


#13

lol nevermind, the solution on top of the post worked for me!

Nothing in the terminal indicated it, but adding the version to pg did the trick. Thanks a bunch!


#14

I was having issues and I found somewhere it said to remove:

group :production do
** gem ‘pg’, ‘~> 0.20.0’**
end

entirely. After doing so, I have no issues.


#15

Check that…I’m stuck

remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy…
remote:
remote: ! Push rejected to arcane-harbor-74422.
remote:
To https://git.heroku.com/arcane-harbor-74422.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ‘https://git.heroku.com/arcane-harbor-74422.git


#16

Did you try the solution at the top of the thread yet?


#17

Yes I have gone through the ‘solution’ with no luck. So I am stuck at 2.2 changing the Gemfile and preparing your rails app for deploying to Heroku.

This is the code I changed in the Gemfile
group :development, :test do
gem 'sqlite3’
end
group :production do
gem ‘pg’, ‘~> 0.20.0’
end

Here is the error message I get when I try to run ‘bundle install --without production’
[!] There was an error parsing Gemfile: syntax error, unexpected ‘~’, expecting keyword_do or ‘{’ or ‘(’ - gem ‘pg’, ‘~> 0.20.0’
^
/Users/mrmjp/railsbridge/test_app/Gemfile:16: unexpected fraction part after numeric literal
gem ‘pg’, ‘~> 0.20.0’
^. Bundler cannot continue.

from /Users/mrmjp/railsbridge/test_app/Gemfile:16

-------------------------------------------

group :production do

 gem ‘pg’, ‘~> 0.20.0’

end

-------------------------------------------


#18

I mdoing the Installfest and everything has been ok so far (a few problems, but I managed to fix them googling for the sollutions). But now I’m stuck in the deplyoing the app to Heroku part! I think the problem starts when I type heroku run rails db:migrate. i get an error sqlite3 is not part of the bundle. Add it to your Gemfile. I have followed all the instructions and tried deleting gemfile.LOCK but for some reasons it always comes back.


#19

We’re going to need to see all of your Gemfile @mrmjp

There is an error there somewhere.


#20

Bundle edge Rails instead: gem ‘rails’, github: ‘rails/rails’

gem ‘rails’, ‘~> 5.1.5’

group :development, :test do
gem 'sqlite3’
end

group :production do
gem ‘pg’, '~> 0.20.0’
end

Use Puma as the app server

gem ‘puma’, ‘~> 3.7’

Use SCSS for stylesheets

gem ‘sass-rails’, ‘~> 5.0’

Use Uglifier as compressor for JavaScript assets

gem ‘uglifier’, ‘>= 1.3.0’

gem ‘therubyracer’, platforms: :ruby

Use CoffeeScript for .coffee assets and views

gem ‘coffee-rails’, ‘~> 4.2’

Turbolinks makes navigating your web application faster. Read more:

gem ‘turbolinks’, ‘~> 5’

Build JSON APIs with ease. Read more:

gem ‘jbuilder’, ‘~> 2.5’

Use Redis adapter to run Action Cable in production

gem ‘redis’, ‘~> 4.0’

Use ActiveModel has_secure_password

gem ‘bcrypt’, ‘~> 3.1.7’

Use Capistrano for deployment

gem ‘capistrano-rails’, group: :development

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]

Adds support for Capybara system testing and selenium driver

gem ‘capybara’, '~> 2.13’
gem 'selenium-webdriver’
end

group :development do

Access an IRB console on exception pages or by using <%= console %> anywhere in the code.

gem ‘web-console’, '>= 3.3.0’
end

Windows does not include zoneinfo files, so bundle the tzinfo-data gem

gem ‘tzinfo-data’, platforms: [:mingw, :mswin, :x64_mingw, :jruby]


#21

Here Go. I don’t know why it is following my previous formatting of posting titles in bold…

source ‘https://rubygems.org

git_source(:github) do |repo_name|
** repo_name = “#{repo_name}/#{repo_name}” unless repo_name.include?("/")**
** “https://github.com/#{repo_name}.git”**
end

# Bundle edge Rails instead: gem ‘rails’, github: 'rails/rails’
gem ‘rails’, ‘~> 5.1.5’
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3’
end
group :production do
gem ‘pg’, ‘~> 0.20.0’
end
# Use Puma as the app server
gem ‘puma’, ‘~> 3.7’
# Use SCSS for stylesheets
gem ‘sass-rails’, ‘~> 5.0’
# Use Uglifier as compressor for JavaScript assets
gem ‘uglifier’, ‘>= 1.3.0’
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem ‘therubyracer’, platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem ‘coffee-rails’, ‘~> 4.2’
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem ‘turbolinks’, ‘~> 5’
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem ‘jbuilder’, ‘~> 2.5’
# Use Redis adapter to run Action Cable in production
# gem ‘redis’, ‘~> 4.0’
# Use ActiveModel has_secure_password
# gem ‘bcrypt’, ‘~> 3.1.7’

# Use Capistrano for deployment
# gem ‘capistrano-rails’, group: :development

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]**
** # Adds support for Capybara system testing and selenium driver**
** gem ‘capybara’, ‘~> 2.13’**
** gem ‘selenium-webdriver’**
end

group :development do
** # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.**
** gem ‘web-console’, ‘>= 3.3.0’**
** gem ‘listen’, ‘>= 3.0.5’, ‘< 3.2’**
** # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring**
** gem ‘spring’**
** gem ‘spring-watcher-listen’, ‘~> 2.0.0’**
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem ‘tzinfo-data’, platforms: [:mingw, :mswin, :x64_mingw, :jruby]


#22

The thing that looks a bit weird in your paste is here gem 'sqlite3’

The opening ’ looks different to the closing '. The other gems don’t have that issue. Maybe in the copy / paste something has happened. I’d look there first to see if there is an issue.