Skip to content
代码片段 群组 项目
未验证 提交 191f65c2 编辑于 作者: Stan Hu's avatar Stan Hu
浏览文件

Add support for Google CDN

This commit adds base support for using Google CDN in front of an
object storage bucket to save costs. Note that this commit does not
actually enable the use of the CDN yet; additional configuration and
changes to the callers must be made for this to work.

To enable a bucket to use the Google CDN:

1. A CarrierWave uploader should `include ObjectStorage::CDN::Concern`.
2. Instead of calling `#url`, a caller can now call `#use_cdn?` and
   `#cdn_signed_url`.

At the moment, transfers within the Google Cloud Platform (GCP)
network between Google Cloud Storage and virutal machines are free, so
serving out artifacts to GCP machines would waste money in the form of
egress traffic.

To avoid that, `#use_cdn?` will fetch the list of valid, public Google
IP ranges and exclude IPs that are private or within the public Google
network.

`#cdn_signed_url` will create a pre-signed URL valid for 10 minutes by
default. The Google CDN must be set up so that a Google Cloud
Storage bucket is behind a unique URL.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/360462

Changelog: added
上级 3226c333
No related branches found
No related tags found
无相关合并请求
加载中
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册