在git推Herku后 - 上传的Heroku文件丢失了 [英] After git push heroku - uploaded files on Heroku are lost

查看:97
本文介绍了在git推Herku后 - 上传的Heroku文件丢失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



该应用程序已部署到Heroku中,使用

  $ git add。 
$ git commit -mdescription
$ git checkout master
$ git merge my-cool-new-feature
$ git push heroku

问题在于,每当我将更改推送到Heroku时,上传到Heroku的所有文件都将丢失。我想,问题在于文件夹/文件受版本控制,所以我将文件夹添加到.gitignore中。

 #Ignore用户生成的文件
/ public / system / *

并从存储库中删除文件。

  $ git rm -rf --cached public / system 

但问题依然存在。你能指点我的方向吗?

解决方案

原因是因为Heroku限制了你可以在其上存储数据的方式服务器。回到 bamboo 堆栈天,存储任何数据是根本不可能的而不使用外部服务。由于他们引入了 Cedar 堆栈,所以事情已经改变了



正如您发现的那样,每当您对Heroku应用程序推送新的更改(或每次应用程序关闭并在x分钟内处于非活动状态后重新启动),您的应用程序将被重新创建,并且所有存储的数据都将丢失。



最好的办法是不要使用/ public目录,并开始使用外部服务,如 Amazon S3 Rackspace云文件 Spideroack


My fairly basic application allows users to upload avatars.

The application is deployed to Heroku with

$ git add .
$ git commit -m "description"
$ git checkout master
$ git merge my-cool-new-feature
$ git push heroku

The problem is, every time I push changes to Heroku, all files uploaded to Heroku are lost. I thought, the problem was that the folder/files were under version control, so I added the folder to .gitignore

# Ignore User generated files
/public/system/*

and removed the files from the repository.

$ git rm -rf --cached public/system

But the problem persists. Can you point me in the right direction?

解决方案

The reason for this is because Heroku limits the way you can store data on their servers. Back in the bamboo stack days, storing any data was simply impossible without the use of an external service. Since they introduced the Cedar stack, things have changed a little bit, but storing persistent data is still not possible.

As you've discovered, each time you push a new change to your Heroku application (or each time the application shuts down and restarts after being inactive for x minutes), your application is recreated and all stored data is lost.

Your best bet is to not use the /public directory at all, and start using an external service like Amazon S3, Rackspace Cloud Files or Spideroack

这篇关于在git推Herku后 - 上传的Heroku文件丢失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆