Search code examples
postgresqlherokuunicornpg

how can i change heroku databse / hosting


I would like to change my heroku database to something that allows for concurrent connections as my site is getting some traffic and seems to crash when multiple users are attempting to access the site. i have looked into changing my DB to unicorn but not sure if this is what I really need. I am a beginner and any insight into what I need to do would be extremely useful!

my gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'bootstrap-sass'

group :production do 
    gem 'pg'
    gem 'rails_12factor'    
end

group :development, :test do
    gem 'sqlite3'
end

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

Solution

  • Setting up puma is very straight forward. Follow this step by step: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server

    That said, I would dig deeper. Changing to puma is worth doing regardless but it may not be the root of your problem. App could be crashing for a number of reasons.

    Here are the puma docs as well, just in case: https://github.com/puma/puma