Creating a CI/CD Pipeline for serverless
So to recap, here’s what we’ve created so far.
- A full-stack serverless app that includes:
- A way to handle secrets locally
- A way to run unit tests for our infrastructure and functions
- Deployed to a prod environment with a custom domain
All of this is neatly committed in a Git repo.
So far we’ve been deploying our app locally through our command line — pnpm sst deploy
. But if we had multiple people on our team, or if we were working on different features at the same time, we won’t be able to work on our app because the changes would overwrite each other.
To fix this we are going to implement a CI/CD pipeline for our full-stack serverless app.
What is a CI/CD Pipeline
CI/CD or Continuous Integration/Continuous Delivery is the process of automating deployments by tying it to our source control system. So that when new code changes are pushed, our app is automatically tested, built and deployed.
A CI/CD pipeline usually includes multiple environments. An environment is one where there are multiple instances of our deployed app. So we can have an environment called production that our users will be using. And development environments that we can use while developing our app.
Here is what our workflow is going to look like:
- Our repo will be connected to our CI/CD service.
- Any commits that are pushed to the
main
branch will be automatically:- Tested
- Built
- And deployed to prod
Our workflow is fairly simple. But as your team grows, you’ll need to add additional dev and staging environments.
CI/CD for Serverless
There are many common CI/CD services, like Travis CI or CircleCI. These usually require you to manually configure the above pipeline. It involves a fair bit of scripts and configuration.
To fix this we created a service called Seed. It requires no scripts and is built specifically for serverless. It also allows you to monitor and debug your serverless app.
We should mention that you don’t have to use Seed. And this section is completely optional.
Let’s get started with setting up your project on Seed.
For help and discussion
Comments on this chapter