1

I have a Node.js app that is live on Heroku

The Node.js folders/files that I uploaded on Heroku also reside on my computer

Whenever I update my Node.js folders/files on my computer, I want these updates to also be applied to the folders/files that are live on Heroku.

I want to be able to do that without having to stop, update and restart my Heroku app every time.

What I'm describing is basically a setup equivalent to that of the standard ftp connection that we all use whenever we make a local to remote update of static files of some standard website.

The git support that apparently Heroku offers doesn't do that. It requires for the app to be stopped (by running the appropriate commands on the terminal), then I need to make a git push (using the terminal) that updates all of the files (which takes forever) and not just the ones that need to be updated, and then the app needs to be restarted (again using the terminal). This is extremely frustrating for an app that is still in development, requires constant updates and cannot be tested locally (for a number of reasons).

Whenever a Node.js app is tested locally, the app can be started by calling supervisor app.js instead of node app.js.

What this does is it allows for the app to be updated and as soon as that happens (i.e. as soon as I hit "save") supervisor automatically restarts the app locally.

I'm looking for something similar to the above, i.e. linking my local app folder to my remote app folder and starting my remote app (on Heroku) using some supervisor mode so that as soon as my local folder is updated, my remote folder is also changed and the app automatically restarted.

It's extremely frustrating trying to test a Heroku app (that obviously needs constant updates) currently.

Testing it locally and then publishing it on Heroku (for good) will not do because some apps simply cannot be tested on localhost.

Any help would be much appreciated!

Kawd
  • 4,122
  • 10
  • 37
  • 68

1 Answers1

1

The git support that apparently Heroku offers doesn't do that. It requires for the app to be stopped (by running the appropriate commands on the terminal), then I need to make a git push (using the terminal) that updates all of the files (which takes forever) and not just the ones that need to be updated, and then the app needs to be restarted (again using the terminal). This is extremely frustrating for an app that is still in development, requires constant updates and cannot be tested locally (for a number of reasons).

First, you don't need to stop your app before running git push heroku master. Just push, and the platform will build, and then restart your app with the new code, automatically. Second, git uses a diffing algorithm, so you aren't pushing all of the files - you're in fact just pushing the differences (assuming you're using git correctly). Third, you don't need to do that final, manual restart - the platform has already done this for you on push. Finally, I would advise that if your app is impossible to test locally, you might want to reconsider the architecture of that app. It sounds very un-portable. Perhaps refer to 12factor.net for a good architecture checklist.

Testing it locally and then publishing it on Heroku (for good) will not do because some apps simply cannot be tested on localhost.

What type of app are you building that would be impossible to test outside of a production environment?

In any case, the closest thing I'm aware of to what you're looking for is Dropbox Sync:

hunterloftis
  • 13,386
  • 5
  • 48
  • 50
  • Thank you for your reply @hunterloftis. I will look into dropbox sync. If proper use of git takes care of the issues I'm having why are these people looking for similar solutions : http://stackoverflow.com/questions/9131496/can-i-tell-foreman-to-reload-the-web-app-every-time-a-request-is-made-so-i-can-d and http://stackoverflow.com/questions/13727961/how-do-i-have-foreman-reload-node-js-when-a-file-is-changed unless I misunderstood their posts. I'm building a Shopify App. Shopify doesn't allow communications with localhost unfortunately. – Kawd Aug 24 '15 at 16:01
  • 1
    Neither of those questions has anything to do with restarting heroku; it's just about restarting when you develop locally (like, with `nodemon` in node). It's very easy for you to test for yourself - just push an app, make a change, then push it again, and then run` heroku open`. The app will have updated without you stopping / restarting it. – hunterloftis Aug 24 '15 at 16:25