Commit b6c90e28f051126b7c3e4dc45c61d1e23df7619b

Authored by Alex Mukha
Exists in master

Merge branch 'master' of gitlab.alfresco.com:innovation/heartbeat2

... ... @@ -7,11 +7,15 @@ The project contain a lambda (HeartbeatRequestHandler) which writes the received
7 7 The request and response objects are build according to the docs:
8 8 https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-simple-proxy-for-lambda-input-format
9 9  
10   -## Usage
  10 +## Build & Deploy
11 11  
12   -Use the following steps to deploy a stack (aws cli should be installed and configured):
  12 +Use the following steps to build & deploy a stack:
13 13  
14   -build the code using maven
  14 +install and configure AWS CLI (note: the DAO tests that run during the build currently assume "eu-west-1" region)
  15 +~~~
  16 +http://docs.aws.amazon.com/cli/latest/userguide/installing.html
  17 +~~~
  18 +build the code using maven - this will also run build tests
15 19 ~~~
16 20 mvn clean install
17 21 ~~~
... ... @@ -23,10 +27,47 @@ package the template and upload the jar to the bucket
23 27 ~~~
24 28 aws cloudformation package --template-file heartbeat-template.yaml --output-template-file heartbeat-template-output.yaml --s3-bucket <bucket-name>
25 29 ~~~
26   -deploy the stack in CF
  30 +deploy the stack using CF cli
27 31 ~~~
28 32 aws cloudformation deploy --stack-name <stack-name> --template heartbeat-template-output.yaml --capabilities CAPABILITY_IAM
29 33 ~~~
  34 +show details of stack after deployment
  35 +~~~
  36 +aws cloudformation describe-stacks --stack-name <stack-name>
  37 +~~~
  38 +
  39 +## Call the API
  40 +
  41 +Obtain the API's invoke url (top-level entrypoint):
  42 +
  43 +either from the AWS console
  44 +~~~
  45 +http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-call-api.html
  46 +~~~
  47 +or construct yourself (hint: use aws apigateway get-rest-apis to find the restapi_id for given (api/stack) name)
  48 +~~~
  49 +https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/
  50 +~~~
  51 +
  52 +Send some heartbeat data:
  53 +
  54 +use postman or curl. Here's an example with fake data:
  55 +~~~
  56 +curl -X POST https://7a44anmr6e.execute-api.eu-west-1.amazonaws.com/Prod -d '{"repositoryId":" a1d48b32-8309-5c65-acdb-7202c8cd2f9e","feature":"Alfresco Content Services", "payload":{"users":"100","documents":"10000"}, "version":"6.0.0"}'
  57 +~~~
  58 +
  59 +## Cleanup
  60 +
  61 +Later, you can use the following steps to delete a stack:
  62 +
  63 +delete the stack using CF cli
  64 +~~~
  65 +aws cloudformation delete-stack --stack-name <stack-name>
  66 +~~~
  67 +check progress of stack deletion
  68 +~~~
  69 +aws cloudformation describe-stacks --stack-name <stack-name>
  70 +~~~
30 71  
31 72  
32 73 ## Build plan
... ...