Coder Social home page Coder Social logo

tradle / mycloud Goto Github PK

View Code? Open in Web Editor NEW
14.0 11.0 12.0 48 MB

Tradle MyCloud: digital financial grade blockchain-based identity

License: GNU Affero General Public License v3.0

JavaScript 53.92% Shell 0.31% TypeScript 45.07% HTML 0.59% CSS 0.10% Dockerfile 0.01%
serverless tradle blockchain aws-lambda aws digital-identity

mycloud's Introduction

@tradle/serverless

Welcome to Tradle serverless / Tradle MyCloud! You'll find everything you need to configure and launch your own Tradle instance here.

If you're developer, you'll also see how to set up your local environment, deploy, and develop your own chatbots.

Orientation

Digital Identity Intro

Jump down the rabbit hole

Setup

First, install some tools

Tools

Git

Make sure you have git installed. If you're on OS X, you already have it. To enforce https access to github run this command: git config --global url."https://".insteadOf git://

Node.js

The following are the versions used by the Tradle dev team:

  • Node.js@14.17.5 - this is the version used by Amazon for AWS Lambda. Yes, you can use the latest Node.js instead, but keep this in mind if you hit errors.
  • [email protected] - comes with 14.17.5

Docker & Docker Compose

Docker is used during the build process, as well as in the local playground. Docker Compose is used for container orchestration and networking

  1. Docker
    a. OS X
    b. Window
    c. Linux
  2. Docker Compose

Make sure you can run docker as non-root. On Linux, you can do this by adding your user to the docker group with: sudo gpasswd -a $USER docker

AWS cli & credentials

  1. Install
  2. create a new IAM user with AdministratorAccess
  3. Configure your credentials: aws configure or aws configure --profile <profileName>. This will set up your AWS credentials in ~/.aws/

JQ

jq: a great command line JSON parser (On OS X, you can brew install jq)

Typescript

typescript: This project uses TypeScript, which needs to be compiled to JavaScript prior to use.

Install: npm i -g --save-exact [email protected]

Note: Depending on your local setup you may need install with sudo

Development Tools

Note: if you don't care about playing locally and want to skip ahead to deploying Tradle MyCloud to the cloud, skip this section

  • awslocal. aws-cli wrapper for querying localstack. (On OS X, install with [sudo] pip install awscli-local)

Note: with npm i command that follows below the serverless and nodemon commands are installed relatively. You can use npx serverless or npx nodemon to execute them respectively.

Clone this project

Clone this project. The rest of setup below takes place in the cloned repository's root folder.

Install dependencies

# install dependencies
npm install

Set AWS profile

By default, aws cli operations will run under the profile named default

If you ran aws configure --profile <profileName> and not aws configure, open vars.json and add a property:

{
...
  "profile": "<profileName>"
...
}

Local Playground

Note: if you don't care about playing locally and want to skip ahead to deploying Tradle MyCloud to the cloud, skip this section

Goal: set up an environment where we can talk to the chatbot that comes in the box, and see how we can develop our own.

Set TMPDIR env var

Check if the environment variable TMPDIR is set, and if not set it (better add it to ~/.bash_profile or ~/.bashrc)

Start docker

# make sure you have docker running
docker ps

Start the Playground

The first time you start the playground, Docker will pull the necessary images from Docker Hub, which can take a while, depending on which century your internet connection is from.

npm start

Now open your browser to http://localhost:55555. If 55555 is already your favorite port for something else, you can change the port in ./docker/docker-compose-localstack.yml.

If you don't see your local provider, click the red menu button on the Conversations screen, choose "Add Server Url" and add http://localhost:21012

Profile Conversations Chat

Explore the API

After you chat with the bot a bit, open up GraphiQL at http://localhost:21012 and play with the API:

# http://localhost:21012
# 
# sample query:
{
  rl_tradle_ProductRequest {
    edges {
      node {
        _author,
        _time,
        _link,
        requestFor
      }
    }
  }
}

You can also browse the database via the DynamoDB Admin at http://localhost:8001

When you deploy to the cloud, GraphiQL will be available at https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/graphql

AWS cli (local)

The endpoints for localstack are enumerated in their docs (or see ./src/test/localstack.json). To query them using the AWS cli, specify an additional --endpoint option, e.g.:

aws dynamodb list-tables --endpoint http://localhost:4569
aws s3 ls --endpoint http://localhost:4572

Deployment

Pre-deployment configuration

  • To change the region/name/domain/logo of your deployment, edit ./vars.json. Then run npm run build:yml. See ./default-vars.json for a list of variables you can override.
  • If you'd like to write your own bot, for now the easier way to do it is directly in your cloned tradle/serverless repo. Check out the built-in bot in: ./in-house-bot/index.js.

Deploy to AWS

First, make sure Docker is running

# make sure docker is running
docker ps

Autopilot

# 1. compile typescript -> javascript
# 2. test
# 3. rebuild native modules with AWS Linux container
# 4. deploy to cloud
npm run deploy:safe

Manual

# compile typescript -> javascript
tsc
# gen resources in cloud emulator and test
npm run gen:localresources && npm test
# rebuild native modules with AWS Linux container
npm run rebuild:lambda
# deploy to cloud
npm run deploy

Deployment can take ~5-10 minutes.

Once everything's deployed, open your browser to https://app.tradle.io. On the Conversations page, click the red button, and choose Add Server URL. Paste in your API endpoint (it looks like https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/)

Post-deployment configuration

See tradleconf, a command line tool for configuring styles, plugins, custom models, etc. of a deployed Tradle MyCloud.

Explore the Architecture

List deployed resources, API endpoints, ...

npm run info # or run: sls info

# Service Information
# service: tradle
# stage: dev
# ...
# endpoints:
#  ..
#  ANY - https://example.execute-api.us-east-1.amazonaws.com/dev/tradle/graphql
#  ANY - https://example.execute-api.us-east-1.amazonaws.com/dev/tradle/samples
#  ..

Development

This project uses TypeScript, which compiles to JavaScript. If you're changing any *.ts files, or if you run git pull be sure you have tsc -w running on the command line, which will watch for changes and rebuild your sources.

Inspect / Debugger mode

You can start debugger mode by adding --inspect or --inspect-brk after the npm start script:

npm start --inspect-brk

serverless.yml

If you modify serverless-uncompiled.yml, run npm run build:yml to preprocess it. Before running tests, re-run npm run gen:localresources

To override variables in the yml without picking a fight with git, create a vars.json file in the project root. See default-vars.json for which variables you can override.

After modifying vars.json, run npm run build:yml

Testing

Note: running tests messes with your locally emulated resources. After running tests, run npm run reset:local before running npm start

# run tests on local resources
npm run test
# browse that data via graphql
npm run test:graphqlserver
# GraphiQL is at       http://localhost:21012
# DynamoDB Admin is at http://localhost:8001

Hot re-loading

Thanks to serverless-offline, changes made to the codebase will be hot-reloaded, which makes development that much sweeter...but also slower. To disable hot-reloading, add this in vars.json:

serverless-offline:
  # disable hot-reloading
  skipCacheInvalidation: true
  # copy these from default-vars.json unless you want custom ones
  host: ...
  port: ...

Logging

Use tradleconf

Destroy

Sometimes you want to wipe the slate clean and start from scratch (usually by age 25 or so). The following command will wipe out all the AWS resources created in your deployment. Obviously, use with EXTREME caution, as this command executes with your AWS credentials (best use a separate account).

To destroy your remote stack, resources, data, etc., use tradleconf

To destroy your local resources, use npm run nuke:local, or npm run reset:local to destroy + reinit

[Deprecated] Destroy

npm run nuke
# a series of y/n prompts ensues, 
# ensuring you're committed to the destruction of all that is holy

Troubleshooting local deployment

Note: this is ONLY for troubleshooting your local development environment and NOT your remote deployment

Symptom 1:

# Error: connect ECONNREFUSED 127.0.0.1:4569
# ...

Cause: localstack is not up.
Fix: npm run localstack:start

Symptom 2:

# ResourceNotFoundException: Cannot do operations on a non-existent table
# ...

Cause: you haven't generated local resources (tables, buckets, etc.)
Fix: run npm run gen:localresources

Symptom 3:

...bucket does not exist

Cause: you probably ran tests, which f'd up your local resources
Fix: npm run reset:local

Symptom: tests fail, you don't know why
Cause: to be determined
Fix: npm run reset:local # delete + regen local resources (tables, buckets, etc.)

Symptom 4:

Serverless command "<some command>" not found

Cause: your serverless.yml is corrupted. build:yml probably failed the last time you ran it.
Fix: fix serverless-uncompiled.yml, make sure build:yml completes successfully before retrying

Symptom 5:

still havent connected to local Iot broker!

Cause: something in redis upsets mosca, but what exactly is TBD
Fix: npm run fix:redis

Symptom 6

The log is going nuts but the mobile/web client can't seem to communicate with your local MyCloud

Cause: if you have multiple clients connected at once (e.g. mobile, simulator, multiple browser tabs), your machine probably just can't handle it. If you've got Dev Tools open and are debugging your lambdas, that exacerbates things. This is due to the fact that locally, the serverless environment is simulated by invoking each lambda function as if it's waking up for the first time in a docker container. It needs to require() everything from scratch, then run itself, then die. This is memory/computation expensive. Fix: turn off the debugger, don't use more clients than your machine can handle. Yes, locally, this might only be a 2-5!

Symptom 7

Credentials Error --------------------------------------

Missing credentials in config

Cause 1: your AWS cli is not configured with your credentials
Fix: see AWS cli

Cause 2: you may be using a global installation of serverless rather than the project-local one. If you're running Tradle locally via npm scripts, this should be taken care of for you. If you're running sls / serverless commands directly, make sure to use the project-local one in node_modules, e.g.: ./node_modules/.bin/sls offline start

Symptom 8

npm install fails with Authentication failed for 'https://github.com/tradle/models-corporate-onboarding.git/' (or some other private repository it fails to pull).

Cause 1: you don't have access to the repository
Fix: check to see if you can clone that repository directly, into some other folder. If you can't, request access from Tradle

Cause 2: your git credentials have expired, or are not being properly cached
Fix: set up caching for your git credentials (varies depending on your operating system), and then check to see if you can clone that repository directly, into some other folder.

Cause 3: npm is having trouble with dependencies with git:// urls.
Fix: open ~/.gitconfig on your machine, and add this block:

[url "https://"]
  insteadOf = "git://"

Symptom 9

"namespace":"global:http","msg":"request failed","level":"ERROR","details":{"method":"POST","port":4569,"path":"/","host":"10.0.0.127"

Cause: docker isn't running, or if it is, localstack isn't Fix: see fix for Symptom 1

Troubleshooting remote deployment

Symptom 1

After deploying to AWS, CloudWatch logs shows:

module initialization error TypeError

Cause: a native module in your dependency tree was not compiled for the Amazon Linux Container Fix: npm run rebuild:lambda and re-deploy

Keep in mind that deployment keys in S3 are based on the current git commit, so you'll need to re-commit before deploying, otherwise AWS CloudFormation will not re-deploy your lambdas with new code.

If the issue persists, you may have unknowingly introduced a new native dependency. Run ./src/scripts/list-native-modules.sh and see if there's anything missing in the native_modules var in ./src/scripts/rebuild-native.sh. If there, is, update native_modules and repeat the above fix.

Keep in mind that code bundle S3 keys are based on the current git commit hash, so you'll need to create a new git commit before pushing, e.g.: git commit --allow-empty -m "chore: bust deployment cache"

Scripts

npm run localstack:start

start DynamoDB and S3 in a Docker

npm run localstack:stop

stop local DynamoDB and S3

npm run localstack:restart

restart local DynamoDB and S3

npm run localstack:update

update docker images

npm run gen:localstack

generate local DynamoDB tables and S3 buckets

npm run gen:localresources

generate local tables, buckets, identity and keys

npm run nuke:local

delete local tables, buckets, identity and keys

npm run reset:local

delete and recreate local resources (tables, buckets, identity)

npm run deploy:safe

lint, run tests, rebuild native modules for the AWS Linux Container used by AWS Lambda, and deploy to AWS

npm run test:graphqlserver

start up two UIs for browsing local data:

  • a DynamoDB Admin interface
  • GraphiQL

npm run graphqlserver

starts up GraphiQL for querying remote data

warmup

  • warm up all functions with: sls warmup run
  • warm up a subset of functions with sls warmup run -f [function1] -f [function2] -c [concurrency]
  • estimate cost of warm ups: sls warmup cost

Project Architecture

Tools

This project uses the Serverless framework. serverless.yml file is thus the main configuration file for the cloud architecture you'll be deploying: tables, buckets, IaM roles, lambda functions, logs, alarms, pictures of kittens, etc.

You can set up a local playground, with most of the functionality of the cloud one right on your machine. To make this possible, this project uses localstack for simulating DynamoDB and S3 locally, and serverless-offline + mosca for simulating AWS's APIGateway and IoT broker, respectively.

Directory Structure

./
  serverless-uncompiled.yml # npm run build:yml turns this into:
                            #   -> serverless-interpolated.yml 
                            #   -> serverless-compiled.yml
                            #   -> serverless.yml
  vars.json                 # your provider's name/domain/logo, as well as dev env opts
  src/                      # typescript code, some shell scripts
    *.ts
    scripts/                # command line scripts, and utils
    bot/                    # bot engine
    in-house-bot/           # currently co-located in-house-bot bot implementation
    test/
  lib/                      # transpiled JS code

Main Components

Below you'll find the description of the various architecture components that get created when the stack is deployed.

Core Tables

you'll typically see table names formatted per a combination of the serverless and tradle convention, tdl-[service]-ltd-[stage]-[name] e.g. the events table is tdl-tradle-ltd-dev-events on the dev stage

  • events: immutable master log
  • bucket-0: mutable data store for data, seals, sessions, etc.

Buckets

  • ObjectsBucket: stores the payloads of all messages sent/received to/from users, as well as objects created by business logic, e.g. tradle.Application (to track application state)
  • SecretsBucket: if I told you, I'd have to kill you. It stores the private keys for your MyCloud's identity.
  • PrivateConfBucket: public/private configuration like: identity, styles, and bot plugin configuration files
  • FileUploadBucket: because Lambda and IoT message-size limits, any media embedded in objects sent by users is first uploaded here
  • LogsBucket: exactly what you think
  • ServerlessDeploymentBucket: stores past and current MyCloud deployment packages

Functions

Note: subject to change as lambdas are split out or collapsed together

  • jobScheduler: lambda that fans out scheduled tasks (e.g. warming up other lambda containers, retrying failed deliveries, sending pending transactions to the blockchain, polling the blockchain for confirmations, etc.)
  • genericJobRunner: lambda that executes tasks fanned out by jobScheduler
  • preauth (HTTP): generates temporary credentials (STS) for new connections from users, attaches the IotClientRole to them, creates a new session in the presence table (still unauthenticated). Generates a challenge to be signed (verified in auth) *
  • auth (HTTP): verifies the challenge, marks the session as authenticated *
  • oniotlifecycle (IoT): manages the user's Iot session, attempts to deliver queued up messages depending on the user's announced send/receive position
  • inbox (HTTP): receives batches of inbound messages (typically from other MyClouds)
  • info (HTTP): gets the public information about this MyCloud - the identity, style, logo, country, currency, etc.
  • bot_oninit: initializes the MyCloud node - generates an identity and keys, saves secrets and default configuration files to respective buckets. Should really be named init or oninit, but good luck getting AWS to rename something.
  • onmessage: processes inbound messages, then hands off to synchronous business logic
  • onresourcestream: replicates changes to immutable events table, hands off to asynchronous business logic
  • graphql: your bot's built-in graphql API that supports existing Tradle models and custom ones you add.
  • cli: command line lambda used for various admin tasks

* Note: the purpose of authentication is to know whether to send the user queued up messages. Inbound messages don't require pre-authentication, as they are all signed and can be verified without the need for a session's context.

Network communication flow

  1. client (Tradle mobile/web app) calls /preauth (preauth lambda) and gets a temporary identity via AWS STS. It also gets a challenge to sign.
  2. client calls /auth with the signed challenge. At this point MyCloud deems it safe to send the client any queued up messages, and will start doing so.
  3. client subscribes to AWS Iot topics restricted to its temporary identity's namespace. This allows it to receive messages, acks and errors from MyCloud. MyCloud receives these Iot lifecycle events (connect, disconnect, subscribe) in Lambda, and updates the client's session information (iotlifecycle lambda).
  4. the client and MyCloud can send each other messages via AWS Iot.

Plugins

See ./docs/plugins.md

Email templates

Note: you don't need this unless you change the templates in in-house-bot/templates/raw

To prerender templates (primarily to inline css), run npm run prerender:templates

mycloud's People

Contributors

jacobgins avatar martinheidegger avatar mvayngrib avatar pgmemk avatar spwilko avatar urbien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mycloud's Issues

unmined ethereum transactions

transactions accepted by etherscan.io may not be mined at all, for various reasons, e.g. the gasLimit was set too high (recently experienced on rinkeby).

if after successful submission, on the next sync etherscan pretends amnesia, the seals need to be unqueued for syncUnconfirmed and re-queued for sealPending

cross-cloud comm

client-server comm uses MQTT. The client maintains short-term sessions and has a realtime duplex link to the server(less) provider.

for cloud-cloud comm, MQTT is probably not ideal, as it would require lambdas to establish MQTT sessions (get temporary credentials via STS, connect, and only then publish+subscribe), and lambdas are expensive.

some thoughts on alternatives:

high level: Use http, no sessions, sign every message, use recent (e.g. within last 10 mins) ethereum block hashes for nonces (to prove signature recency).

potential steps for reliable delivery:

  1. (optional) pull from counterparty's outbox: "give me messages queued up for me since message X"
  2. push to their inbox. Maybe wait for messages sent in response, maybe not, as lambdas are billed for waiting time.
  3. if steps 1 and/or 2 fail, deliver a notification via SNS/SQS a la "you've got mail". (SQS guarantees at-least-once delivery)

Applications need to have product specific information

Right now we have tradle.Application for all types of applications.
And when some application needs to show in its details some specific properties we add them to the application resource.

That is not very kosher. It would be better to

  • EITHER have the application specific to a product
  • OR tradle.Application can have some additional property say moreItems as a backlink and to add any additional information for application in it and allow the plugins to add them there. And then the application front end will display them as a part of Application Detail tab
    It could be something like that.
{
  id: 'tradle.Application',
  ...
  properties: {
    ....
    moreDetails: {      
       type: 'array'
       items: {
         ref: 'tradle.DetailItem',
         backlink: 'application'
       }
    }
  }
}
{
  id: 'tradle.DetailItem',
  ...
  properties: {
    application: {
      type: 'object',
      ref: 'tradle.Application'
    },
    propertyName: {      
       type: 'string'
    },
    propertyObjValue: {
       type: 'object'
       ...
    },
    propertyStringValue: {
       type: 'string'
    },
    propertyNumberValue: {
       type: 'number',
       numberFormat: {
         ...
       }
    },
   ...
  }
}

require, submodule style

currently there's a bit of a confusion on how submodules, e.g. lib/seals.js should require other submodules, e.g. lib/blockchain.js. One way is directly, and one way is through lib/index.js. Let's make up our minds

stack launch in AWS sub-account fails

Today I tried launching MyCloud using the Deployment product an organizational Account on a fresh AWS organization. It automatically rolled-back due to following error:

Date Logical Id Status Status Reason
2021-11-04 19:23:06 UTC+0900 LogAlertProcessorLambdaFunction CREATE_FAILED Resource handler returned message: "Specified ReservedConcurrentExecutions for function decreases account's UnreservedConcurrentExecution below its minimum value of [50]. (Service: Lambda, Status Code: 400, Request ID: f845592b-14ee-4f7b-a9ad-2f7d9e35c0ce, Extended Request ID: null)" (RequestToken: f63f6637-84db-91c5-3f0b-98be514a2b76, HandlerErrorCode: InvalidRequest)
2021-11-04 19:23:06 UTC+0900 LogProcessorLambdaFunction CREATE_FAILED Resource handler returned message: "Specified ReservedConcurrentExecutions for function decreases account's UnreservedConcurrentExecution below its minimum value of [50]. (Service: Lambda, Status Code: 400, Request ID: d2f4dd52-261c-4743-9d3c-dd45eb019b49, Extended Request ID: null)" (RequestToken: e36f43e2-16bc-2a97-8fc9-43cf506bd2ca, HandlerErrorCode: InvalidRequest)
Preceding log statements
Date Logical Id Status Status Reason
2021-11-04 19:23:06 UTC+0900 OniotlifecycleLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:06 UTC+0900 JobSchedulerLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:06 UTC+0900 AuthLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:06 UTC+0900 CliLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:06 UTC+0900 DeploymentPingbackLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:05 UTC+0900 InboxLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:05 UTC+0900 PreauthLambdaFunction CREATE_COMPLETE -
2021-11-04 19:23:03 UTC+0900 OnfidoLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:02 UTC+0900 SetconfLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:02 UTC+0900 LogProcessorLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:02 UTC+0900 OnresourcestreamLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:02 UTC+0900 ConfirmationLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 DocumentCheckerLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 GenericJobRunnerLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 JobSchedulerLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 GraphqlLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 OniotlifecycleLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 InfoLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 BotUnderscoreoninitLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 LogAlertProcessorLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 ImportUnderscoredataUnderscoreutilsLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:01 UTC+0900 OnmessageLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:00 UTC+0900 DeploymentPingbackLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:00 UTC+0900 PreauthLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:00 UTC+0900 InboxLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:00 UTC+0900 CliLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:23:00 UTC+0900 AuthLambdaFunction CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:22:59 UTC+0900 ConfirmationLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 OnresourcestreamLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 LogProcessorLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 OniotlifecycleLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 OnmessageLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 OnfidoLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 InfoLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 JobSchedulerLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 SetconfLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 GenericJobRunnerLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 GraphqlLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 BotUnderscoreoninitLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 DocumentCheckerLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 ImportUnderscoredataUnderscoreutilsLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 LogAlertProcessorLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 DeploymentPingbackLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:59 UTC+0900 PreauthLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:58 UTC+0900 CliLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:58 UTC+0900 InboxLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:58 UTC+0900 AuthLambdaFunction CREATE_IN_PROGRESS -
2021-11-04 19:22:53 UTC+0900 IamRoleLambdaExecution CREATE_COMPLETE -
2021-11-04 19:22:29 UTC+0900 IamRoleLambdaExecution CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:22:28 UTC+0900 IamRoleLambdaExecution CREATE_IN_PROGRESS -
2021-11-04 19:22:23 UTC+0900 IAM CREATE_COMPLETE -
2021-11-04 19:21:58 UTC+0900 RefData CREATE_COMPLETE -
2021-11-04 19:21:43 UTC+0900 Tables CREATE_COMPLETE -
2021-11-04 19:21:36 UTC+0900 RefData CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:21:36 UTC+0900 IAM CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:21:35 UTC+0900 RefData CREATE_IN_PROGRESS -
2021-11-04 19:21:35 UTC+0900 IAM CREATE_IN_PROGRESS -
2021-11-04 19:21:30 UTC+0900 Buckets CREATE_COMPLETE -
2021-11-04 19:20:56 UTC+0900 Buckets CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:20:56 UTC+0900 Tables CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:20:55 UTC+0900 Buckets CREATE_IN_PROGRESS -
2021-11-04 19:20:55 UTC+0900 Tables CREATE_IN_PROGRESS -
2021-11-04 19:20:51 UTC+0900 Keys CREATE_COMPLETE -
2021-11-04 19:18:06 UTC+0900 Discovery CREATE_COMPLETE -
2021-11-04 19:17:40 UTC+0900 ApiGatewayMethodOnfidoOptions CREATE_COMPLETE -
2021-11-04 19:17:40 UTC+0900 ApiGatewayMethodGraphqlOptions CREATE_COMPLETE -
2021-11-04 19:17:40 UTC+0900 ApiGatewayMethodInfoOptions CREATE_COMPLETE -
2021-11-04 19:17:39 UTC+0900 ApiGatewayMethodOnfidoOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:39 UTC+0900 ApiGatewayMethodPreauthOptions CREATE_COMPLETE -
2021-11-04 19:17:39 UTC+0900 ApiGatewayMethodGraphqlOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:39 UTC+0900 ApiGatewayMethodInfoOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:39 UTC+0900 ApiGatewayMethodOnfidoOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:39 UTC+0900 ApiGatewayMethodInfoOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:38 UTC+0900 ApiGatewayMethodPreauthOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:38 UTC+0900 ApiGatewayMethodGraphqlOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:38 UTC+0900 ApiGatewayMethodConfirmationOptions CREATE_COMPLETE -
2021-11-04 19:17:38 UTC+0900 ApiGatewayMethodPreauthOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:37 UTC+0900 ApiGatewayMethodConfirmationOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:37 UTC+0900 ApiGatewayMethodConfirmationOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:34 UTC+0900 ApiGatewayResourceOnfido CREATE_COMPLETE -
2021-11-04 19:17:34 UTC+0900 ApiGatewayResourceInfo CREATE_COMPLETE -
2021-11-04 19:17:34 UTC+0900 ApiGatewayResourceOnfido CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:34 UTC+0900 ApiGatewayResourceInfo CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:34 UTC+0900 ApiGatewayResourcePreauth CREATE_COMPLETE -
2021-11-04 19:17:33 UTC+0900 ApiGatewayResourceGraphql CREATE_COMPLETE -
2021-11-04 19:17:33 UTC+0900 ApiGatewayResourcePreauth CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:33 UTC+0900 ApiGatewayResourceGraphql CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:33 UTC+0900 ApiGatewayResourceConfirmation CREATE_COMPLETE -
2021-11-04 19:17:32 UTC+0900 ApiGatewayResourceConfirmation CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:27 UTC+0900 ApiGatewayMethodInboxOptions CREATE_COMPLETE -
2021-11-04 19:17:27 UTC+0900 ApiGatewayMethodDeploymentpingbackOptions CREATE_COMPLETE -
2021-11-04 19:17:27 UTC+0900 ApiGatewayMethodAuthOptions CREATE_COMPLETE -
2021-11-04 19:17:26 UTC+0900 ApiGatewayMethodInboxOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:26 UTC+0900 ApiGatewayMethodDeploymentpingbackOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:26 UTC+0900 ApiGatewayMethodAuthOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:26 UTC+0900 ApiGatewayMethodInboxOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:25 UTC+0900 ApiGatewayMethodDocumentcheckerOptions CREATE_COMPLETE -
2021-11-04 19:17:25 UTC+0900 ApiGatewayMethodDeploymentpingbackOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:25 UTC+0900 ApiGatewayMethodAuthOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:24 UTC+0900 ApiGatewayMethodDocumentcheckerOptions CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:24 UTC+0900 ApiGatewayMethodDocumentcheckerOptions CREATE_IN_PROGRESS -
2021-11-04 19:17:21 UTC+0900 ApiGatewayResourceInbox CREATE_COMPLETE -
2021-11-04 19:17:21 UTC+0900 ApiGatewayResourceDeploymentpingback CREATE_COMPLETE -
2021-11-04 19:17:20 UTC+0900 ApiGatewayResourceAuth CREATE_COMPLETE -
2021-11-04 19:17:20 UTC+0900 ApiGatewayResourceDeploymentpingback CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:20 UTC+0900 ApiGatewayResourceInbox CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:20 UTC+0900 ApiGatewayResourceDocumentchecker CREATE_COMPLETE -
2021-11-04 19:17:20 UTC+0900 ApiGatewayResourceAuth CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:19 UTC+0900 ApiGatewayResourceDocumentchecker CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:19 UTC+0900 ServerlessDeploymentBucket CREATE_COMPLETE -
2021-11-04 19:17:18 UTC+0900 Keys CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:18 UTC+0900 Discovery CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:18 UTC+0900 ApiGatewayResourceInfo CREATE_IN_PROGRESS -
2021-11-04 19:17:18 UTC+0900 ApiGatewayResourcePreauth CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceOnfido CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 Keys CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceAuth CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceDocumentchecker CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceDeploymentpingback CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceGraphql CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceInbox CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 ApiGatewayResourceConfirmation CREATE_IN_PROGRESS -
2021-11-04 19:17:17 UTC+0900 Discovery CREATE_IN_PROGRESS -
2021-11-04 19:17:13 UTC+0900 Source CREATE_COMPLETE -
2021-11-04 19:17:11 UTC+0900 PreauthLogGroup CREATE_COMPLETE -
2021-11-04 19:17:11 UTC+0900 ConfirmationLogGroup CREATE_COMPLETE -
2021-11-04 19:17:11 UTC+0900 PreauthLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:11 UTC+0900 DocumentCheckerLogGroup CREATE_COMPLETE -
2021-11-04 19:17:10 UTC+0900 OniotlifecycleLogGroup CREATE_COMPLETE -
2021-11-04 19:17:10 UTC+0900 InboxLogGroup CREATE_COMPLETE -
2021-11-04 19:17:10 UTC+0900 ConfirmationLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:10 UTC+0900 DocumentCheckerLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:10 UTC+0900 InboxLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:10 UTC+0900 OniotlifecycleLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:07 UTC+0900 AwsAlertsAlarm CREATE_COMPLETE -
2021-11-04 19:17:02 UTC+0900 Source CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:17:01 UTC+0900 Source CREATE_IN_PROGRESS -
2021-11-04 19:16:59 UTC+0900 JobSchedulerLogGroup CREATE_COMPLETE -
2021-11-04 19:16:59 UTC+0900 LogAlertProcessorLogGroup CREATE_COMPLETE -
2021-11-04 19:16:59 UTC+0900 JobSchedulerLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 DeploymentPingbackLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 GraphqlLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 AuthLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 LogAlertProcessorLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 OnmessageLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 SetconfLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 OnfidoLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 OnresourcestreamLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 DeploymentPingbackLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 InfoLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 BotUnderscoreoninitLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 LogProcessorLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 GraphqlLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 AuthLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 CliLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 SetconfLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 ImportUnderscoredataUnderscoreutilsLogGroup CREATE_COMPLETE -
2021-11-04 19:16:58 UTC+0900 OnfidoLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 OnmessageLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:58 UTC+0900 OnresourcestreamLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 BotUnderscoreoninitLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 InfoLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 GenericJobRunnerLogGroup CREATE_COMPLETE -
2021-11-04 19:16:57 UTC+0900 LogProcessorLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 CliLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 ImportUnderscoredataUnderscoreutilsLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 ServerlessDeploymentBucket CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 GenericJobRunnerLogGroup CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:57 UTC+0900 ApiGatewayRestApi CREATE_COMPLETE -
2021-11-04 19:16:56 UTC+0900 ApiGatewayRestApi CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:56 UTC+0900 AwsAlertsAlarm CREATE_IN_PROGRESS Resource creation Initiated
2021-11-04 19:16:56 UTC+0900 OniotlifecycleLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:56 UTC+0900 GraphqlLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:56 UTC+0900 AuthLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 ServerlessDeploymentBucket CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 InboxLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 BotUnderscoreoninitLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 PreauthLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 ConfirmationLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 JobSchedulerLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 OnresourcestreamLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 ImportUnderscoredataUnderscoreutilsLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 InfoLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 SetconfLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 OnfidoLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 DocumentCheckerLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 OnmessageLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 LogProcessorLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 AwsAlertsAlarm CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 LogAlertProcessorLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 GenericJobRunnerLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 CliLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 DeploymentPingbackLogGroup CREATE_IN_PROGRESS -
2021-11-04 19:16:55 UTC+0900 ApiGatewayRestApi CREATE_IN_PROGRESS -
2021-11-04 19:16:44 UTC+0900 tdl tradle ltd-dev CREATE_IN_PROGRESS User Initiated

graphql endpoint security

all requests should be signed with employee credentials, with a provably recent nonce (recent ethereum block hash)

[integrations] prefills are in conflict with delaying API / datalake query

Problem

We have implemented two universal mechanisms for delaying requests in plugins to primary data sources.

  1. for API requests
  2. for data lake requests via AWS Athena, because they are slow and can't work in real time

But this does not work for plugins that need to send prefilled data to the the user.
What to do?

Possible solution

  1. Send the message to the user saying there is a delay, asking them to wait and pause the next e-policy question
  2. When delayed job executes successfully, send prefil to the user and restart the e-policy questions.

@pgmemk, let's disucss as JG will need your help to implement this.

cors + binary

  • use aws-serverless-express for all http endpoints
  • don't waste a lambda invocation on OPTIONS requests. Learn from aws-serverless-express/example, with OPTIONS contentHandling set to CONVERT_TO_TEXT

more on attestations

  • Attestation request sent to senior management should be done before the parent application is submitted and all the senior management onboarded.
  • Maybe it should be done when the application gets approved OR auto-approved.
  • After Attestation requests are sent the application should be sealed
  • Attestation itself can be only sent once
  • If attestation has rejections the admin that was filling out the application should be notified about it.
    • It can be done as a FormError request for the rejected forms or just as a message to fix the forms with the links to those forms
    • The application then can be unsealed if the admin has corrections to be made and request for Attestations re-send or CheckOverride could be created

Things to consider:

  • If some Senior managers rejected one form and others didn't. Does it need corrections or notifications from the admin or we can have some formula per form that says
    • if 2 out of 3 senior managers accepted the forms then the application can be approved.

error running installing dependencies

hello, when i run "npm install" i get this error. please help!

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it!
npm WARN deprecated [email protected]: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated [email protected]: Old versions of Formidable are not compatible with the current Node.js; Upgrade to 1.2.0 or later
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git://github.com/tradle/centrix.git
npm ERR!
npm ERR! fatal: remote error:
npm ERR! Repository not found.
npm ERR!
npm ERR! exited with error code: 128

adding tags to test myclouds

All AWS services are being monitored by Vanta for SOC2 compliance.
To prevent them affecting our level of compliance I am either adding this tag to the resource VantaNonProd=true, or I am removing from scope in Vanta. Both are an extra admin task.

If we could tag test or development myclouds when they are launched and add those tags to the services created, this would help with SOC2 management and also help identify resources which can be removed.

Could MyCloudConfiguration product have some additional tag key and value pairs?
The tags would also need adding to the S3, lambda and dynamoDB resources created

Update Node version

AWS Lamdba needs to run on newer node version. Mycloud needs to be tested for that.

Create Interface for plugins to compile against.

Currently plugins are written in typescript. To compile the plugins independently of mycloud and use the dynamic loading of plugins to add them, we need to prepare an interface (proposed name: mycloud-plugin-api) that allows an independent compilations of the plugins.

For a proper implementation the same interface needs to be use by mycloud and the plugin interfaces as discrepancies in the use will cause hard-to-debug runtime problems. That being said, for the start it is possible (though to some degree inadvisable!) to release a stub that contains only the minimal necessary functions for plugins to be extracted without having the entire API replicated in the API.

Move plugin conditions from code into plugin metadata

The current plugin mechanism utilizes conditionals like if (handleMessages) to determine which plugins need to be loaded and which do not.

Example:

if (ONFIDO_RELATED_EVENTS.includes(event) && plugins.onfido && plugins.onfido.apiKey) {
attachPlugin({ name: 'onfido' })
}

This makes two things difficult.

  1. When modifying a plugin we can not easily see under which conditions the plugin is executed.
  2. It is difficult to determine before the plugins get loaded which plugins will be necessary for certain event. This is of note as we want to load plugins dynamically and need to know this in advance, without the plugins themselves being loaded.

To change this I am planning to turn current conditional plugin loading into a meta-data that can be evaluated non-sequentially). For example, this:

if (
handleMessages ||
runAsyncHandlers ||
event.startsWith('deployment:') ||
event === LambdaEvents.COMMAND ||
event === LambdaEvents.SCHEDULER
) {
attachPlugin({ name: 'deployment', requiresConf: false })

would be turned into configuration like below:

{
  name: 'deployment',
  visible: true, // To show the plugin in the tradle plugins dialog
  requiresConf: false, // Configuration required for the plugin to be loaded
  hooks: [{
    condition: { isTradle: true }, // we put currently distributed "conditions" into a single object
    events: [
      'message', // on every event of type 'message'
      'resourcestream',
      'deployment:*', // to support .startsWith(...) we need to support patterns
      'command',
      'scheduler'
    ]
  }]
}

This data format externally defined plugins can provide this data-structure as part of the package.json.

optimizing to reduce AWS costs

Problem

We need to further reduce the costs of running a stack in AWS. As we do that we need to learn about similar services in Azure and GCP.
In fact a good approach would be to create equivalent Terraform (or CDK) resources so that we build an equivalent to Cloudformation for Azure and GCP as we review and improve our AWS setup.

Importance

When a bank is running MyCloud the costs are already negligible but for their SME client this cost could present a barrier to entry.

Details

  1. The bulk of current costs is EC2 which we use for running 3rd party code in Docker containers managed by ECS. We need to continue our migration to Docker in Lambda, at least for the facematching and liveness detection services.
  2. 15% Cloudwatch - if I recall correctly we have one hour time to live (TTL) for log events in Cloudwatch before we move the data to S3. Perhaps this period can be 10 min, but we need to account for any possible outage in S3 so that we do not loose any logs.
  3. 10% S3 - each cloud still generates a massive amount of logs, one for each service each minute. Do we have a TTL for the logs in S3? If not, this could be added. Also, we can migrate logs in s3 to a cheaper storage tier - AWS allows that automatically.
  4. 5% Lambda - the bulk of our costs here are for warming up Lambdas, see @spwilko's comment on issue #26. As an alternative, we need to review the costs of reserved capacity for Lambdas that AWS offers now. We also need to review why we send warm up requests so often that we reach over 50 concurrent requests. Perhaps we can reduce the rate there and, also, perhaps not all Lambdas need the same rate of warm up.

@martinheidegger, please work with @spwilko to analyze the costs and prioritize based on cost reduction.

resolving simultaneous edits to resources

e.g. to Application

  1. a customer submits a form - application gets updated
  2. a relationship manager is assigned to an application - application gets updated

currently, one change will overwrite the other

Limit plugins to use interfaces only

For plugins to work well loaded dynamically, the definition of createPlugin needs to be put into a separate dependency (@tradle/plugin ?) that contains only the interfaces and is used as an intermediate between the plugins loaded and mycloud.

export type CreatePlugin<BotComponent> = (components:IBotComponents, opts:IPluginOpts) => IPluginExports<BotComponent>

Additionally, current plugins freely access a variety of sources. External dependencies such as @tradle/constants are okay but internal dependencies, such as in the examples below, will make it impossible to move the plugins outside of this repository. These need to be changed into either external dependencies or inlined into the plugin.

[research] multicloud support

Problem

Our current toolchain for Infrastructure as Code (IaC) is serverless-framework.
Serverless is not ideal and we have been struggling with it for years. We have also created a number of forks and are sitting on an older version of serverless framework.
As we begin our research for adding multicloud support (adding Azure and Google Cloud and its own native Linux environment for Cloudpal), we should consider Terraform, which seems to have become more popular than serverless-framework.

Things to consider

Initial migration from serverless yml to Terraform HCL language (they also support json, should we choose to use it) can probably be automated. See for starters:
https://stackoverflow.com/questions/60905099/best-way-to-convert-cloudformation-serverless-template-into-terraform

Converting multi-template serverless into Terraform

We use multiple interconnected yml templates, so need to figure out how to import multi-template serverless info Terraform format

Use open source Terraform modules

Modules group complex resources and there is a ton of open source modules. Let's not reinvent the wheel. Specific example: could use it for Lambda in VPC, see for starters:
https://transcend.io/blog/opinion-a-case-for-using-terraform-open-source
Other potential use case for TF modules Is adding the Application Firewall.

Migrate customer resources

we have a number of functions performed by so called custom resources in serverless-framework. Need to map them to Terraform.

Redo imported terraform for ease of maintenance and best practices

Good best practices talk:
https://youtu.be/WkPIrfW7JWA

Build for multi-cloud

Here is one example how to do it, perhaps on the higher complexity side:
https://www.silect.is/blog/multi-cloud-vpn-terraform/

Localstack

We use serverless in conjunction with localstack for development on dev machines with full AWS simulation (only for the services we use). We will need to research how this will work with Terraform for example, see this for starters:
https://dev.to/mrwormhole/localstack-with-terraform-and-docker-for-running-aws-locally-3a6d

Alternatives to Terraform

Terraform may be a leader in declarative IaC, but a new movement has emerged, where IaC is defined in a imperative language like Typescript.
Examples are:

  1. CDK for Cloudformation - product by AWS, supports half a dozen languages
  2. CDK for Terraform - also supports half a dozen languages
    see this talk: https://youtu.be/7h8UXqPoOcY
    Perhaps for the multi-cloud configs CDK could be easier to manage than the declarative HCL
  3. Pulumi
  4. SST

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.