0

My SSD died. I was not pushing the changes to GitHub. Was just testing locally and doing

heroku container:push web
heroku conatiner:release web

After my SSD died I could not find a way to clone back the container. What I have already tried is:

heroku git:clone -a myapp // which showed that i havent pushed anything
// also havent set up the slugs yet

The site is currently running with the latest code/container with no way for me to get back. Help would be greatly appreciated. I learned my lesson of pushing code regularly. Never thought my SSD would die like this.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257

1 Answers1

0

As you have seen, Heroku does provide a way to clone or pull code for Git-based deployments¹. This won't help you with your Docker deployment, though.

I've never done this, but try logging into the Heroku Docker registry directly with Docker:

docker login --username=_ --password=$(heroku auth:token) registry.heroku.com

And then see if you can pull your container:

docker pull registry.heroku.com/<app>/<process-type>

If supported, this should pull your container down from Heroku to your local machine. But this isn't going to give you your source directory back.

If you are working in an interpreted language, you could try running the container and then copying your source code out of it using docker cp. If you're working in a compiled language, unfortunately all you're likely to be able to retrieve is your compiled assets.

I learned my lesson of pushing code regularly

I'm glad to hear this. It can be a painful lesson; hopefully you are able to get back what you need from the container registry.


¹You already know this, but for others in the future: this is not meant to be used regularly:

A Heroku app's Git repository is intended for deployment purposes only. Cloning from this repository is not officially supported as a feature and should be attempted only as a last resort. Do not use this repository as your app's canonical "origin" repository. Instead, use your own Git server or a version control service such as GitHub.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257