Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Quick Start

Lu Hong edited this page Oct 31, 2019 · 36 revisions

The Quickstart guide is meant to help you get started. By using one of the approaches below, you can deploy all the modules (backend, frontend, analytics and operations) in this project together in your AWS Account.

1-click Deploy

To make it easy to deploy the service and see how it works, we have published the service, including all the modules in the repository, as a serverless application on AWS Serverless Application Repository. Follow the steps below to deploy this application in your AWS account:

  1. Create an AWS account if you do not already have one and login
  2. Go to this app's page on the Serverless Application Repository and click "Deploy"
  3. Provide the required app parameters and click "Deploy"

Parameters

The app has the following parameters:

  1. Stage (optional) - The stage where the application is running in, e.g., dev, prod. Default: test

Manually Deploy from Source

To manually deploy the application from the source code, follow the steps described in this section. At the end, you will have a running instance of this application in your AWS account. You will be able to use the deployed service from the static website.

Pre-requisites

The source code of the repository is written and built using Java8 and node.js10 runtimes. You will need to install Java8 and Node.js10:

To build and deploy the service manually from your machine, you will also need to install and configure Maven, Vue CLI and AWS CLI

Versions

The project only builds and runs on Java8 and Node.js10. If you have other versions of Java or Node.js, you will need to download the configure Java8 and Node.js10.

The minimum version requirement for AWS CLI is 1.16.84. If you have an older version of AWS CLI, you will need to upgrade it.

1. Build

  • Clone the source code from the GitHub repository
  • Run the following commands to build the source code:
cd static-website
npm install
npm run ci
cd ..
mvn clean test

The commands above will compile the code and run unit tests

2. Package

The AWS resources used in the service are defined in SAM (AWS Serverless Application Model) templates. You can install the service into your own AWS account by packaging and deploying the SAM template template.yaml under sam/app folder.

To package the SAM templates, first you will need an S3 bucket to store the artifacts such as your AWS Lambda function code. AWS CloudFormation will use the artifacts from the S3 bucket for deployment. If you don't have an S3 bucket yet, you can run the following command to create an S3 bucket:

aws s3 mb s3://<your bucket name>

Then run the following maven command to package the templates:

mvn clean package -DpackageBucket=<your bucket name>

The command generates a packaged-template.yaml file under folder target/sam/app. The packaged template is now deployable to AWS CloudFormation.

3. Deploy

Run the following AWS CLI command to deploy the packaged templates to your AWS account:

aws cloudformation deploy --template-file target/sam/app/packaged-template.yaml --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND --stack-name <your-stack-name>

Post Deployment

The deployment takes around 10 minutes to complete. Once completed, you can access the service APIs via the static website. The URL of the static website is available in the output section of the deployed CloudFormation stack. Go to the CloudFormation console and click on your root stack. At the top, you will see an Outputs tab that will display the URL you can use to access the static website.

The Quick Start deployment launches all components in your AWS account so you can experiment around with the deployed service. However, if you would like to setup a more production-like deployment environment with separate CI/CD pipelines, follow the CI/CD setup instructions.

To learn more about each component, see the following walkthroughs: