I have trouble deploying my app on heroku. I have added 'pg' gem to Gemfile, and even try to include something like gem 'therubyracer-heroku'.
during
heroku rake db:migrate
I get something like this:
>heroku rake db:migrate
--trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'
Another interesting part is that while pushing to heroku pg is not mentioned during bundle install operation like if it was ignored. I also watched the Gemfile.lock and pg is mentioned there to:
pg (0.11.0-x86-mingw32)
I wonder if it is a Windows gem issue that cause heroku to ignore the pg gem or something ?
Can anyone help or had similar problem ?
//EDIT
Seems related: enter link description here
And looks unsolveable
In your Gemfile limit postgres to your production group;
group :production do
gem "pg"
end
rebundle
bundle --without production
and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.
Related
I have a ruby on rails project to be deployed with capistrano. Basically I could deploy it with the following code.
cap production deploy
But it gives me the following failure message.
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
Capfile locked at 3.2.1, but 3.3.3 is loaded
I can not find anything on this exception. Do you know what is the real problem. BTW bundle update does not work.
See your config/deploy.rb if there is something such as lock '3.2.1'. Because if your Gemfile has gem capistrano, '~>3.2.1', it will be updated to 3.3.3 but it is locked on deploy.rb. Even using lock '>=3.2.1' i am still having problem with .capistrano/metrics in version 3.3.3.
I added gem 'capistrano', '~> 3.2.1' to Gemfile. After $ bundle update the problem fixed.
Uninstall version 3.3.3 and install 3.2.1 will solve your problem.
1: sudo gem uninstall capistrano
select the version you want to uninstall(3.3.3 in your case)
bundle exec cap production deploy
You need to use the cap command in the context of your bundle rather than the system.
im having this issue when i try to deploy my ruby on rails application to heroku, i check different posts here, because i saw this issue before but i couldnt fix it.
when i try to run:
$ heroku rake db:migrate
I get a lot of these ones: DEPRECATION WARNING:
and then:
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
I tried to change my Gemfile with 'pg' and my group :assets do to :production, i know im missing something but i could'nt figured out what.
Some ideas?
Also when I go to the app url, I get this:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
Thanks in advance for any suggest and help!!!
You have to use Postgres on Heroku, you can't use sqlite3 because Heroku prohibits you from saving to the file system. So add the pg gem to your production bundle and re-deploy then your migrations should run.
Answer here is simple, add the following production in your gemfile as:
group :production do
gem 'pg'
end
Your local machine won't work with this production, so we now have to bundle it by ignoring PostgreSQL gem which can be done as:
bundle install --without production
After this, try heroku rake db:migrate. Must work.
Good luck
I have been pulling out my hair trying to get this to work. Any experience or info would be very appreciated.
When trying to recompile Rails 3.1 assets locally (before I push to Heroku) I get the error:
rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
Please install the pg adapter: `gem install activerecord-pg-adapter'
(no such file to load --active_record/connection_adapters/pg_adapter)
Then when I go to install the gem I get an error:
Could not find a valid gem 'activerecord-postgresql-adapter' (>= 0) in any repository
Any help greatly appreciated, this is causing me gray hairs.
Looks like this answer may help:
How to handle Ruby on Rails error: "Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'"
It looks like the gem is called "pg", so: gem install pg
You may also want to check your database.yml file, as the first answer in the linked post suggests.
Pranay-Tares-MacBook-Pro:music_library pranaytare$ rake db:migrate
(in /Users/pranaytare/Sites/music_library)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql
(See full trace by running task with --trace)
I got this error while running rake in ROR.. plz help..
I recently installed mysql on my Mac and configured it.
Either install the gem as the error message says, or put the mysql gem in your Gemfile and run bundle install. In the Gemfile, it would be like :
gem 'mysql2'
Deploying a Rails3 app, and am having some issues getting rake to find the gems installed by 'bundle install --deployment':
$ rake db:migrate
(in /home/jrdev/rails/testapp)
rake aborted!
!!! Missing the mysql2 gem. Add it to your Gemfile: gem ‘mysql2’
But, that gem in is the Gemfile, and is also in the vendor/bundle folder…
$ bundle show mysql2
/home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/gems/mysql2-0.2.6
My .gemrc file:
gemhome: /home/jrdev/.gems
gempath:
- /home/jrdev/.gems
- /usr/lib/ruby/gems/1.8
I thought rails3 apps already had the bundler code to detect which gems to use? I know I'm using the right rake, too (rake db:migrate --trace starts in /home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/bin/rake). Same result using bundler's exec.
:(
Wouldn't you freaking know I solve it a minute after asking.
My database.yml file was still calling the 'mysql' adapter instead of 'mysql2'.
Still, what an OBSCURE error message!
In /home/jrdev/rails/testapp, you should find a file called Gemfile. Look into it and just add the line
gem 'mysql2'
somewhere.