vini-vici / front-end

2 stars 0 forks source link

wip: Adds in rough stack for vicci deployments #15

Closed jhechtf closed 3 years ago

jhechtf commented 3 years ago

These changes are the backbone of getting us to use AWS Cognito. They Cognito user pool will be added to the stack at another time, as I am currently testing how to use it generally, let alone through the Cognito generated by the CDK.

Closes #14

jhechtf commented 3 years ago

I will attempt to get an image up that shows the rough architecture for you. I'm basically aiming for a CDN to deliver the HTML / CSS / JS from Amazon S3

jhechtf commented 3 years ago

@VincentLeighton

Attached is a rough draft of the architecture that will be used to use the items in a live environment.

Vicci Diagram

This is a very simplified view, as the deployment to the S3 bucket will also tell the CloudFront distribution to invalidate any caches so that the new code will be grabbed by users the next time they view the website, but that's hard to denote in the diagram.

The services that will be used are

  1. AWS Cognito - a user API as a service.
  2. AWS CloudFront - Content distribution service
  3. AWS S3 - data storage
  4. AWS IAM (for role execution and stack deployment in GitHub actions)
  5. AppConfig - Hosted Application Configuration, can be used to rollout features or updates independent of a regular pipeline push (much more advanced use case). For us will simply be a way to collect information about the cognito domain + a perhaps eventual api url.
jhechtf commented 3 years ago

Most recent changes successfully create the necessary Cognito resources, as well as populate an AppConfig profile with the necessary information to connect to it in deployment.

Now thinking about what our useCognito hooks needs to do, if it needs to do anything at all. much of the work is already handled in the hook we use here.

An attempt to pull out functions from the Auth object to return them from the hook hasn't worked so far.

It might be possible that the useCognito hook only needs to be called once in the main app, since currently it dispatches events to the redux store. We may be able to re-do this so that it gets passed the dispatch function. This would possible allow us to test the code via unit tests (and some planned integ tests).

jhechtf commented 3 years ago

Latest commit adds in cognito support and does some reorganization.

This got scope creeped by a lot