https://pulumi.com logo
#general
Title
# general
a

able-camera-57198

11/10/2021, 3:16 PM
Can pulumi be used for deployment of static web site content? For example, to google storage containers? Or is this something to be avoided? (I ask as there's a line some like to observe between infra management and releases.)
p

prehistoric-activity-61023

11/10/2021, 3:18 PM
Personally, I haven’t used pulumi for that (I’ve got a simple GH action job that uses gsutil rsync underneath) but it should be doable.
The only thing I’d check is speed and costs. If you want to use pulumi to deploy static web site content to GCS, I assume you’d have to create multiple
BucketObject
resources (each representing single file).
a

able-camera-57198

11/10/2021, 3:21 PM
Yeah, I have the same gsutil approach right now, I was more curious than anything.
But I dunno if it's really worth the effort to manage all that in pulumi given that most tools will probably favour the first party gcloud stuff.
p

prehistoric-activity-61023

11/10/2021, 3:21 PM
I’d say - give it a try on some test branch and see how it works.
a

able-camera-57198

11/10/2021, 3:21 PM
What about for cloud run revisions?
I feel like pulumi does well there because there's more configuration involved.
m

miniature-king-36473

11/10/2021, 3:22 PM
The line is blurry for sure. e.g. we deploy updates to Lambda using Pulumi.
☑️ 1
but website content just by copying to the bucket
a

able-camera-57198

11/10/2021, 3:23 PM
Yeah, it'd be neat if I could define some gsutil rsync resource. But I dunno what kind of strategy would be effective in knowing when/whether that needs to change.
Maybe a hint/filename that is watched for a change to what's in state.
m

miniature-king-36473

11/10/2021, 3:23 PM
It would be nice to have a good way to deploy the content so that all releases are captured in pulumi - but it is a bit too complex at the moment.
a

able-camera-57198

11/10/2021, 3:24 PM
Totally.
l

limited-rainbow-51650

11/10/2021, 3:24 PM
By using Pulumi, the line between infra, services, content and app blurs more and more each day. Endless possibilities.
Regarding the initial request, publishing content to a bucket is not a problem. We do this in our organization. It is even one of the Pulumi examples (but shown for AWS): https://github.com/pulumi/examples/tree/master/aws-ts-static-website
m

miniature-king-36473

11/10/2021, 3:26 PM
How does that scale for a website with 100 - 1000s of files?
a

able-camera-57198

11/10/2021, 3:26 PM
Totally my thought.
Copy code
gsutil -m rsync -R ${SPA_PATH} gs://${SPA_BUCKET}
gsutil setmeta -h "cache-control:max-age=0, no-cache, no-store, must-revalidate" "gs://${SPA_BUCKET}/*.html"

gsutil -m cp spa/config.json gs://${SPA_BUCKET}/config.json
gsutil setmeta -h "cache-control:max-age=0, no-cache, no-store, must-revalidate" "gs://${SPA_BUCKET}/config.json"
Here's my current
gsutil
script for deploying.
a

able-camera-57198

11/10/2021, 3:27 PM
Ahh, yeah, there ya go.
l

limited-rainbow-51650

11/10/2021, 3:27 PM
@miniature-king-36473 we don’t have 1000s of files. We publish our single page app (SPA) with it, so less than 100 files. Images come from a CMS system
👍 1
👍🏻 1
a

able-camera-57198

11/10/2021, 3:29 PM
Well, I guess it's worth giving it a shot, regardless.
m

miniature-king-36473

11/10/2021, 3:29 PM
I did look at creating a dynamic resource which could deploy from a zip file. That way I could have the zip file versioned and see in pulumi which version had been deployed.
a

able-camera-57198

11/10/2021, 3:30 PM
Does pulumi offer a way to run & manage arbitrary commands? I have one pre-deploy step I'd like to be able to run if I were to do this.
m

miniature-king-36473

11/10/2021, 3:31 PM
I think you can do that by defining a dynamic resource. takes a bit of getting your head around though.
a

able-camera-57198

11/10/2021, 3:32 PM
Right, 'cause I'd have to come up with sourcing some hint as to whether the resource needed to be refreshed/rerun?
l

limited-rainbow-51650

11/10/2021, 3:32 PM
@miniature-king-36473 have a look at using a dynamic provider as a provisioner: https://www.pulumi.com/blog/dynamic-providers/#dynamic-providers-as-provisioners
m

miniature-king-36473

11/10/2021, 3:32 PM
ah yes - that is what I had in mind
a

able-camera-57198

11/10/2021, 3:34 PM
Hah, dangit, no dynamic providers in C#
e

echoing-dinner-19531

11/10/2021, 5:19 PM
Issue to support dynamic providers in C# https://github.com/pulumi/pulumi/issues/3638
👍🏻 1
3 Views