Reputation: 8881
I am having a lot of trouble deploying a simple rails3.1 app. It seems like there are two main problems.
Basically, I want my development-to-deploy workflow to be as seamless as possible. Can anyone recommend the best way to set up my development environment, so that when I $git push heroku, everything just works.
I imagine that it is best to use postgresql in the development environment, Anyone know of a good post on how to set this up?
Should I use unicorn? thin?
Should I be using any other gems that I may not have heard of?
I feel frustrated because I have gotten to the point where I can build pretty cool stuff in the development environment, but have no clue how to get the app online. Maybe I am looking at this all wrong. let me know.
I get this error when I try to do:
group :production do
gem 'pg'
end
Installing pg (0.11.0) with native extensions /home/work/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/home/work/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/work/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
Upvotes: 1
Views: 186
Reputation: 8881
Actually I used the information from both of your answers to get it to work. My asset problem was solved with the bundle exec rake assets:precompile
and my db problem was solved by
group :production do
gem 'pg'
end
and also adding this:
group :development do
gem 'sqlite3'
end
Upvotes: 0
Reputation: 175
Before your commit run the following to precompile your assets:
$> bundle exec rake assets:precompile
You shouldn't need to set up anything for the heroku database other than putting
gem 'pg'
in the production section of your gemfile. It figures it all out all the rest on its own.
Some nice tricks I use quite a bit are:
$> heroku db:push
$> heroku db:pull
Read about push & pull here
I develop locally on mysql since it has the best front end IMHO, but you would be fine using sqlite3 or postgres too, depending on how much you want to be working in raw tables.
Upvotes: 1
Reputation: 2481
I had that problem, but I changed to the cedar stack and that seemed to solve the asset problem. As for the DB, just specify
group :production do
gem 'pg'
end
in the gemfile
Upvotes: 1