I have been trying to deploy my local app in production
my Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'pry', '0.9.12'
gem 'mysql', '2.9.1'
gem 'rails-api', '0.1.0'
gem 'rails', '4.0.1'
gem 'awesome_print', '1.1.0'
group :test, :development do
gem 'raddocs', '0.2.0'
gem 'rspec-rails', '2.13.0'
gem 'rspec-core', '2.13.1'
gem 'rspec_api_documentation', '1.0.0'
end
group :development do
gem 'railroady', '1.1.1'
end
group :test do
gem 'database_cleaner'
gem 'capybara', '2.1.0'
gem 'shoulda-matchers', '1.5.6'
gem 'factory_girl_rails', '4.0'
gem "factory_girl", "4.0"
end
I have the next route in my routes file:
post '/region/:id/service' => 'region#service'
and my controller looks like this:
class RegionController < ApplicationController
def service
region = Region.find params[:id]
render text: region.name
end
end
Ok the problem is that, when I call the service with curl
in development works perfectly:
$ curl -X POST localhost:port/region/6/service -d ""
but when I upload the files to heroku, and I call the service again I'm getting 404 not found (error) or 500 internal server (error)
I'm using cleardb
addon according to the documentation.
I think the problem is the DATABASE. At first I wrote my database.yml for production enviroment the database info according to the following:
$ heroku config | grep CLEARDB_DATABASE_URL
but I think is not neccesary because heroku can do it automatically according to this line... I think so
-----> Writing config/database.yml to read from DATABASE_URL
I tried in the both ways without results and I really don't know why the service is crashing when I try to do a query in production.
my database.yml looks like
development:
adapter: mysql
password: xxx
database: myapp.development
pool: 5
timeout: 5000
test:
adapter: mysql
password: xxx
database: myapp.test_1
pool: 5
timeout: 5000
production:
adapter: mysql
encoding: utf8
database: xxx
username: yyy
password: zzz
pool: 5
timeout: 5000
host: us-cdbr-east-04.cleardb.com