Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
.travis.yml
.travis_aws.sh
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
serverless.env.yml
serverless.yml

README.md

Minimally Opinionated Serverless Microservice Project

Prerequisites

  1. Install Java 8, Groovy, Kotlin, and Gradle - I highly recommend using SDKMAN to install any JVM-related packages.
  2. Install NodeJS and the Serverless Framework
  3. Amazon Web Services, GitHub, Travis CI, CodeCov and Sentry accounts

Create a new Serverless project

Using the Serverless Framework, you can create a new project by providing the base template microservice-starter:

serverless create \
  --template-url https://github.com/bytekast/serverless-templates/tree/master/microservice-starter \
  --path myservice

This project is pre-configured to use the following development tools and services:

This project makes a few assumptions before you are able to deploy the service in AWS.

First, you need to setup your AWS credentials/profiles in ~/.aws/credentials file.

[dev]
aws_access_key_id = XXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXX
region = us-east-1

[prod]
aws_access_key_id = XXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXX
region = us-east-1

Now you can go to the project directory, build the binaries and deploy to the DEV environment.

build

Test the functions locally or invoke the real instance in AWS to verify:

invoke

Additional Conventions / Configurations


Bug Tracking and Error Reporting:
  • This project uses Log4J to automatically create trackable bug issues in Sentry whenever a message with the ERROR severity is logged via log.error("...").
  • Update the serverless.env.yml file to provide the SENTRY_DSN environment variable so that issues are created in the appropriate project in Sentry.
Travis CI for Continuous Integration
  • When the project is enabled in Travis CI, the provided travis.yml will autodeploy the service to the dev AWS Environment.
  • The DEV_AWS_KEY and DEV_AWS_SECRET environment variables must be provided in .travis.yml.
  • Code Coverage reports are automatically uploaded to CodeCov if the CODECOV_TOKEN environment variable is provided in .travis.yml.
VPC for Security and Access Restriction
  • If deploying the microservice in a VPC, provide the necessary configuration - account ids, vpc ids, subnet ids and security group ids - in the serverless.yml file and uncomment the vpc section here.