oneday-webapp-platform

This app exists to house the client for interacting with the v2 OneDay platform. By leveraging serverless component architecture and modern client-side frameworks (react/redux/etc), our goal is to deliver a cohesive single-pane-of-glass for OneDay users,

Usage no npm install needed!

<script type="module">
  import onedayWebappPlatform from 'https://cdn.skypack.dev/oneday-webapp-platform';
</script>

README

One Day Webapp Platform

This app exists to house the client for interacting with the v2 OneDay platform. By leveraging serverless component architecture and modern client-side frameworks (react/redux/etc), our goal is to deliver a cohesive single-pane-of-glass for OneDay users, clients and admins to manage their tasks.

All webapp code resides within the webapp directory. For more information on setting up a local development environment, please consult the README file found there.

Assumptions

From a development/deployment standpoint, we make the following assumptions:

  • node ~v12.0 is installed on this machine
  • serverless cli has been installed.
  • the installing user is a member of onedayhq, and authenticated providing access to these private npm libraries
  • aws cli access to the oneday accounts
  • Additionally - you will need to have set up ~/.aws/config profiles for od-dev and od-prod for dev and prod deployment respectively. Please contact a oneday-engineering team member for help setting this up.

Deployment

  1. Install
  2. Deploy
  3. Notes

1. Install

Install the Serverless Framework:

$ npm i -g serverless

Ensure you have both named AWS config values for both od-dev and od-prod, saved at ~/.aws/credentials (speak to a team member about getting these IAM credentials).

[od-dev]
aws_access_key_id=SOMEKEY
aws_secret_access_key=SOMESECRET

[od-prod]
aws_access_key_id=SOMEOTHERKEY
aws_secret_access_key=SOMEOTHERSECRET

Or, you can set these as environment variables manually before deploying.

Install the NPM dependencies in the front-end dashboard directory:

$ npm i

Please note that while these Serverless Components set up almost everything for you with a single command, if you want to set up a custom domain, you MUST purchase it in your AWS account manually via Route 53. We have not yet automated domain registration. After registering it, you may have to wait a few minutes for registration to complete before you can use it.

2. Deploy

Deploy via the sls or serverless command. Valid --envs are staging and dev:

  • Ensure you have an AWS_PROFILE env variable configured for your desired env

    • EG: export AWS_PROFILE=od-dev
  • Run deployment command, either direct from serverless or via makefile (which also sets the env variable)

    $ make deploy-<env>
    

    OR

    $ AWS_PROFILE=od-<env> sls --env=<env> --debug
    

Use the --debug flag if you'd like to learn what's happening behind the scenes:

$ serverless --debug

If you wish to remove a deployment - simply use the sls remove command. Valid --envs are staging and dev:

$ sls remove --env=<env>

Development and testing

As a convenience, we've set up makefiles for both our root and webapp project. You can either run the npm scripts there, or run make dev or make test to run either respective commands in the root project or from the webapp subfolder

3. Notes

Remember, once you deploy with a custom domain for the first time, it may take up to an hour for DNS servers to propagate that change. Meaning, your API and front-end won't be immediately available after first deployment.

New to Components?

Checkout the Serverless Components repo for more information.