Error running Heroku bundle - ruby-on-rails

I just updated my Gemfile and upgraded to rails 4.0.0 and ruby 2.0.0. I ran bundle install, bundle update, then pushed to Heroku. Then I migrated the db.
The app works on localhost but shows an application error on Heroku.
So I ran heroku run bundle update, which gave the following error:
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment`.
You have added to the Gemfile:
* source: https://github.com/NoamB/sorcery (at master)
* source: rubygems repository https://rubygems.org/
* rails (= 4.0.0)
* sass-rails (~> 4.0.0)
* uglifier (>= 1.3.0)
* coffee-rails (~> 4.0.0)
* jquery-rails
* turbolinks
* jbuilder (~> 1.2)
* sorcery
* thin
* pg
* rails_12factor
* sdoc
* mailcatcher
* rspec-rails
* sqlite3
* foreman
* quiet_assets
You have changed in the Gemfile:
* sorcery from `https://github.com/NoamB/sorcery (at master)` to `no specified source`
This is what my .gitignore file looks like:
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
# Ignore bundler config
.bundle
# Ignore the default SQLite database.
db/*.sqlite3
db/*.sqlite3-journal
db/development.sqlite3
# Ignore all logfiles and tempfiles.
log/*.log
tmp
.DS_Store
.sass-cache
.ruby-version
Procfile
.rspec
The error on Heroku is just a standard "Application error. An error occurred in the application and your page could not be served."
Here are my Heroku logs

Related

capistrano deployment fails db:migrate after release upgrade to focal fossa

I just upgrade my server to ubuntu 20 LTS, Focal Fossa. Afterwards some stuff did not work as it should. One thing I would like to ask you for help is, that my Rails app is no longer deployable with capistrano. Right before the upgrade it worked.
I just run from remote:
cap staging deploy
Eveything works fine, authentication at github and so on, but at the db:migrate part it fails with the following info:
deploy:migrating
01 ~/.rvm/bin/rvm default do bundle exec rake db:migrate
01 rake aborted!
LoadError: libssl.so.1.0.0: cannot open shared object file: No such file or directory -
/home/prod/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/x86_64-linux/openssl.so
...
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as prod#serverip: Exception while executing as prod#serverip: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
LoadError: libssl.so.1.0.0: cannot open shared object file: No such file or directory - /home/prod/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/x86_64-linux/openssl.so
The file is there and the user prod has all rights to access it. There is only one version of ruby on the server installed by rvm. The latest version of openssl is installed on the server. Postgres is running and contains lists all databases as it should.
here the version list from the gemfile.lock:
capistrano (3.14.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.0.1)
capistrano (~> 3.1)
capistrano-npm (1.0.3)
capistrano (>= 3.0.0)
capistrano-nvm (0.0.7)
capistrano (~> 3.1)
capistrano-rails (1.6.1)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
What can I do, i hope you can help me!
Thanks and best regards,
Stephan

"rails server" not seeing rails project locally which works fine on heroku

I am new to rails and just created simple "empty" app in heroku and synchronized that with my dropbox account. I was able to open heroku site in web browser, then I changed index.rb and deployed the application and changes was done correctly, I saw the result in web browser.
So the application in dropbox folder works correctly BUT I am not able to run it locally. When I type rails server in project folder it just not recognized the project and gave me:
C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>rails server
DL is deprecated, please use Fiddle
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby bina
ry of your choice
# Default: C:/RailsInst
aller/Ruby2.0.0/bin/ruby.exe
-m, [--template=TEMPLATE] # Path to some applicat
ion template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfil
e
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle inst
all
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
[--skip-keeps], [--no-skip-keeps] # Skip source control .
keep files
-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record fi
les
-V, [--skip-action-view], [--no-skip-action-view] # Skip Action View file
s
-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
[--skip-spring], [--no-skip-spring] # Don't install Spring
application preloader
-d, [--database=DATABASE] # Preconfigure for sele
cted database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserv
er/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
-j, [--javascript=JAVASCRIPT] # Preconfigure for sele
cted JavaScript library
# Default: jquery
-J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
[--dev], [--no-dev] # Setup the application
with Gemfile pointing to your Rails checkout
[--edge], [--no-edge] # Setup the application
with Gemfile pointing to Rails repository
-T, [--skip-test-unit], [--no-skip-test-unit] # Skip Test::Unit files
[--rc=RC] # Path to file containi
ng extra configuration options for rails command
[--no-rc], [--no-no-rc] # Skip loading of extra
configuration options from .railsrc file
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend], [--no-pretend] # Run but do not make any changes
-q, [--quiet], [--no-quiet] # Suppress status output
-s, [--skip], [--no-skip] # Skip files that already exist
Rails options:
-h, [--help], [--no-help] # Show this help message and quit
-v, [--version], [--no-version] # Show Rails version number and quit
Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.
Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.
Example:
rails new ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
These are my Ruby and Rails versions(Ruby 2.0 and Rails 4.1.8):
C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>ruby -v
ruby 2.0.0p598 (2014-11-13) [i386-mingw32]
C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>rails -v
DL is deprecated, please use Fiddle
Rails 4.1.8
C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>gem list
*** LOCAL GEMS ***
bundler (1.11.2)
jar-dependencies (0.1.15)
jruby-openssl (0.9.7 java)
jruby-win32ole (0.8.5)
json (1.8.0 java)
minitest (5.4.1)
power_assert (0.2.3)
psych (2.0.14.pre1 java)
rake (10.1.0)
rdoc (4.1.0)
ruby-maven (3.3.3)
ruby-maven-libs (3.3.3)
test-unit (3.0.3)
and finally this is heroku build log for reference(Ruby 2.2.2 and Rails 4.1.8):
-----> Using set buildpack heroku/ruby
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.2-jruby-9.0.0.0
-----> Installing JVM: openjdk-8
-----> Installing dependencies using bundler 1.9.7
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Using json 1.8.1
Using minitest 5.4.3
Using thread_safe 0.3.4
Using builder 3.2.2
Using erubis 2.7.0
Using rake 10.4.0
Using rack 1.5.2
Using i18n 0.6.11
Using mime-types 2.4.3
Using arel 5.0.1.20140414130214
Using coffee-script-source 1.8.0
Using jdbc-postgres 9.3.1102
Using execjs 2.2.2
Using thor 0.19.1
Using hike 1.2.3
Using multi_json 1.10.1
Using bundler 1.9.7
Using tilt 1.4.1
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Using sass 3.2.19
Using tzinfo 1.2.2
Using rdoc 4.1.2
Using mail 2.6.3
Using rack-test 0.6.2
Using puma 2.9.1
Using coffee-script 2.3.0
Using uglifier 2.5.3
Using rails_12factor 0.0.3
Using sprockets 2.12.3
Using activesupport 4.1.8
Using tzinfo-data 1.2015.1
Using sdoc 0.4.1
Using actionview 4.1.8
Using activemodel 4.1.8
Using jbuilder 2.2.5
Using actionpack 4.1.8
Using activerecord 4.1.8
Using actionmailer 4.1.8
Using sprockets-rails 2.2.2
Using railties 4.1.8
Using activerecord-jdbc-adapter 1.3.14
Using activerecord-jdbcpostgresql-adapter 1.3.14
Using coffee-rails 4.0.1
Using jquery-rails 3.1.2
Using rails 4.1.8
Using sass-rails 4.0.5
Using turbolinks 2.5.2
Bundle complete! 13 Gemfile dependencies, 48 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
Bundle completed (8.97s)
Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (13.25s)
Cleaning assets
Running: rake assets:clean
-----> Discovering process types
Procfile declares types -> web
Default types for buildpack -> console, rake, worker
-----> Compressing...
Done: 101.5M
-----> Launching...
Released v8
Try to run bundle install to install your gems, go to db/migrate and run rake db:migrate and then rails s.

Can't seem to install rubocop gem using Rails 4

I tried installing rubocop by adding the suggested line to my Rails project's Gemfile:
gem 'rubocop', require: false
After running bundle, it installs and is visible in my Gemfile.lock.
However when running $ rubocop from my application's root I receive this error:
-bash: rubocop: command not found
I tried running $ which rubocop, and nothing comes up.
I've also tried running $ gem install rubocop, with no difference in behavior.
Here is the excerpt from my Gemfile.lock:
rubocop (0.27.0)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.6, < 3.0)
powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
You have to run this command:
source ~/.bashrc
As right after running $ bundle command the gem was installed and its environment was set in your ~/.bashrc, but since you continued to use the old bash session you didn't get rubocop available as a command in your bash. Hence, either re-login in your bash(close and then open the terminal again) or run the command stated above.

ROR Installation (Heroku Error Push Fail)

-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* sqlite3 (= 1.3.5)
* sass-rails (= 3.2.5)
* coffee-rails (= 3.2.2)
* uglifier (= 1.2.3)
* jquery-rails (= 2.0.2)
* pg (= 0.12.2)
You have deleted from the Gemfile:
* coffee-rails (~> 3.2.1)
* jquery-rails
* sass-rails (~> 3.2.3)
* sqlite3
* uglifier (>= 1.0.3)
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
As, log is saying:
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
I think you have not commited Gemfile.lock file before pushing to heroku. Run bundle install and then commit both Gemfile and Gemfile.lock. After that push code to heroku.

bundle install works, but bundle-show gives error "rails.git is not yet checked out. Please run `bundle install`"

I've recently updated our Gemfile to use a forked copy rails on our github account. We've created a custom branch off the 2.3-stable branch (which I'll call the_bugfix_branch) and added gemspecs for each of the gems to make them findable by bundler.
My Gemfile has the following:
git 'git://github.com/ourgithub/rails.git', :branch => "the_bugfix_branch" do
# Note: load-order is essential for dependencies
gem 'activesupport', '2.3.2' # this must go first
gem 'actionpack', '2.3.2' # this must go second
gem 'actionmailer', '2.3.2'
gem 'activerecord', '2.3.2'
gem 'activeresource','2.3.2'
gem 'rails', '2.3.2' # this must go last
end
bundle install runs happily giving me (amongst all the rest of the gem output):
Using actionpack (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
Using actionmailer (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
Using activesupport (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
Using activerecord (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
Using activeresource (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
...
Using rails (2.3.2) from git://github.com/ourgithub/rails.git (at the_bugfix_branch)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
I then checkin and commit Gemfile.lock which contains:
GIT
remote: git://github.com/ourgithub/rails.git
revision: 3fc562f9b1def3ad9a7abbfd5ccfa713a6dbc39f
branch: the_bugfix_branch
specs:
actionmailer (2.3.2)
actionpack (= 2.3.2)
actionpack (2.3.2)
actionpack (= 2.3.2)
activerecord (2.3.2)
activesupport (= 2.3.2)
activeresource (2.3.2)
activesupport (= 2.3.2)
activesupport (2.3.2)
rails (2.3.2)
actionmailer (= 2.3.2)
actionpack (= 2.3.2)
activerecord (= 2.3.2)
activeresource (= 2.3.2)
activesupport (= 2.3.2)
rake (>= 0.8.3)
However if I try to spin up the server, it tells me:
The git source git://github.com/ourgithub/rails.git is not yet checked out. Please run `bundle install` before trying to start your application
I also get the exact same message if I try bundle show rails or bundle check:
> bundle show rails
The git source git://github.com/ourgithub/rails.git is not yet checked out. Please run `bundle install` before trying to start your application
> bundle check
git://github.com/ourgithub/rails.git (at the_bugfix_branch) is not checked out. Please run `bundle install`
If I try bundle install --deployment (just for kicks) it gives:
> bundle install --deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* source: git://github.com/ourgithub/rails.git (at the_bugfix_branch)
You have deleted from the Gemfile:
* source: git://github.com/ourgithub/rails.git (at the_bugfix_branch)
You have changed in the Gemfile:
* activeresource from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* activerecord from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* actionmailer from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* actionpack from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* activesupport from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
* rails from `git://github.com/ourgithub/rails.git (at the_bugfix_branch)` to `no specified source`
I've clearly not just changed my Gemfile, and I most certainly have run bundle install since the time I did add that stuff to the Gemfile.
I've googled for "is not yet checked out. Please run bundle install before trying to start your application" and all the "bundle install won't work" questions that I can find seem to say "just run bundle install then checkin your copy of Gemfile.lock"... which I've clearly done. They also tend to be about bundle-install failing on production, but mine fails this way also on development.
I don't think this is a simple Gemfile/Gemfile.lock mismatch problem!
Some of the google results tell me to try removing .bundle/config and running it again. I've tried that to the same (lack of) effect.
Specifically, I went through all of the rm -rf lines of this troubleshooting guide: https://github.com/carlhuda/bundler/blob/master/ISSUES.md before re-running bundle install.
No change in the error message.
Any ideas?
Taryn East said:
I don't think this is a simple Gemfile/Gemfile.lock mismatch problem!
Turns out I was wrong.
The solution was to remove the version-numbers in the Gemfile, and explicitly use the branch instead:
git 'git://github.com/ourgithub/rails.git', :branch => "the_bugfix_branch" do
# Note: load-order is essential for dependencies
gem 'activesupport', :branch => "the_bugfix_branch" # this must go first
gem 'actionpack', :branch => "the_bugfix_branch" # this must go second
gem 'actionmailer', :branch => "the_bugfix_branch"
gem 'activerecord', :branch => "the_bugfix_branch"
gem 'activeresource',:branch => "the_bugfix_branch"
gem 'rails', :branch => "the_bugfix_branch" # this must go last
end
bundler was getting confused with the version-number on one hand, and the branch on the other.
Explicitly setting the branch for every gem listed, seemed to finally do the trick!

Resources