I'm trying to push my local Postgres db to my Heroku app, and following Heroku guide, I did heroku db:push but I get the following error:
leonsas#leonsas-VirtualBox:~$ heroku db:push
! Taps Load Error: cannot load such file -- sqlite3
! You may need to install or update the taps gem to use db commands.
! On most systems this will be:
!
! sudo gem install taps
I already tried sudo gem install taps, sudo gem install sqlite3, but I cant make it work. Any ideas why it's trying to load an sqlite3 db when I'm using postgres?
Taps is no longer the recommended tool to use when migrating data between postgres instances. Please give heroku-pg-transfer a try instead.
This will only work if you're using one of the production databases or the new Heroku postgres dev plan. If you're still on the older shared database plan I would suggest switching to the new dev plan.
First, find the URL to your db on Heroku:
$ heroku config:get DATABASE_URL
postgres://yada:yada#ec2-107-21-122-141.compute-1.amazonaws.com:5432/123
Then transfer from your local db to the heroku db:
$ heroku plugins:install https://github.com/ddollar/heroku-pg-transfer
$ heroku pg:transfer -f postgres://localhost/dbname -t postgres://yada:yada#ec2.../123
Since the heroku-pg-transfer tool utilizes postgres's native pg_dump facility it is a much more predictable and resilient tool.
Related
I wanted to create/change/command directly to the heroku app through heroku CLI, ps:exec command.
For example, I actually tried to update an spree(ecommerce framework written Rails) app I created using Heroku button. After I created the app with Heroku button, I found I need an extension,
spree_digital to create digital product. So I tried following steps:
heroku ps:exec -a spreeapp
$ # install nano editor here
$ nano Gemfile # added a line: gem 'spree_digital', github: 'spree-contrib/spree_digital'
$ bundle install
$ bundle exec rails g spree_digital:install # and no error.
$ exit
heroku ps:restart # the git repo says server restart is required so
heroku ps:exec -a spreeapp # and test if that the Gemfile is same as the line added one
$ cat Gemfile # and I found that the file I changed didn't change..
I'm new to Heroku, your each comment must be fuge help for me. Thanks.
I want to restore the backup from staging to demo
I followed the documentation on heroku and combed through SO but no luck so far.
I am using Windows 7 and versions are:
heroku/toolbelt/2.33.2 (i386-mingw32) ruby/1.9.2
Ruby: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
Rails: 3.2.7
Steps:
$heroku pgbackups:capture
HEROKU_POSTGRESQL_ONYX_URL (DATABASE_URL) ----backup---> b004
β[0KCapturing... donet |
β[0KStoring... done
$heroku pgbackups:url
"https://s3.amazonaws.com/hkpgbackups........."
I know the command above is not required but I did it anyway just to make sure that a url is generated for backup db.
and the command for restore:
$heroku pgbackups:restore --remote demo DATABASE 'heroku pgbackups:url'
**! Backup not found**
Just to be sure, I tried the following other formats of the command:
heroku pgbackups:restore --remote demo DATABASE 'heroku pgbackups:url --remote staging'
heroku pgbackups:restore --app demoapp DATABASE 'heroku pgbackups:url --app stagingapp'
They both are resulting in Backup not found error
I also tried with the name of the db on demo:
$heroku pgbackups:restore HEROKU_POSTGRESQL_ROSE 'heroku pgbackups:url --remote staging' --remote demo
! Backup not found
Please help!
Use backquotes instead of single quotes.
` heroku pgbackups:url -a source-app `
Log into your heroku control panel and make sure the version of PGbackup you have isn't depreciated
I can find my apps in heroku apps command, and also do some command to read information from app like heroku addons --app appname.
But I couldn't find my apps in some command like heroku addons:add addon_name, heroku pg:reset.
Work commands
heroku apps:
=== My Apps
my_app_1
my_app_2
(Also I can see my apps in heroku web dashboard.)
heroku addons --app my_app_1(not in my_app_1 folder):
=== my_app_1 Configured Add-ons
shared-database:5mb
heroku addons(in my_app_1 folder):
=== my_app_1 Configured Add-ons
shared-database:5mb
Doesn't work commands
heroku addons:add sendgrid(in my_app_1 folder):
! No app specified.
! Run this command from an app folder or specify which app to use with --app
heroku pg:reset DATABASE --confirm my_app_1(in my_app_1 folder):
Resetting SHARED_DATABASE (DATABASE_URL)... failed
! Resource not found
Here is my environment.
Max OS X Lion (10.7.4)
rvm 1.13.8 (stable)
ruby 1.9.3p194
heroku 2.26.5
Adding the heroku's remote configuration to git did the trick for me. Validate if you have it configured with git remote -v on the terminal and you should get something like:
heroku git#heroku.com:your-app.git (fetch)
heroku git#heroku.com:your-app.git (push)
if you don't, add it with
git remote add heroku git#heroku.com:your-app.git
It looks like the latest version fo the Heroku gem (2.26.5) is broken. A workaround is to downgrade to 2.26.3.
gem uninstall heroku -v 2.26.5
gem install heroku -v 2.26.3
It looks like you have a conflict between the Heroku gem, and the Heroku Toolbelt. I'm guessing you have installed the Heroku Toolbelt, but still have the Heroku gem in your gem file.
Remove the Heroku gem from your Gemfile and save.
Run the bundle command to update your Gemfile.lock
In Terminal, run gem uninstall heroku (NOTE: there may be multiple versions of the Heroku gem installed, and you'll need to uninstall all of them.)
In Terminal, run heroku addons
If you get heroku: command not found then you don't have the Heroku Toolbelt installed.
Install the Heroku Toolbelt and run the command again.
NOTE: If you're not in the app's directory, you'll need to add --app myapp1 to the Heroku commands.
Hope this helps.
I have a Ruby 1.8.7 application that works correctly locally. To load it on Heroku, I changed the database from SQLite to PostgreSQL, install PostgreSQL 9.1.3, I changed the Gemfile replacing gem sqlite3 with:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
And changing the part production of config/database.yml with:
production:
adapter: postgresql
database: project_production
pool: 5
timeout: 5000
Then I run bundle install --without production successfully. Next I created a git repository with:
git init
git add *
git commit -m "text"
Later I create a heroku application with heroku create --stack bamboo-ree-1.8.7 , git push heroku master and heroku rake db:migrate successfully.
But it didn't work!
What's missing? I've done something wrong or I have not made ββany statement?
Is "git add *" working ? I think you'd better use :
$ git add .
As Larsenal asked, could you post your logs ?
$ heroku logs
The basic information about heroku deployment is here.
You don't need the "production" block in database.yml, this is automatically generated by heroku when deploying.
Kind regards,
Max
What causes this?
It occurred when I try to run heroku logs
You need to update the heroku gem (gem update heroku).
If gem update heroku does not work for you, try heroku update.