Use Heroku cloud service on Ubuntu to publish Rails Applications with databases

Source: Internet
Author: User
The program initially uses the sqlite3 database. Modify the Gemfile file to add the Support group: productiondo # gemsspecificallyforHerokugoheregem "pg" endbundleinstall to the heroku deployment to pre-compile some files. Otherwise, the bundleexecrakeassets will error on heroku:

The program initially uses the sqlite3 database.

Modify the Gemfile file, and add pg support to heroku deployment
Group: production do
# Gems specifically for Heroku go here
Gem "pg"
End

Bundle install

Pre-compile some files; otherwise, an error occurs on heroku.

Bundle exec rake assets: precompile

Publish the application to Github.

$ Git add.
$ Git commit-a-m "Done with the demo app"
Done with the demo app, add heroku pg database support
$ Git push

Publish the application to the heroku Server
$ Heroku create
$ Git push heroku master
$ Heroku rake db: migrate

$ Heroku rename BerryreloadDemoApp

Now I can test my database application on heroku ECS.

Refer:

Use Heroku cloud service on Ubuntu to publish a Rails Application

If you execute the command

$ Bundle exec rake assets: precompile

The following error is reported:
Rake aborted!
Undefined method 'prerequisites 'for nil: NilClass
(See full trace by running task with -- trace)

Execute the command again

$ Bundle exec rake assets: precompile -- trace

The following error is reported:

Rake aborted!
Undefined method 'prerequisites 'for nil: NilClass
/Usr/local/ruby/lib/ruby/gems/1.9.1/gems/rspec-rails-2.0.1/lib/rspec/rails/tasks/rspec. rake: 3: in' '

The conclusion is that rspec-rails-2.0.1 and rake, Rails 3.1.3 are incompatible and need to be upgraded

Upgrade Method:

Modify the Gemfile of the project and remove the rspec-rails version. If you set the rspec-Rails version based on the Tutorial Ruby on rails 3 Tutorial.

Group: development do
Gem 'rspec-rails'
End

Group: test do
Gem 'rspec'
Gem 'webrat'
End


Finally, execute the command

$ Bundle update rspec-rails

The result shows the upgrade to rspec-rails 2.8.1.

The command is successfully executed again.

$ Bundle exec rake assets: precompile

Then,

$ Git add.

$ Git commit-am "Done with static pages and precompile for heroku"

$ Git push

$ Git push heroku

$ Heroku rake db: migrate

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.