@@ -5,27 +5,33 @@ ENV=dev
5
5
SHELL := /bin/bash
6
6
7
7
help :
8
- echo " make build | build the SAM project"
9
- echo " make serve | alias for serve-https"
10
- echo " make clean | remove all installed dependencies and build artifacts"
11
- echo " make deps | install all dependencies"
12
- echo " make link | create hard links to allow for hot reloading of a built project"
13
- echo " make secrets | symlink secrets files from ../tfvars"
14
- echo " make start-with-step | run the SAM server locally with step function & download lambdas"
15
- echo " make style | run all style checks"
16
- echo " make test | run all tests"
17
- echo " make cover | run all tests with coverage"
18
- echo " make env ENV=[env] | activate env.\$ $ENV .json file (default: dev)"
19
- echo " make deps-node | install node dependencies"
20
- echo " make deps-python | install python dependencies"
21
- echo " make serve-http | run the SAM server locally (HTTP on port 3000)"
22
- echo " make serve-https | run the SAM server locally (HTTPS on port 3002)"
23
- echo " make style-node | run node code style check"
24
- echo " make style-python | run python code style check"
25
- echo " make test-node | run node tests"
26
- echo " make test-python | run python tests"
27
- echo " make cover-node | run node tests with coverage"
28
- echo " make cover-python | run python tests with coverage"
8
+ echo " make build | build the SAM project"
9
+ echo " make serve | alias for serve-https"
10
+ echo " make clean | remove all installed dependencies and build artifacts"
11
+ echo " make deps | install all dependencies"
12
+ echo " make env.json | create an env.json file for the current user's environment"
13
+ echo " make link | create hard links to allow for hot reloading of a built project"
14
+ echo " make secrets | symlink secrets files from ../tfvars"
15
+ echo " make start-with-step | run the SAM server locally with step function & download lambdas"
16
+ echo " make style | run all style checks"
17
+ echo " make test | run all tests"
18
+ echo " make cover | run all tests with coverage"
19
+ echo " make env ENV=[env] | activate env.\$ $ENV .json file (default: dev)"
20
+ echo " make deps-node | install node dependencies"
21
+ echo " make deps-python | install python dependencies"
22
+ echo " make samconfig.NAME.yaml" | create a user samconfig file for the specified username"
23
+ echo " make build | build the SAM project for deploying"
24
+ echo " make deploy | deploy the SAM project to AWS"
25
+ echo " make sync | sync the SAM project to AWS for quick development"
26
+ echo " make sync-code | sync the SAM project to AWS (code changes only)"
27
+ echo " make serve-http | run the SAM server locally (HTTP on port 3000)"
28
+ echo " make serve-https | run the SAM server locally (HTTPS on port 3002)"
29
+ echo " make style-node | run node code style check"
30
+ echo " make style-python | run python code style check"
31
+ echo " make test-node | run node tests"
32
+ echo " make test-python | run python tests"
33
+ echo " make cover-node | run node tests with coverage"
34
+ echo " make cover-python | run python tests with coverage"
29
35
30
36
.aws-sam/build.toml : ./template.yaml api/package-lock.json api/src/package-lock.json chat/dependencies/requirements.txt chat/src/requirements.txt
31
37
sed -Ei.orig ' s/"dependencies"/"devDependencies"/' api/src/package.json
@@ -42,17 +48,18 @@ help:
42
48
done
43
49
mv api/src/package.json.orig api/src/package.json
44
50
mv api/src/package-lock.json.orig api/src/package-lock.json
45
- deps-node :
51
+ deps-api :
46
52
cd api/src ; \
47
53
npm list > /dev/null 2>&1 ; \
48
54
src_deps=$$? ; \
49
55
cd .. ; \
50
56
npm list > /dev/null 2>&1 ; \
51
57
dev_deps=$$? ; \
52
58
test $$ src_deps -eq 0 -a $$ dev_deps -eq 0 || npm ci
53
-
59
+ deps-av-download :
54
60
cd av-download/lambdas ; \
55
61
npm list > /dev/null 2>&1 || npm ci
62
+ deps-node : deps-api deps-av-download
56
63
cover-node : deps-node
57
64
cd api && npm run test:coverage
58
65
style-node : deps-node
@@ -76,7 +83,7 @@ python-version:
76
83
build :
77
84
bash -c " trap 'trap - SIGINT SIGTERM ERR; $( MAKE) reset; exit 1' SIGINT SIGTERM ERR; $( MAKE) .aws-sam/build.toml reset"
78
85
validate :
79
- cfn-lint template.yaml ** /template.yaml --ignore-checks E3510
86
+ cfn-lint template.yaml ** /template.yaml --ignore-checks E3510 W1028 W8001
80
87
serve-http : deps-node env.json
81
88
@printf ' \033[0;31mWARNING: Serving only the local HTTP API. The chat websocket API is not available in local mode.\033[0m\n'
82
89
rm -rf .aws-sam
@@ -87,12 +94,20 @@ serve: serve-https
87
94
start-with-step : deps-node env.json
88
95
sam local start-lambda -t av-download/template.yaml --host 0.0.0.0 --port 3005 --env-vars $$ PWD/env.json --log-file lambda.log & \
89
96
echo $$ ! > .sam-pids ; \
97
+ sg open all 3005 ; \
90
98
sam local start-api -t api/template.yaml --env-vars $$ PWD/env.json --host 0.0.0.0 --port 3002 --log-file dc-api.log \
91
99
--ssl-cert-file $$ HOME/.dev_cert/dev.rdc.cert.pem --ssl-key-file $$ HOME/.dev_cert/dev.rdc.key.pem & \
92
100
echo $$ ! >> .sam-pids ; \
93
101
docker run --rm -p 8083:8083 -e LAMBDA_ENDPOINT=http://172.17.0.1:3005/ amazon/aws-stepfunctions-local ; \
102
+ echo -n " Shutting down..." ; \
103
+ sg close all 3005 ; \
94
104
kill $$(cat .sam-pids ) ; \
95
- rm -f .sam-pids
105
+ rm -f .sam-pids ; \
106
+ echo " "
107
+ state-machine :
108
+ export TEMPLATE_DIR=$$(mktemp -d ) ; \
109
+ yq -o=json ' .Resources.avDownloadStateMachine.Properties.Definition' av-download/template.yaml > $$ TEMPLATE_DIR/av_download.json; \
110
+ aws stepfunctions create-state-machine --endpoint http://localhost:8083 --definition file://$$ TEMPLATE_DIR/av_download.json --name " hlsStitcherStepFunction" --role-arn arn:aws:iam::012345678901:role/DummyRole
96
111
deps : deps-node deps-python
97
112
style : style-node style-python
98
113
test : test-node test-python
@@ -104,10 +119,12 @@ samconfig.%.yaml:
104
119
deploy : build samconfig.$(DEV_PREFIX ) .yaml
105
120
sam deploy --config-file samconfig.$(DEV_PREFIX ) .yaml --stack-name dc-api-$(DEV_PREFIX )
106
121
sync : samconfig.$(DEV_PREFIX ) .yaml
107
- sam sync --config-file samconfig.$(DEV_PREFIX ) .yaml --stack-name dc-api-$(DEV_PREFIX ) --watch
122
+ sam sync --config-file samconfig.$(DEV_PREFIX ) .yaml --stack-name dc-api-$(DEV_PREFIX ) --watch $(ARGS )
123
+ sync-code : ARGS=--code
124
+ sync-code : sync
108
125
secrets :
109
126
ln -s ../tfvars/dc-api/* .yaml .
110
127
clean :
111
- rm -rf .aws-sam api/node_modules api/src/node_modules python /** /__pycache__ python /.coverage python /.ruff_cache
128
+ rm -rf .aws-sam api/.aws-sam chat/.aws-sam av-download/.aws-sam api/ node_modules api/src/node_modules chat /** /__pycache__ chat /.coverage chat /.ruff_cache
112
129
reset :
113
130
for f in $$ (find . -maxdepth 2 -name ' *.orig' ); do mv $$ f $$ {f%%.orig}; done
0 commit comments