Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

New tutorial: Customizable serverless Golang proxy for GCS #1805

Conversation

domZippilli
Copy link
Contributor

@domZippilli domZippilli commented May 12, 2021

This tutorial (and accompanying code) offers a customizable, containerized HTTP proxy for GCS. It shows how to:

  1. Serve secure static content with it, such as within a VPC or only from a certain CIDR block (you cannot do this with vanilla GCS)
  2. Modify the content to be lowercase
  3. Modify the content to be gzip-encoded
  4. Modify the content to be dynamically translated from the Translate API

Moreover, the point is to equip the reader with ways to have a serverless proxy in front of object storage to satisfy lots of use cases they might think of.

@google-cla google-cla bot added the cla: yes label May 12, 2021
@ToddKopriva ToddKopriva self-requested a review May 12, 2021 15:52
@ToddKopriva ToddKopriva self-assigned this May 12, 2021
@ToddKopriva ToddKopriva merged commit 5a7a659 into GoogleCloudPlatform:master Jun 24, 2021
xiangshen-dk pushed a commit to xiangshen-dk/community that referenced this pull request Jan 24, 2022
…udPlatform#1805)

* First draft.

* fix architecture png

* add link to repo at intro

* add .prettierrc for markdown formatting

* remove caching per feedback from a reviewer

* updated image links and front matter

* beginning first-pass line edit, up to demonstration 1

* first-pass line edit through demonstration 1

* first-pass line edit through demonstration 2

* first-pass line edit through demonstration 3

* finished first-pass line edit

* finished proofread

Co-authored-by: Todd Kopriva <43478937+ToddKopriva@users.noreply.github.com>
russStarr pushed a commit to russStarr/community that referenced this pull request Feb 1, 2022
…udPlatform#1805)

* First draft.

* fix architecture png

* add link to repo at intro

* add .prettierrc for markdown formatting

* remove caching per feedback from a reviewer

* updated image links and front matter

* beginning first-pass line edit, up to demonstration 1

* first-pass line edit through demonstration 1

* first-pass line edit through demonstration 2

* first-pass line edit through demonstration 3

* finished first-pass line edit

* finished proofread

Co-authored-by: Todd Kopriva <43478937+ToddKopriva@users.noreply.github.com>
@lukaszkostrzewa
Copy link

Thanks, @domZippilli, for the great tutorial!

I am wondering what are the advantages of using Golang proxy you wrote over using e.g. NGINX with mounted GCS bucket with FUSE? If customization / content transformation is not required, are there any other concerns that should be taken into account? Performance perhaps?

Thanks in advance for your comments on this 😃

@domZippilli domZippilli deleted the domz/cloud-run-golang-gcs-proxy branch August 3, 2022 17:43
@domZippilli
Copy link
Contributor Author

domZippilli commented Aug 3, 2022

Good question. Ostensibly, you could host a custom web server out of GCS using a FUSE with httpd, or any other web server. Caveats in the gcsfuse repo about "beta-quality" (still there today) notwithstanding... I think that would be fine, depending on the requirements, preferences of the engineering team, and most importantly, the results of an integration test.

On the last point, I would want to test such a configuration carefully for performance and cost concerns. I think this is generally true of any integration of multiple software and services, and the more there are, the more there is to test. For example, if you're scaling to zero and need to cold start, will that work well with a more robust proxy and a FUSE? Or more importantly, does the proxy/web server use the filesystem with certain assumptions that don't translate well to object storage? Look at this issue where a more robust HTTP library in Go required rewind seeks. I'm sure the FUSE driver (gcsfuse) supports seek, but will it work exactly the way Nginx wants it to, efficiently, with no/minimal side effects?

I think the advantage of using Nginx or something like that is that it's "battle-tested" and its interactions with web browsers and other clients are very well-understood. So, if the integration tests are thorough and they pass on criteria of not just no errors, but good performance and cost profile... go for it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants