This is the repository for the analytics of the memex - How the users intreacts with memex extension.
Fork the repo
$ git clone https://github.com/WorldBrain/AnalyticsServer.gitInstall all the dependencies
$ npm installRename .env.example to .env and change all the required things,
In the .env, change
TIER="development"All the users and events will be saved in the public folder.
Install the aws-cli and configure aws configure
Configure with AWS account
$ npm run config -- --account-id="12_DIGIT_ACCOUNT_ID" --bucket-name="UNIQUE_BUCKET_NAME" --function-name="LAMBDA_FUNCTION_NAME" --region="REGION" --stage="YOUR_STAGE_NAME" --stack-name="YOUR_AWS_STACK_NAME"For example
$ npm run config -- --account-id="12_DIGIT_ACCOUNT_ID" --bucket-name="UNIQUE_BUCKET_NAME" --function-name="LAMBDA_FUNCTION_NAME" --stage="staging" --stack-name="YOUR_AWS_STACK_NAME"OR
$ npm run config -- --account-id="12_DIGIT_ACCOUNT_ID" --bucket-name="UNIQUE_BUCKET_NAME" --function-name="LAMBDA_FUNCTION_NAME" --stage="production" --stack-name="YOUR_AWS_STACK_NAME"The default function name and region are
region: 'us-east-1',
function-name: 'AwsServerlessExpressFunction',
stack-name: 'AwsServerlessExpressStack'Now you can deploy the serverless application to AWS
$ npm run prepare
$ npm run setupNow we have two endpoints:
/user-token/ - POST
- install_time: timestamp
/event/ - POST
- id: string
- data: array of events
Each element of data contains:
- type
- time
- other : Array of additional things - reserved for future
Deconfigure first by ruuning
npm run deconfigNow config the file according to need
$ npm run config -- --account-id="12_DIGIT_ACCOUNT_ID" --bucket-name="staging.analytics.worldbrain.io" --function-name="stagingAWSAnalytics" --stage="staging" --stack-name="StagingStack"
$ npm run setupIt will create the stack named as configure input.
npm run config -- --account-id="12_DIGIT_ACCOUNT_ID" --bucket-name="analytics.worldbrain.io" --function-name="AWSAnalytics" --stage="production" --stack-name="ProductionStack"It will create the stack named as configure input.