Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cloud-function): implement Cloud Function + deploy to stage/prod #8366

Merged
merged 361 commits into from
Apr 19, 2023
Merged

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Mar 7, 2023

Summary

Relates to MP-277 and MP-278.

Problem

We're migrating to GCP.

In AWS, we have been using CloudFront behaviors and Lambdas to route requests to our API and S3 and set cache policies, but GCP has no equivalent services.

Solution

Implement a Cloud Function that routes requests to our API and Cloud Storage, setting Cache-Control headers where applicable.


How did you test this change?

Initially, we deployed the Cloud Function to a new xyz environment at https://developer.allizom.xyz, and now it is also deployed to the stage environment at https://developer.allizom.org/.

gcp/function/src/app.ts Fixed Show fixed Hide fixed
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Mar 8, 2023
@caugner caugner temporarily deployed to xyz March 8, 2023 22:36 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to xyz March 8, 2023 22:40 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to prod April 17, 2023 23:08 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to prod April 17, 2023 23:12 — with GitHub Actions Inactive
This replaces `:` in the URL, for instance.
@caugner caugner temporarily deployed to stage April 18, 2023 08:47 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to stage April 18, 2023 08:51 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to prod April 18, 2023 08:54 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to prod April 18, 2023 08:57 — with GitHub Actions Inactive
proxyTelemetry
);
router.all("/pong/*", requireOrigin(Origin.main), express.json(), proxyKevel);
router.all("/pimg/*", requireOrigin(Origin.main), proxyKevel);

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited.
@caugner caugner temporarily deployed to stage April 18, 2023 14:55 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to stage April 18, 2023 14:55 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to stage April 18, 2023 14:58 — with GitHub Actions Inactive
@caugner caugner temporarily deployed to stage April 18, 2023 15:00 — with GitHub Actions Inactive
newLocation += `?${querystring}`;
}

res.set("Cache-Control", cacheControlValue).redirect(status, newLocation);

Check warning

Code scanning / CodeQL

Server-side URL redirect

Untrusted URL redirection depends on a [user-provided value](1).
@caugner caugner changed the title feat: deploy Cloud Function feat(cloud-function): implement Cloud Function + deploy to stage/prod Apr 19, 2023
Copy link
Contributor

@fiji-flo fiji-flo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great

@caugner caugner merged commit 5631c19 into main Apr 19, 2023
@caugner caugner deleted the gcp branch April 19, 2023 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file gcp-migration github-actions p0 Urgent. We will address this as soon as possible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants