title: Rails: Deploying to Heroku, Many Problems
body: <p>Trying to deploy my rails app to Heroku for the first time, I ran into many problems. The app crashed, and you can look at the logs in the image: <a href="https://i.stack.imgur.com/bsx1b.png" rel="nofollow noreferrer">http://i.stack.imgur.com/bsx1b.png</a>
  <br>
  <br>
  Even worse, when I tried to look at my application locally, it failed to work on postgreSQL environment.It worked fine when I went back to use sqLite3 in database.yml. I thought the problem might be that I actually have to install postgreSQL, in addition to adding pg gem and running bundle install.</p>
  
  <p>I went ahead to install  PostgreSQL with the one-click installer (Windows 7 64bit). After reboot, a simple rails server or bundle install commands started failing, so I reinstalled the entire ruby &amp; rails.</p>
  
  <p>Now rails server command works fine, and it prompts a different error when I try to look at my app on local environment. So right now I have pgAdmin III and Rails </p>
  
  <pre><code>PG::Error
  
  fe_sendauth: no password supplied
  </code></pre>
  
  <p>I tried to follow <a href="https://stackoverflow.com/questions/12452073/trying-to-set-up-postgres-for-ror-app-getting-error-fe-sendauth-no-password">this</a>, but I couldn't find "pg_hba.conf." I guess the answer was based on a different OS.</p>
  
  <p>And now again, the bundler is not working, giving me errors...</p>
  
  <p><strong>Questions:</strong>
  1) Was I right to install postgreSQL with the one-click installer? Because this caused my ROR to "crash" somehow, and I had to reinstall rails altogether. 2) I think I am going to delete everything related to postgreSQL, reinstall Rails, and start everything from beginning. What are the steps that I have to take? All the references I've looked at do not seem to fit Windows environment.</p>
  
  <p>In my gemfile, I have</p>
  
  <pre><code>gem 'pg'
  gem 'thin'
  </code></pre>
  
  <p>In my database, I have</p>
  
  <pre><code># SQLite version 3.x
  #   gem install sqlite3
  #
  #   Ensure the SQLite 3 gem is defined in your Gemfile
  #   gem 'sqlite3'
  development:
    adapter: postgresql
    encoding: utf8
    database: mangfeel_development
    pool: 5
    timeout: 5000
  
  # Warning: The database defined as "test" will be erased and
  # re-generated from your development database when you run "rake".
  # Do not set this db to the same as development or production.
  test:
    adapter: postgresql
    encoding: utf8
    database: mangfeel_test
    pool: 5
    timeout: 5000
  
  production:
    adapter: postgresql
    encoding: utf8
    database: mangfeel_production
    pool: 5
    timeout: 5000
  </code></pre>
  
  <p><strong>Errors I'm getting at this moment, after installing PostgreSQL:</strong></p>
  
  <pre><code>c:\ruby\myapp&gt;rails server
  C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in `report_activate_error': Could not find RubyGem railties (&gt;= 0) (Gem::LoadError)
      from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in `activate_dep'
      from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'
      from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'
      from C:/RailsInstaller/Ruby1.9.3/bin/rails:18:in `&lt;main&gt;'
  </code></pre>
  
  <p><strong>When I run bundle install:</strong></p>
  
  <pre><code>Gem::InstallError: The 'json' native gem requires installed build tools
  
  Please update your PATH to include build tools or download the DevKit
  from 'http://rubyinstaller.org/downloads' and follow the instructions
  at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
  An error occurred while installing json (1.7.5), and Bundler cannot continue.
  Make sure that `gem install json -v '1.7.5'` succeeds before bundling.
  </code></pre>
  
  <p><strong>So I will just remove pgAdminIII, PostgreSQL, Ruby on Rails entirely, and start from scratch.</strong></p>
  
  <p>I thought deploying wasn't going to be this hard, but moving from SQLite3 to PostgreSQL is taking more time and effort than I thought it would. I would really appreciate some help on this problem.</p>
  
  <p><strong>------------------------------------------------------------------------------------------------------------------------</strong></p>
  
  <p><strong>UPDATE: AFTER REINSTALLING EVERYTHING, I'M DOING THE SETUP AGAIN FROM SCRATCH.</strong></p>
  
  <p>I checked that my SQLite3 version app worked fine. So I moved onto setting up postgreSQL. I got the following error when I first set up my postgreSQL. By setting up, I mean editing config/database.yml and installing the gem 'pg' and removing the gem 'sqlite3.' When I tried to connect to localhost:3000, I got the following error:</p>
  
  <pre><code>ActiveRecord::ConnectionNotEstablished
  </code></pre>
  
  <p>After some research, I found that there could be more steps to setting the db. So I ran the bundle command, </p>
  
  <pre><code>bundle exec rake db:setup
  </code></pre>
  
  <p>But then in the console, I got the following error when I ran <em>bundle exec rake db:setup</em>.</p>
  
  <pre><code>Couldn't create database for {"adapter"=&gt;"postgresql", "host"=&gt;"localhost", "encoding"=&gt;"utf8", "database"=&gt;"db/myapp_test", "pool"=&gt;5, "timeout"=&gt;5000}
  rake aborted!
  could not connect to server: Connection refused (0x0000274D/10061)
      Is the server running on host "localhost" (::1) and accepting
      TCP/IP connections on port 5432?
  could not connect to server: Connection refused (0x0000274D/10061)
      Is the server running on host "localhost" (127.0.0.1) and accepting
      TCP/IP connections on port 5432?
  c:/ruby/myapp/config/environment.rb:5:in `&lt;top (required)&gt;'
  Tasks: TOP =&gt; db:schema:load =&gt; environment
  </code></pre>
  
  <p>When I tried to connect to localhost:3000, I got the above error again, instead of <em>ActiveRecord::ConnectionNotEstablished</em>.</p>
  
  <p><strong>Question: What did I do wrong, and how do I solve the problem?</strong></p>