1.0.0 • Published 6 years ago

begin-functions v1.0.0

Weekly downloads
3
License
-
Repository
-
Last release
6 years ago

Codeship Status for smallwins/fun

Setup

Preview locally using the staging database tables:

  1. Copy .arc-env-example to .arc-env and get the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET values from Brian
  2. Install deps by running npm run init
  3. Start a reloading dev server npm start

Dev

Lint the code

npm run lint

Run the tests

npm t

Deploy one lambda to staging

npm run deploy src/html/get-index

Deploy static assets to staging

npm run deploy static

CI

Green builds ship everything to staging

important limits

aws infraapps
60 api gateway restapis per region per accountmeans we can have max 30 apps per region
15 total availability zones15 zones x 30 apps === 450 apps per account
1000 iam roles per accounteach app requires 1 iam role; still within 450
AWS Orgs lets us create 300 accounts450x300 === 13500 max possible apps with default limits

takes about 2 minutes to provision one app which means at the current limits it will take 9.375 days to get to max capacity

api gateway operational limitsper min
DeleteRestApi2 per min
CreateDeployment3 per min
GetResources150 per min
CreateResource300 per min
DeleteResource300 per min

Total operations 10 request per second (rps) with a burst limit of 40 requests

deletes are ok because we can queue those by removing from app in the db and adding to a whatever-delete table that has a lambda running on a timer cleaning it out. creates/gets: need to be throttled, ui updated with pending state and resolved with completion and/or timeout. ideally via queue to its global to the system/account.

global infra

Each app is a preprovisioned arc app with:

  • staging.app-name-0x1.fun.begin.com
  • app-name-0x1.fun.begin.com

Static assets are also hosted via two cloudfront distributions:

  • static.fun.begin.com/appname
  • staging.static.fun.begin.com/appname

Once setup:

  • Commits to master deploy to staging.app-name-0x1.fun.begin.com (if the build is green)
  • Tags (Github releases) deploy to app-name-0x1.fun.begin.com (if the build is green)
  • You can also initiate a release from the web ui
  • Apps with npm run build defined will be run; .static is uploaded to their folder only; max 5mb
  • Apps can add 3 HTML route Lambdas; max 5 mb ea
  • Apps can add 5 JSON route Lambdas; max 5 mb ea
  • HTML and JSON endpoints support sessions