Reputation: 25
I've current got a NextJS app connected that I would like to migrate over to Google Cloud Run.
Right now, the sight is majority static generated pages--in the build process next
does static generation and discovery for most of the pages. These pages often don't update for weeks at a time.
While hosting it on Vercel, I was able to setup the app to rebuild and deploy whenever a webhook was triggered. This allowed the site to rebuild and generate all the static pages if a copy change was made, without needing to push something to Github or push a button.
We're looking to move a lot of our work over to GCP soon, and I'm looking to see how I can replicate this functionality. Currently, the only trigger I can set within GCP Console seems to be a push/commit event for the attached repo--nothing else.
I'm not sure if this is possible? It appears that Azure and AWS both have the ability to setup triggers based on webhooks, but as far as I can tell that feature is completely absent in GCP.
The only thing I can think of is setting up a cloud function or making a consumer for the CMS webhook that will make and empty commit and push it to trigger a rebuild--but I'm hoping there's SOMETHING more sane out there than this.
Thanks
Upvotes: 1
Views: 1484
Reputation: 3955
Cloud run is much more flexible that a cloud function (and a bit more expensive unless you can run it concurrently) and you can test locally your microservice.
You can trigger cloud run:
You might find this useful:
1 - Codelab (google cloud tutorial) Cloud Run Hello - deploying a NodeJS app in Cloud Run.
2 - This google blog post Using Cloud Run as a Webhook for Actions it's a Java code example; but ilustrates very well how to work with Cloud Run.
3 - This might be similar to your use case: Automatic Deployment of Hugo Sites on Firebase Hosting and Drafts on Cloud Run
Upvotes: 1