The main goal of this Project is to have structured approach to develop, test, build, deploy and document serverless micro-services. Based on AWS Lambda, and serverless micro-framework.
- Clear folder structure to put your code logically splitted to node.js modules.
- Installed Karma tests runner with 100% code coverage, and corrals tests reporter.
- Installed and configured APIDOC generator, with automated deployment to S3 Bucket and static webhosting.
- Configured CI integration
- Independent branches deployment
- All kinds of badges
- Automated API versioning based on NPM versioning (version of API correspond version in package.json)
- Local development environment with possibility to run lambda functions and navigate thought generated APIDOC
- Integration tests
- You should have AWS account activated.
- Create 2 s3 buckets. One of those buckets should be a static website hosting.
For more information refer to Setup s3 buckets section. - Create AWS user.
For more information refer to Serverless Documentation. - Copy AWS user credentials into your
~/.bash_profile
export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_KEY
- Install node.js 4.x/6.x
git clone [email protected]:xcomanche/serverless-lambda-boilerplate.git
cd serverless-lambda-boilerplate
npm install
- Edit
src/config.js
and specify your params.
For more information refer to Setup config section. - Edit
circle.yml
and specify your parameters.
For more information refer to Setup circle.ci integration section. - Edit
src/serverless.yml
and specify your params.
For more information refer to Serverless Documentation - To test demo version of the app hit
npm run redeploy
clean
- Clean build foldertest
- Run unit testsbuild:app
- Build lambda functions from src/ folders into build/ folderdeploy:app
- Deploy lambda functions from build/ folder into AWS accountbuild:doc
- Build API Doc from src/ folder into doc/ folderdeploy:doc
- Deploy API Doc from doc/ folder into AWS S3 bucketredeploy
- Runs sequentiallynpm run clean
thanbuild:app
thandeploy:app
thanbuild:doc
thandeploy:doc
npm run redeploy
should do the trick and deploy your source code to dev environment- In case you want to deploy into another env - than you need to specify correct env environment variable.
BRANCH=develop npm run redeploy
. Supported environments: dev, stage, prod and any other feature branches environements - CircleCi always deploys your builds to it default branches environements
Branch to Environment corresponding table:
- master - prod
- release/* - stage
- develop - dev
- feature/number - featurenumber (eg feature/1 -> feature1)
Follow the documentation on Serverless project
TBD
TBD
- Activate your project in circleci
- Receive your AWS credentials and put it into CircleCI Project Settings/AWS Permissions
- Receive your coveralls token and put it into CircleCI Project Settings/Environment Variables create COVERALLS_REPO_TOKEN var
This is free and opensource product. Just take and use it as you want to :)