Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRS-291-1: Convert A&R to use SAM #346

Merged
merged 16 commits into from
Jul 16, 2024
Merged

Conversation

davidclaveau
Copy link
Collaborator

Jira Ticket:

BRS-291
BRS-322
BRS-323
BRS-342
BRS-343

Jira Ticket URL:

#291
#322
#323
#342
#343

Description:

Credentials in env.js to hit the Tools API from a local setup:

window.__env.API_LOCATION = 'https://r9f4ib8x0m.execute-api.ca-central-1.amazonaws.com';
window.__env.API_PATH = '/dev';
window.__env.API_PUBLIC_PATH = '/dev';

# 291 - Move A&R to use SAM

  • A complete overhaul of the deployment strategy of BC Parks Attendance & Revenue API to use AWS's Serverless Application Model (SAM).

  • This includes migrating the functions into their equivalent SAM functions, changing util functions into applicable layers, converting/reintegrating tests to use SAM, and removing any Terraform legacy code

  • uses an Authorizer (authorizer/index.js) to process the JWT from Keycloak and create the necessary IAM roles for each function

  • sets up the API in API Gateway using the Authorizer

  • creates a new ParksAr, ConfigAr, and NameCacheAr tables in DynamoDB

  • create a new S3 bucket for export assets

  • dependent on additional tickets (322, 323, 342, 343)

# 322 - Update Functions

  • builds the Lambda functions using SAM, update dependency and other import paths, add respective package.json files for each Lambda's required dependencies
  • configure roles/permissions to be expected from the event, as they are now decoded in the Authorizer
  • fixes to export and variance export and their invokables - now use v3 SDK and properly upload to the S3 bucket
    • VarianceExportGetFunction altered slightly to more closely resemble ExportGetFunction (was easier to debug during update).

# 323 - Create Layers

  • create any necessary layers from the utils files
    • merge the logger, sendResponse, and the dynamoUtils file into a BaseLayer file to circumvent the five-layer restriction set by AWS
  • add Makefiles to build layers

# 342 - Convert Tests

  • Remove old tests files and directories and convert/integrate them to use the SAM configuration
    • roles come from the event so roles/permissions are allocated in the headers of the tests
  • update Postman environment paths (will need updating once fully built in dev/test/prod), fix a few typos and tests
  • update READMEs accordingly to reflect changes

# 343 - Cleanup Terraform and non-SAM Code

  • updates the .github/wokflows deploy actions to build and deploy the SAM files in each AWS environment
  • pull out all Terraform deployment files and strategies
  • update the READMEs to reflect the new start up procedures for local startup, AWS deployment, etc.

@davidclaveau
Copy link
Collaborator Author

Remade PR after the previous one was accidentally merged and reverted here: #344

Copy link
Contributor

@cameronpettit cameronpettit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full send

@davidclaveau davidclaveau merged commit 475ae2e into bcgov:main Jul 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants