Skip to content

Pipeline to build, test and deploy Serverless Framework Projects with CodeBuild and CodePipeline on AWS using Terraform. ⚡ 🚀 ⚡ 🚀

License

Notifications You must be signed in to change notification settings

msfidelis/serverless-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Simple Pipeline - Easy way to deploy FaaS on AWS with CI/CD

Create deployment pipelines for NodeJS FaaS using Serverless Framework with Terraform

Deploy Pipeline

Steps

How to Deploy

Edit your preferences

Edit variables.tf file to customize application preferences like Github account, repo and owner, Load Balancer ports and cluster preferences.

# Customize the Serverless App Name

variable "app_name" {
  description = "Serverless Project Name"
  default     = "serverless-project-demo"
}

Edit the Github preferences in the same file to specify infos like repo, owner or organization, branches e etc.

# Github Repository Owner
variable "git_repository_owner" {
  description = "Github Repository Owner"
  default     = "msfidelis"
}

# Github Repository Project Name
variable "git_repository_name" {
  description = "Project name on Github"
  default     = "micro-api"
}

# Default Branch
variable "git_repository_branch" {
  description = "Github Project Branch"
  default     = "master"
}

Edit your Build steps

This demo build, test and deploy a simple Node.JS FaaS. Customize your build steps on modules/pipeline/templates/buildspec.yml file.

Example

version: 0.2

phases:
  pre_build:
    commands:
      - echo Installing Node 8
      - curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
      - apt-get install -y nodejs  
      - echo Entered the pre_build phase...
      - npm install -g serverless
      - npm install
  build:
    commands:
      - echo Build started on `date`
      - echo Starting Unit Tests
      - npm run test # Put your test command code in here
  post_build:
    commands:
      - serverless deploy -v

How to Deploy

1) Github Access Token

export GITHUB_TOKEN=YOUR_TOKEN

2) Terraform

  • Initialize Terraform
terraform init
  • Plan our modifications
terraform plan
  • Apply the changes on AWS
terraform apply

References

About

Pipeline to build, test and deploy Serverless Framework Projects with CodeBuild and CodePipeline on AWS using Terraform. ⚡ 🚀 ⚡ 🚀

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages