#Mocking Local Deploys and other experiments

1 messages ยท Page 1 of 1 (latest)

solar walrus
#

Quoting my inquiry from the general channel!

Hey y'all! We use serverless framework to deploy our projects. I'm curious if anyone's been able to build projects using serverless framework with dagger.

Second half

We use serverless framework to deploy all our infra. I'm doing some experimentation at the moment. I am hoping to see if I can make something that does mock deploys. Looking to avoid permission and validation errors in our CI by running local mock deploys.

Some more context:
We use serverless framework to build out all our infra. We deploy using GitHub actions on a merge to production. This GH Action then sends our code over to AWS Codebuild to set up everything.

kindred frost
#

trying to understand what's in your head when you refer to "mock local deploys"

solar walrus
# kindred frost trying to understand what's in your head when you refer to "mock local deploys"

Makes total sense. So, the specific use case I'm wondering about is this:

We deploy using serverless framework (https://www.serverless.com/) to build out and deploy our infra. We merge to prod, GitHub actions pick up the project, which sends it over to AWS Codebuild, which deploys everything into AWS.

More often than I would like, we run into CI issues that cause the deploys to fail. Missing permissions for the AWS role doing the deployment. Issues with CloudFormation validation. And plenty more. So I'm experimenting with the ability to run a "mock deploy" where we start up a local docker container and build the entire project (api stack, data stack, etc) locally and test for any failures. Someday, I'd like to see that as part of the automated testing steps.

Easily build auto-scaling, low-overhead applications on AWS Lambda, API Gateway, DynamoDB, and other managed services with the Serverless Framework.

#

Does all that make sense?

kindred frost
#

Yes that makes sense. Dagger can definitely help here. I have to leave now but let's keep chatting more tomorrow about how this would look like

solar walrus
solar walrus
#

@kindred frost good morning. Was curious if you had any more thoughts on this. Not at all an urgent thing. Just asking. I'm trying to get more into the dagger docs to see if I can understand it a bit more to try and achieve what I'm talking about.

kindred frost
#

hey @solar walrus I got sick this week so haven't had much time to get back into this. Will take a look today ๐Ÿ™Œ

solar walrus
#

This is a side project I'm trying to work on for downtime at work.

strong pike
#

Copying @ebon juniper who did a lot of AWS+Dagger - thought you might be interested in this one ๐Ÿ™‚

kindred frost
#

More often than I would like, we run into CI issues that cause the deploys to fail. Missing permissions for the AWS role doing the deployment. Issues with CloudFormation validation. And plenty more. So I'm experimenting with the ability to run a "mock deploy" where we start up a local docker container and build the entire project (api stack, data stack, etc) locally and test for any failures. Someday, I'd like to see that as part of the automated testing steps.

hey @solar walrus I was thinking more about this today and wanted to ask you more about the above parragraph particularly.

Seems like the biggest paint points you have today is mostly around vendor (AWS) specific configurations IIUC. I'm trying to visualize how running a "mock deploy" is something that could help you and your team minimize these vendor specific dependencies since the mocking part happens locally in your team's machine instead of in the cloud

#

do your teams currently have a way to start the stack locally to test things? or they mostly go by the "push and pray" approach given that lifting the whole stack locally currently seems inviable?

solar walrus
# kindred frost do your teams currently have a way to start the stack locally to test things? or...

Hey @kindred frost usually we end up deploying to a staging environment in aws. We use serverless framework for that and the times that we do boot up something locally we use a plugin for serverless framework called serverless offline. https://www.serverless.com/plugins/serverless-offline

The Serverless Framework Plugin Registry. Search thousands of Serverless Framework plugins.

#

This is usually due to needing to call other services to test whatever it is we're doing and it just being easier to do it within aws

#

And yeah our bu=iggest pain point in so far as CI/CD are concerned is that we run into issues with configuration and issues with AWS resource permissions.

kindred frost
# solar walrus Hey <@336241811179962368> usually we end up deploying to a staging environment i...

gotcha, when you're saying this:

So I'm experimenting with the ability to run a "mock deploy" where we start up a local docker container and build the entire project (api stack, data stack, etc) locally and test for any failures. Someday, I'd like to see that as part of the automated testing steps.

does that include the serverless offline thing? Or this is a new approach you're trying? How do you think this mock deploy can help to reduce this AWS specific config errors and how do you envision Dagger helping there?

#

Asking all these questions to make sure that:

  1. Dagger is effectively a good tool to help here
  2. We're not over engineering something that might be solved better differently
solar walrus
kindred frost
#

I'm thinking that it might be interesting to explore lifting localstack with dagger and then configuration your application so the same serverless deploy can work both locally and in your stag/prod envs.

solar walrus
kindred frost
#

they're an AWS API compatible environment

#

you could use Dagger to "lift" this localstack environment and orchestrate all the pipeline to build and serverless deploy your app against it

#

looks like a fun idea to try

#

we're even using localstack ourselves in Dagger to run some lambda / event bridge integration testing

#

well.. seems like serverless supports as a plugin... so you might not even need to use Dagger for that

#

we're not using the serverless.com framework oursleves, that's why we have a Dagger pipline that takes care of the localstack provisioning

solar walrus
kindred frost
solar walrus
kindred frost
#

happy to help you out getting started if you need some guidance ๐Ÿ™Œ

solar walrus
kindred frost