5 ms·
How does this work in a serverless world? As far as I can tell local dev for most serverless environments that people actually care about is a joke.
by anonymousDan 4y ago
How does this work in a serverless world? As far as I can tell local dev for most serverless environments that people actually care about is a joke.
- dijit 4y agoUsually there is some sort of local development framework for serveless functions. Most seem to use docker, here’s one for Google Cloud functions: https://cloud.google.com/functions/docs/running/overview https://cloud.google.com/functions/docs/running/overview If you use something like “cloud run” then it’s containers anyway.
- koblas 4y agoFor golang, but would work in any language. What's really worked is the idea that your main loads configuration and injects all of the configured interfaces into your handler. You then can build all of the testing on mocks/stubs to test the behavior. If you access a database you access in through the interface which can mimic the appropriate behavior for your code in test vs production. If you need to you can do local integration testing of the db access layer.
- Hikikomori 4y agoWith AWS SAM you can invoke functions locally, run api gateway and use step functions. There's also a 3rd party project to run various AWS services locally, can't remember the project name. There's also SAM sync that syncs changes you make quickly, so if you have your own dev copy in AWS you can quickly test changes.
- tyingq 4y agoThere's also a fair amount of lambdas where you can just invoke the lambda handler yourself without anything special other than a compatible version of python/node/etc. Variations of things like: node -e "console.log(require('./index').handler(require('./event.json')));"
- nine_k 4y agoHaving used localstack [1], I can vouch that it's not a joke. [1]: https://github.com/localstack/localstack https://github.com/localstack/localstack
- thrauat 4y agothanks for saying that! people are pretty skeptical about localstack when they hear about it for the first time, and don't understand how we could ever emulate something remotely resembling AWS. tbh sometimes i'm baffled myself, it's pretty crazy what it can already do (i work there).
- methyl 4y agoFor Cloudflare Workers, it's no longer a joke either: https://github.com/cloudflare/workerd https://github.com/cloudflare/workerd
- jasonhansel 4y agoHonestly, my answer is: don't use serverless, or at least have a non-serverless way of running your code locally, preferably outside of a container/VM. Otherwise you have no way of running or testing your code locally, much less attaching a debugger; IMHO this can slow down dev cycles so much that it cancels out the time saved by adopting a serverless architecture.
- viridian 4y agoMost people building stuff quickly in serverless seem to eschew the concept of local entirely, and it's something I've recently started doing too. I make a code change locally and it gets picked up by the deployment of my stack associated with my feature branch the second I save the file. It's an uncomfortable concept at first but I find it's helped me build things faster and has ultimately led to less rabbit hole chasing across multiple categories of issues.
- oceanplexian 4y agoServerless deployments aren't painfully slow like they are with Kubernetes or other container orchestration platforms. At least with AWS lambda you can change and deploy your code in <10 seconds and have it taking traffic (In an infinite number of "environments"). So developing locally is kind of pointless.
- FridgeSeal 4y ago> Serverless deployments aren't painfully slow like they are with Kubernetes What are you doing with your K8s cluster/containers that is making your deployments slow? My cluster at work pulls down containers faster than my local, and deployments are usually swapping within ~1 minute of being committed in git/the container build finishing…