nehem
nehem

Reputation: 13642

Redeploy Heroku app without code changes

I would like to deploy a Heroku app which will be done ideally using git push -u heroku master. However this will only work if there are any pending commits to be pushed to master.

How can I redeploy the app while there is nothing to push ? I tried git push -u heroku master -f and still get the same below

Branch master set up to track remote branch master from heroku.
Everything up-to-date

PS: I also want to retain the existing app, which means I cannot make use of this answer https://stackoverflow.com/a/22043184/968442

Upvotes: 169

Views: 83558

Answers (8)

Abhigyan
Abhigyan

Reputation: 385

you can easily redeploy your applicaiton via GUI by

Now go to the bottom most(on deploy page) and find section Manual Deploy and click deploy branch

Upvotes: 0

Hakim Bawa
Hakim Bawa

Reputation: 29

This worked for me, it did an actual build and release without any commit, contrary to one other post that only does a release:

heroku plugins:install heroku-builds
heroku builds:create --source-url https://user:[email protected]/repos/<username>/<repo name>/tarball/master/ --app <app-name>

Source: https://help.heroku.com/I3E6QPQN/how-do-i-force-a-new-deploy-without-adding-a-commit-to-my-github-repo

Upvotes: 1

Umesh
Umesh

Reputation: 1

For stop the heroku app uses :

$ heroku ps:scale web=0

And for start it uses :

$ heroku ps:scale web=1

Upvotes: -5

Henry Ruhs
Henry Ruhs

Reputation: 1630

It turns out there is a neat plugin for Heroku called heroku release retry that lets you retry the last deploy without resorting to adding bad commits to your repository.

// install plugin
heroku plugins:install heroku-releases-retry
// retry release
heroku releases:retry --app {your-app}

Source: https://www.darraghoriordan.com/2019/03/02/heroku-push-failed-force-rebuild

Upvotes: 16

Hardik Raval
Hardik Raval

Reputation: 3641

You can do it from UI as well!

  1. Login to your Heroku dashboard and go to deploy section
  2. Find Manual deploy option

Hit Deploy Branch button!

enter image description here

Note: you must have your app connected to GitHub for this option to be available (see comment from Derek below).

Upvotes: 82

Leandro
Leandro

Reputation: 1522

You can run heroku restart --app app_name and you are good to go.

Upvotes: 5

richard
richard

Reputation: 1585

There is now also a plugin for the Heroku command-line that allows you to re-release the most recently deployed slug.

See https://www.npmjs.com/package/heroku-releases-retry

Upvotes: 15

Chris
Chris

Reputation: 136918

Normally setting a config var causes your application to be restarted. In most situations there should be no need to redeploy after doing this.

If you really do need to trigger a new deployment you can add a new empty commit, then push to Heroku again:

git commit --allow-empty -m "Trigger Heroku deploy after enabling collectstatic"
git push heroku master

The new empty commit is a regular commit. It has a hash, an author, a timestamp, etc. It will have the same tree as its parent. This should cause Heroku to build your app slug again using the same code as the previous commit.

It's a bit awkward, but it works.

Upvotes: 252

Related Questions