如何从 GC 存储中删除过时的 Firebase Cloud 功能容器? [英] How to delete outdated Firebase Cloud function containers from GC Storage?

查看:16
本文介绍了如何从 GC 存储中删除过时的 Firebase Cloud 功能容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近 Firebase 开始对 Cloud Functions 容器存储收费:https://firebase.google.com/pricing

So recently Firebase started charging for Cloud Functions container storage: https://firebase.google.com/pricing

无免费使用 $0.026/GB

No free usage $0.026/GB

我已经多次部署了 2 个函数(不超过 10 次,不记得确切的计数,但这仍然很低,IMO).现在我已经收取了少量费用(现在只有几分之一).因此,如果我再部署这些功能几十次,我将接近一美元,因为旧的(和未使用的)容器不会从存储桶中删除.

I have deployed 2 functions several times (no more than 10 times, can't remember exact count, but this is still pretty low, IMO). Now I am already billed a small amount (fractions of a cent for now). So seems that if I deploy the functions another few dozens of times, I'll get close to a dollar, because old (and unused) containers are not deleted from the storage bucket.

有没有办法安全地删除过时的、未使用的容器以释放一些空间?好吧,看起来花几分钱不值得,但仍然不是免费套餐应该有的样子.

Is there a way to safely delete outdated, not used containers to free some space? Well, it may seem that a few cents are not worth the time, but still, that's not what a free tier should be like.

推荐答案

我发现(目前)这个持续存在的问题的唯一可靠解决方案是定期删除 所有 工件文件(遵循 Doug 的指示).正如其他人所指出的,删除某些文件可能会导致后续部署错误(我遇到过这些).

I found the only robust solution to this ongoing issue (for now) is to periodically remove all of the artifact files (following Doug's instructions). As noted by others, removing some of the files can cause subsequent deploy errors (I experienced these).

重要提示:只删除工件文件,而不是文件夹,因为这也会导致问题.

IMPORTANT: Only delete the artifact files, NOT the folders as this can also cause issues.

您可以正常进行部分或完全部署而不会出现任何问题(似乎工件文件仅在构建/部署过程中被引用).

You can do partial or full deploys as normal without any issues (it seems that the artifact files are only referenced during the build/deploy process).

从长远来看并不理想,但至少将存储使用量降至最低(直到它再次开始累积).

Not ideal by a long shot, but at least reduces the storage usage to the minimum (until it starts accumulating again).

我已经在工件存储桶中尝试了生命周期规则,以尝试自动清除容器,但提供的参数不能保证一次性清除所有内容(您需要).

I have experimented with Lifecycle rules in the artifacts bucket to try and automate the clearing out of the container, but the parameters provided cannot guarantee that ALL will be cleared in one hit (which you need it to).

为方便起见,您可以通过选择添加存储桶"从 Firebase 存储用户界面中查看工件存储桶.选项并从 GCP 导入存储桶.

For convenience, you can see the artifacts bucket from within the Firebase Storage UI by selecting the "Add Bucket" option and importing the buckets from GCP.

这篇关于如何从 GC 存储中删除过时的 Firebase Cloud 功能容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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