0.2.11 • Published 1 year ago

timeld-gateway v0.2.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

stability-wip

timeld Gateway

The timeld Gateway is a service to manage timeld accounts and persist timesheets safely. It can be deployed and scaled easily on a cloud platform.

Fly.io Deployment Notes

app

Decide your app name.

flyctl apps create timeld

If developing off the main branch, the deploy script (below) will use your current branch name as a suffix; in preparation you should run the above command with the suffixed name e.g. timeld-edge.

volumes

A volume is required for clone persistence (Gateway and Timesheet domains).

NB: The -a parameter must match your app name.

flyctl volumes create timeld_data --region lhr -a timeld

NB: "A volume is directly associated with only one app and exists in only one region."

Each instance of an app must have dedicated storage. So we can either:

  • set fly scale ... --max-per-region=1 (limits scaling), or
  • create a directory under /data per allocation ID – (creates a garbage collection problem with rolling redeploy)

secrets

flyctl secrets import < .env -a timeld

Where the .env file contains:

  • TIMELD_GATEWAY_ABLY__KEY={your root ably key}
  • TIMELD_GATEWAY_ABLY__API_KEY={your ably control API key}
  • TIMELD_GATEWAY_COURIER__AUTHORIZATION_TOKEN={your courier auth token}
  • TIMELD_GATEWAY_COURIER__ACTIVATION_TEMPLATE={courier activation email template ID}

deploy

NB: If you have made any changes to timeld-common, it needs to be published first.

A script is provided to generate, and optionally run, the correct deploy command.

chmod +x deploy.sh
./deploy.sh

deploy.sh takes three optional arguments: 1. app name (root); defaults to timeld 2. app name suffix; defaults to git branch name e.g. timeld-edge. If main, no suffix is used, i.e. just timeld. 3. genesis (if used, the 1st two arguments must also be given)

The first deployment of a new Gateway must be started with the genesis flag.

random

  • engines.node is set to 16.x in package.json due to a bug in Restify.
  • simple-peer is a dependency even if we don't use WebRTC (a bug in m-ld-js/ext/ably).