Heroku + Github deployment strategies

前端 未结 4 2142
独厮守ぢ
独厮守ぢ 2021-02-13 06:05

I am working on a web app, hosting the source code on Github and running the app on Heroku. Everything works fine, but I have on issue I can\'t wrap my head around. Before the d

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-13 06:44

    You may want to simply consider using the heroku .slugignore file (ref https://devcenter.heroku.com/articles/slug-compiler).

    This file would allow you remove the dev folder from the package that heroku deploys to each server instance, while allowing you to keep all your code in the same repository.

    The root of the problem is thinking about the deployment strategy as one where you upload final bits to your server, where the bits are an artefact of building your repository. In such cases, builds are usually stored and archived separately from the source.

    Heroku's model is slightly different from this in that it assumes your repository is the artefact to deploy. The difference is slight, but in your case, it just means that you need to commit to your repository the bits you want heroku to serve.

    Another way of thinking about it is that you could do without your production folder, and as part of starting your server, the script would be run to generate the production folder files. This would allow you to remove the production folder, and keep your repository clean at the cost of running this process on every start of your server. This may prove to be prohibitively expensive and undesirable (there are limits to how long Heroku will wait for a server to startup before it gives up on it), but hopefully helps in providing some clarity around the Heroku and git relationship.

提交回复
热议问题