Congrats on finishing your Rails Application! You’re ready to deploy!
Heroku is a great service that enables anyone to deploy his or her app. You can download and install heroku here; or using Homebrew you can type into your terminal:
$ brew tap heroku/brew && brew install heroku
You must create an account, and you can do so here. Login through the command line using:
$ heroku loginheroku: Press any key to open up the browser to login or q to exit:
Press any key to be redirected to login page; once logged in, you will have access to Heroku Command Line.
cd into your app’s directory and find your Gemfile. Find your SQLite3 gem:
and change to Postgres:
bundle install from your command line. PostgreSQL is a much more advanced database and works better with heroku. You can find instructions to install Postgres here. Ensure that Postgres is running, and change your config/database.yml from this:
If you are having trouble converting your database from SQLite to Postgres, check out this awesome post.
$ rake db:create followed by
$ rake db:migrate and
$ rake db:seed (if you have a seed file) to set up your Postgres database. If it worked, you’ll see your database running in Postgres:
If your app is connected to Github or stored in git, you’re ready to deploy! If not, run the following in your terminal:
$ git init
$ git add .
$ git commit -m "init"
If you run
$ git status and receive
On branch master as a response, you’re ready to go!
nothing to commit, working tree clean
$ heroku create
$ git push heroku master
$ heroku run rake db:migrate to use your application’s database.
And boom! You’ve done it!
These last two steps may take some time.
To open your newly-created app, run
$ heroku open .