Name Last Update
aggregation-service Loading commit data...
ingestion-service Loading commit data...
reporting-service Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
README.md Loading commit data...
heartbeat-template.yaml Loading commit data...
pom.xml Loading commit data...

README.md

Serverless Heartbeat

Overview

The project contain a lambda (HeartbeatRequestHandler) which writes the received data to DynamoDB. The request and response objects are build according to the docs: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-simple-proxy-for-lambda-input-format

Build & Deploy

Use the following steps to build & deploy a stack:

install and configure AWS CLI (note: the DAO tests that run during the build currently assume "eu-west-1" region)

http://docs.aws.amazon.com/cli/latest/userguide/installing.html

build the code using maven - this will also run build tests

mvn clean install

create S3 bucket

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

package the template and upload the jar to the bucket

aws cloudformation package --template-file heartbeat-template.yaml --output-template-file heartbeat-template-output.yaml --s3-bucket <bucket-name>

deploy the stack using CF cli

aws cloudformation deploy --stack-name <stack-name> --template heartbeat-template-output.yaml --capabilities CAPABILITY_IAM

show details of stack after deployment

aws cloudformation describe-stacks --stack-name <stack-name>

Call the API

Obtain the API's invoke url (top-level entrypoint):

either from the AWS console

http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-call-api.html

or construct yourself (hint: use aws apigateway get-rest-apis to find the restapi_id for given (api/stack) name)

https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/

Send some heartbeat data:

use postman or curl. Here's an example with fake data:

curl -X POST https://7a44anmr6e.execute-api.eu-west-1.amazonaws.com/Prod/ingest -d '{"repositoryId":"a1d48b32-8309-5c65-acdb-7202c8cd2f9e","feature":"Alfresco Content Services", "payload":{"users":"100","documents":"10000"}, "version":"6.0.0"}'

Get the report on the repo ID:

curl https://7a44anmr6e.execute-api.eu-west-1.amazonaws.com/Prod/report/a1d48b32-8309-5c65-acdb-7202c8cd2f9e

Cleanup

Later, you can use the following steps to delete a stack:

delete the stack using CF cli

aws cloudformation delete-stack --stack-name <stack-name>

check progress of stack deletion

aws cloudformation describe-stacks --stack-name <stack-name>

Build plan

Please, visit https://bamboo.alfresco.com/bamboo/browse/PLAT-H2

The build has a deployment stage which can deploy a stack on Amazon. It is required to override the following variables: s3.bucket.name and stack.name.