Useful Command For Heroku

Total Blog Views: 47

Blog Status: publish

Created By: rushabh_subodh Created at: 08-06-2021

Tags: ruby on rails heroku heroku-cli

Heroku Does Provide A Free web hosting Platform for any webapplication, Here is the below Some Usefull Commands for Deploying And Accessing The Heroku Server.

  • Create A new Application In heroku, Open the terminal

$ heroku login -i

Please enter User Name and password, Go Into Project Directory

$ git init #Create a New repo

$ heroku create #Command to create a New application

$ git add .

$ git commit -m "First Commit"

$ git push heroku master #To deploy the local changes into Live, After Successfull Deploy A url will be genrated so we can use it.

  • Run DB Migrate command In heroku

$ heroku run rake db:migrate

  • Take a Chnages pull In current Repo

$ git pull heroku master

  • Goto Live rails console or rails c

$ heroku run rails c

  • Download and capture DB form Heroku

$ heroku pg:backups capture
$ curl -o latest.dump `heroku pg:backups public-url`

  • Restore DB in heroku,Dump your local database in compressed format using the open source pg_dump tool:

$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump

  • Generate a signed URL using the aws console:,aws s3 presign s3://your-bucket-address/your-object Use the raw file URL in the pg:backups restore command:

$ heroku pg:backups:restore '<SIGNED URL>' DATABASE_URL

  • Restart The Heroku Application

$ heroku dyno:restart

Please provide some suggestion or ask any question


rushabh_subodh

I am rushabh_subodh blogger on shadbox. I am influencer,content writer,author and publisher. Feel free to ask me any question and suggestions.



Comments



  • swazahmad | almost 4 years ago
    Awesome Information Thanks For Sharing
Buy traffic for your website

About Shadbox

we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.

Services

Downloads