diff --git a/README.md b/README.md index 3069531e..d6d4bfba 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,33 @@ npm run dev Access the app in a browser at: https://USER_PREFIX.dev.rdc.library.northwestern.edu:3003/ +## Running the API locally with State Machine + lambdas (needed for AV download route) + +From the `dc-api-v2` root directory: + +- Make sure you've done an `npm install` recently to update any packages in the `lambdas` directory +- Run `bin/startwi` + +```shell +# From the repo root +cd dc-api-v2 + +# Start the proxy (if needed) +https-proxy start 3002 3000 + +# Login as the staging-admin user +export AWS_PROFILE=staging-admin +aws sso login + +# Start the API + step function and associated lambdas +bin/start-with-step + +# Open a second terminal and create the state machine +aws stepfunctions create-state-machine --endpoint http://localhost:8083 --definition file://state_machines/av_download.json --name "hlsStitcherStepFunction" --role-arn arn:aws:iam::012345678901:role/DummyRole +``` + + + ## Deploying the API manually - Symlink the `*.parameters` file you need from `tfvars/dc-api/` to the application root diff --git a/bin/start-with-step b/bin/start-with-step index b4e6ec07..24976658 100755 --- a/bin/start-with-step +++ b/bin/start-with-step @@ -1,6 +1,6 @@ #!/bin/bash -sam local start-lambda --host 0.0.0.0 --port 3003 --env-vars env.json --log-file lambda.log & lambda_pid=$! +sam local start-lambda --host 0.0.0.0 --port 3005 --env-vars env.json --log-file lambda.log & lambda_pid=$! sam local start-api --host 0.0.0.0 --log-file dc-api.log & api_pid=$! -docker run --rm -p 8083:8083 -e LAMBDA_ENDPOINT=http://172.17.0.1:3003/ amazon/aws-stepfunctions-local +docker run --rm -p 8083:8083 -e LAMBDA_ENDPOINT=http://172.17.0.1:3005/ amazon/aws-stepfunctions-local kill $api_pid $lambda_pid diff --git a/lambdas/package-lock.json b/lambdas/package-lock.json index 90dbf8a0..a9989435 100644 --- a/lambdas/package-lock.json +++ b/lambdas/package-lock.json @@ -1,13 +1,13 @@ { - "name": "lambda", + "name": "lambdas", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "lambda", + "name": "lambdas", "version": "1.0.0", - "license": "ISC", + "license": "Apache-2.0", "devDependencies": { "@aws-sdk/client-mediaconvert": "^3.410.0", "@aws-sdk/client-s3": "^3.410.0", diff --git a/package.json b/package.json index 1914ae76..ed9d1a8d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "scripts": { "lint": "eslint src/**/*.js test/**/*.js", - "preinstall": "cd src && npm i && cd -", + "preinstall": "cd src && npm i && cd ../lambdas && npm i && cd ../", "prettier": "prettier -c src test", "prettier:fix": "prettier -cw src test", "test": "mocha",