Hi there! :wave: I'd like to deploy a full-stack a...
# getting-started
a
Hi there! 👋 I'd like to deploy a full-stack app with Pulumi and I need to do the following: 1. Deploy backend (dynamoDB + API Gateway) 2. Build the frontend locally using the API URL from step 1 3. Deploy frontend (S3+Cloudfront) Is there a way to do all of this in the same "pulumi component"? My goal is to have atomic deploys, so, if the build fails (step 2) the backend is not deployed. I come from Serverless Components framework and it was pretty easy to do, but I couldn't find an example of this in Pulumi. Sorry for the noob question, but I'll be super grateful if anyone can point me in the right direction (examples, docs...). Thanks!
g
you may want to look at component resource https://www.pulumi.com/docs/intro/concepts/resources/#components
a
Thanks for the quick response @great-sunset-355, I already had a look at that page, but it doesn't explain how to achieve my step 2
g
when you deploy API GW, the resource should return an Output https://www.pulumi.com/docs/reference/pkg/aws/apigatewayv2/api/#api_endpoint_python With that you need to write a function to execute an external script
pOpen
or API of your bundler/builder this will create say
/build
directory with your front end which you can then pass to assets module https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/asset/
a
I can't find docs about
pOpen
, maybe it's a typo?
ah, I guess you mean I start a subprocess. Sure, my goal is to do something like
API_URL=<backendOutput> yarn build
but I can't find a reliable way to do this inside a Pulumi program and achieve atomic deploys
I think this is a pretty common use case and I wander if there's an official way or an out-of-the-box component to do it. Even a community maintained example or something
g
yes I meant to start sub process
If you are using TS or JS you should be able to run yarn via API: https://yarnpkg.com/api/
within you code