开发者

Why is Git overwriting files on server after deploying?

I have a node.js app on heroku and it saves images in the public/productimages folder. But every time I push my new code, all the previous images are deleted. I have added productimages in the .gitignore fi开发者_Python百科le but no use. public/productimages in my local computer is empty though.


You are not allowed to use the filesystem for permanent storage on Heroku.

The reason is that every time Heroku starts up your application, it starts it up in an entirely new temporary directory. Every time Heroku shuts down your application, it deletes that temporary directory that your application was previously running in. Heroku does this on a nightly basis, every time you git push, every time you change config variables, every time you change addons, every time you increase or decrease the number of dynos, etc.

You must use an external service, such as the PostgreSQL database or S3, for storing anything you might want to store.


Basic premise of Cloud computing: Storage is not persistent, unless explicitly made so.

Not used Heroku, but I believe your files would not be retained if they are not versioned and obtainable from your repo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜