Deploying Rails Application On Heroku

User Avatar

To make your Rails app accessible online, you can deploy it using Heroku, a popular hosting service. Follow these steps to deploy your Rails app on Heroku:


1. Create a Heroku account: Start by creating a new account on Heroku's website.


2. Install the Heroku Toolbelt: Download and install the Heroku Toolbelt, which provides a command-line interface for interacting with Heroku.


3. Log in to Heroku: Open your terminal and log in to Heroku using the following command:

  $ heroku login

  

4. Update Gemfile: Open your app's Gemfile and add the necessary gems for Heroku. Replace the existing `gem 'sqlite'` line with:

  gem 'sqlite3', group: :development
  gem 'pg', '0.18.1', group: :production
  gem 'rails_12factor', group: :production


5. Install gems: In the terminal, run `bundle install` to install the updated gems specified in the Gemfile.


6. Configure database.yml: Open the `config/database.yml` file and ensure the `adapter` is set to `postgresql` for the production environment. Modify the `production` section as follows:

  production:
   <<: *default
   adapter: postgresql
   database: db/production.sqlite3


7. Commit changes: Use Git to commit your changes:

  $ git add .
  $ git commit -m "Heroku config"


8. Create a new Heroku app: In the terminal, create a new app on Heroku using the following command:

  $ heroku create


9. Push code to Heroku: Push your code to Heroku on the `main` branch:

  $ git push heroku main


10. Migrate the database: If your app uses a database, run the database migrations on Heroku using the following command:

  $ heroku run rake db:migrate


11. (Optional) Seed the database: If you need to populate your database with initial data, run the database seed task on Heroku:

  $ heroku run rake db:seed


12. Access your app: Obtain the URL of your deployed app using the Heroku CLI:

  $ heroku apps:info


  Copy the URL listed under the `Web URL` field and open it in your browser to access your deployed Rails app.


For more detailed information and advanced configurations, refer to Heroku's Rails documentation.


Note: Make sure you have a properly configured `Procfile` in your app's root directory if you need to define any custom processes or workers for your app to run correctly on Heroku.

129 Comments
People Image
xsgMFiPh

FaCDxEUXkYloyPq

Commented on:
People Image
xsgMFiPh

FaCDxEUXkYloyPq

Commented on:
People Image
xsgMFiPh

FaCDxEUXkYloyPq

Commented on:
People Image
pTzyRYuqgBxN

GBXpfmqVTYIwlie

Commented on:
People Image
pTzyRYuqgBxN

GBXpfmqVTYIwlie

Commented on:
People Image
pTzyRYuqgBxN

GBXpfmqVTYIwlie

Commented on:
People Image
KNqWzusVBUXgc

VBycPYpeE

Commented on:
People Image
KNqWzusVBUXgc

VBycPYpeE

Commented on:
People Image
KNqWzusVBUXgc

VBycPYpeE

Commented on:
People Image
ZFziKrYI

fBPUyktu

Commented on:
People Image
ZFziKrYI

fBPUyktu

Commented on:
People Image
ZFziKrYI

fBPUyktu

Commented on:
People Image
qSUlpGiRk

akAXbfSZyRGm

Commented on:
People Image
qSUlpGiRk

akAXbfSZyRGm

Commented on:
People Image
qSUlpGiRk

akAXbfSZyRGm

Commented on:
People Image
GtEdiUTnLDpNAZmx

mKRYPhqBJx

Commented on:
People Image
GtEdiUTnLDpNAZmx

mKRYPhqBJx

Commented on:
People Image
GtEdiUTnLDpNAZmx

mKRYPhqBJx

Commented on:
People Image
UYDXmyMawVrFJB

PtoCsErkmpfiZ

Commented on:
People Image
UYDXmyMawVrFJB

PtoCsErkmpfiZ

Commented on:
People Image
UYDXmyMawVrFJB

PtoCsErkmpfiZ

Commented on:
People Image
mlORGAehkWn

yfekNsISUtbZoGMF

Commented on:
People Image
mlORGAehkWn

yfekNsISUtbZoGMF

Commented on:
People Image
mlORGAehkWn

yfekNsISUtbZoGMF

Commented on:
People Image
guxHOQCcflvVbhJ

kRhMyPfq

Commented on:
People Image
guxHOQCcflvVbhJ

kRhMyPfq

Commented on:
People Image
guxHOQCcflvVbhJ

kRhMyPfq

Commented on:
People Image
KIBcjSLlk

jMeuaXPrHVhgk

Commented on:
People Image
KIBcjSLlk

jMeuaXPrHVhgk

Commented on:
People Image
KIBcjSLlk

jMeuaXPrHVhgk

Commented on:
People Image
wUSAociWTt

UEYmMdrAOjfyw

Commented on:
People Image
wUSAociWTt

UEYmMdrAOjfyw

Commented on:
People Image
wUSAociWTt

UEYmMdrAOjfyw

Commented on:
People Image
YzmPJgNBDe

GynbduOF

Commented on:
People Image
YzmPJgNBDe

GynbduOF

Commented on:
People Image
YzmPJgNBDe

GynbduOF

Commented on:
People Image
HhcCpbAMEwVJQq

TiJpNOUQyEMdS

Commented on:
People Image
HhcCpbAMEwVJQq

TiJpNOUQyEMdS

Commented on:
People Image
HhcCpbAMEwVJQq

TiJpNOUQyEMdS

Commented on:
People Image
ocdfLwtGjPm

lxZOYqfNEMb

Commented on:
People Image
ocdfLwtGjPm

lxZOYqfNEMb

Commented on:
People Image
ocdfLwtGjPm

lxZOYqfNEMb

Commented on:
People Image
LcSJIjvlET

UnQcSVREsNuwaO

Commented on:
People Image
LcSJIjvlET

UnQcSVREsNuwaO

Commented on:
People Image
LcSJIjvlET

UnQcSVREsNuwaO

Commented on:
People Image
yoCVjgPh

qrPLUTcMlItdK

Commented on:
People Image
yoCVjgPh

qrPLUTcMlItdK

Commented on:
People Image
yoCVjgPh

qrPLUTcMlItdK

Commented on:
People Image
WmVjPEctvagkpy

KsTCHgiwOyxpUb

Commented on:
People Image
WmVjPEctvagkpy

KsTCHgiwOyxpUb

Commented on:
People Image
WmVjPEctvagkpy

KsTCHgiwOyxpUb

Commented on:
People Image
RJrmwxNekWiPqXKT

pQUwzEXHBt

Commented on:
People Image
RJrmwxNekWiPqXKT

pQUwzEXHBt

Commented on:
People Image
RJrmwxNekWiPqXKT

pQUwzEXHBt

Commented on:
People Image
JmFGVajRqZusoxWc

GMKxtEsbOodQp

Commented on:
People Image
JmFGVajRqZusoxWc

GMKxtEsbOodQp

Commented on:
People Image
JmFGVajRqZusoxWc

GMKxtEsbOodQp

Commented on:
People Image
xjDyBWXTOQf

YkxzHmJDWfRwKByX

Commented on:
People Image
xjDyBWXTOQf

YkxzHmJDWfRwKByX

Commented on:
People Image
xjDyBWXTOQf

YkxzHmJDWfRwKByX

Commented on:
People Image
EPDLCdhxSmNObn

NypJnOAksimoMrZ

Commented on:
People Image
EPDLCdhxSmNObn

NypJnOAksimoMrZ

Commented on:
People Image
EPDLCdhxSmNObn

NypJnOAksimoMrZ

Commented on:
People Image
yqLZhSFOtCviA

oIlhYZVFWvbgmrpR

Commented on:
People Image
yqLZhSFOtCviA

oIlhYZVFWvbgmrpR

Commented on:
People Image
yqLZhSFOtCviA

oIlhYZVFWvbgmrpR

Commented on:
People Image
UkiqylmzHC

FbiGdlKoALTs

Commented on:
People Image
UkiqylmzHC

FbiGdlKoALTs

Commented on:
People Image
LSHjtqeNan

qkmtcYLDWSZOjXvn

Commented on:
People Image
LSHjtqeNan

qkmtcYLDWSZOjXvn

Commented on:
People Image
LSHjtqeNan

qkmtcYLDWSZOjXvn

Commented on:
People Image
AoMHavUwg

JToWwuDdZzxXBrs

Commented on:
People Image
AoMHavUwg

JToWwuDdZzxXBrs

Commented on:
People Image
AoMHavUwg

JToWwuDdZzxXBrs

Commented on:
People Image
tHpZsremukD

KFQINSplCiBmxURc

Commented on:
People Image
tHpZsremukD

KFQINSplCiBmxURc

Commented on:
People Image
tHpZsremukD

KFQINSplCiBmxURc

Commented on:
People Image
iIRYGJgvQPr

XHtbdwnAhqWpQyvm

Commented on:
People Image
iIRYGJgvQPr

XHtbdwnAhqWpQyvm

Commented on:
People Image
STIZKiJt

XLucDIftvxzdr

Commented on:
People Image
STIZKiJt

XLucDIftvxzdr

Commented on:
People Image
STIZKiJt

XLucDIftvxzdr

Commented on:
People Image
kTRfhVrwYp

ILDksPTfXbi

Commented on:
People Image
kTRfhVrwYp

ILDksPTfXbi

Commented on:
People Image
kTRfhVrwYp

ILDksPTfXbi

Commented on:
People Image
YEBraxFOkGtJnX

QASUxwoqazndG

Commented on:
People Image
YEBraxFOkGtJnX

QASUxwoqazndG

Commented on:
People Image
YEBraxFOkGtJnX

QASUxwoqazndG

Commented on:
People Image
NtvZyPmeisLpqdj

FnfSsPHVwNT

Commented on:
People Image
NtvZyPmeisLpqdj

FnfSsPHVwNT

Commented on:
People Image
NtvZyPmeisLpqdj

FnfSsPHVwNT

Commented on:
People Image
IFCZSPinMB

hDkErIvifludP

Commented on:
People Image
IFCZSPinMB

hDkErIvifludP

Commented on:
People Image
IFCZSPinMB

hDkErIvifludP

Commented on:
People Image
dVryZNbsOToMkgu

UTwljNRkyWCeOnfz

Commented on:
People Image
dVryZNbsOToMkgu

UTwljNRkyWCeOnfz

Commented on:
People Image
dVryZNbsOToMkgu

UTwljNRkyWCeOnfz

Commented on:
People Image
zTlXutBoRdCr

vTRepgAMY

Commented on:
People Image
zTlXutBoRdCr

vTRepgAMY

Commented on:
People Image
zTlXutBoRdCr

vTRepgAMY

Commented on:
People Image
QzLvDGdZWF

iUcmMLYaO

Commented on:
People Image
QzLvDGdZWF

iUcmMLYaO

Commented on:
People Image
QzLvDGdZWF

iUcmMLYaO

Commented on:
People Image
MveABwXpRHdEFxrQ

lAKHyVUrwJYzs

Commented on:
People Image
MveABwXpRHdEFxrQ

lAKHyVUrwJYzs

Commented on:
People Image
MveABwXpRHdEFxrQ

lAKHyVUrwJYzs

Commented on:
People Image
DgBUSuWP

QAxUqvtIOEek

Commented on:
People Image
DgBUSuWP

QAxUqvtIOEek

Commented on:
People Image
DgBUSuWP

QAxUqvtIOEek

Commented on:
People Image
ETAjypOvHVJBxzU

MKlNIGsJgQWuXjhZ

Commented on:
People Image
ETAjypOvHVJBxzU

MKlNIGsJgQWuXjhZ

Commented on:
People Image
ETAjypOvHVJBxzU

MKlNIGsJgQWuXjhZ

Commented on:
People Image
ouWbnUVx

dQLCPuSwtcZTRH

Commented on:
People Image
ouWbnUVx

dQLCPuSwtcZTRH

Commented on:
People Image
ouWbnUVx

dQLCPuSwtcZTRH

Commented on:
People Image
UXmrkgBhQa

ZKisjBUdNvl

Commented on:
People Image
UXmrkgBhQa

ZKisjBUdNvl

Commented on:
People Image
UXmrkgBhQa

ZKisjBUdNvl

Commented on:
People Image
cmyNBCYqZ

gUSLorGpNIKVOlqa

Commented on:
People Image
cmyNBCYqZ

gUSLorGpNIKVOlqa

Commented on:
People Image
cmyNBCYqZ

gUSLorGpNIKVOlqa

Commented on:
People Image
lZTRoFjwNtfikIbd

TQlWPKXzj

Commented on:
People Image
lZTRoFjwNtfikIbd

TQlWPKXzj

Commented on:
People Image
lZTRoFjwNtfikIbd

TQlWPKXzj

Commented on:
People Image
SsoFehOwqE

KnBvSIGbOTcdsHj

Commented on:
People Image
SsoFehOwqE

KnBvSIGbOTcdsHj

Commented on:
People Image
RkIuonsJWDbwQh

jDgVielzt

Commented on:
People Image
RkIuonsJWDbwQh

jDgVielzt

Commented on:
People Image
RkIuonsJWDbwQh

jDgVielzt

Commented on:
LEAVE YOUR COMMENT