Deploy a simple test app with Sinatra + DataMapper + Postgres + Heroku returns: Installing do_sqlite3 (0.10.7) error
The error when installing do_sqlite
(Installing do_sqlite3 (0.10.7) with native extensions...
) is simply because this gem requires the sqlite3 libraries to be installed, and they are not on Heroku. To fix it, remove dm-sqlite-adapter
(which is what idepends on do_sqlite
) from your Gemfile. If you want to keep Sqlite for development and use Postgres for production, you can use Gembundler's groups:
gem 'dm-postgres-adapter', :group => :productiongem 'dm-sqlite-adapter', :group => :development
This way, the postgresql adapter will be installed in production on Heroku, but sqlite will be used locally for development.
The line in your code that sets up Datamapper is:
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/recall.db")
This looks for a environment variable DATABASE_URL
and if it's present uses it otherwise uses the sqlite url. Getting the LoadError: no such file to load -- dm-sqlite-adapter
error suggests that this variable isn't actually set. Run heroku config
, there should be entries for DATABASE_URL
and SHARED_DATABASE_URL
. If they are not set you need to add the database.
Have a look at this other SO question which deals with a similar issue. The solution there was to run heroku addons:add shared-database:5mb
.