Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
396 commits
Select commit Hold shift + click to select a range
3ae2288
rename state machine asset
chrisammon3000 Aug 6, 2023
a57015f
clean up and update pipeline layer
chrisammon3000 Aug 7, 2023
ab085f1
fix typos and error handling
chrisammon3000 Aug 7, 2023
a31c7be
fix input paths; add s3 path validation
chrisammon3000 Aug 13, 2023
a0da563
fix load job input mappings
chrisammon3000 Aug 13, 2023
f90b95d
update requirements
chrisammon3000 Aug 13, 2023
16f243c
handle error from unset release
chrisammon3000 Aug 13, 2023
b39060d
add timeout for get activity
chrisammon3000 Aug 13, 2023
0d17188
fix release variable json path
chrisammon3000 Aug 13, 2023
9123c96
update cfn tags with branch & commit sha
chrisammon3000 Aug 13, 2023
727ef24
fix input path for load state; increase validation Lambda memory
chrisammon3000 Aug 13, 2023
78acd77
handle state machine errors
chrisammon3000 Aug 13, 2023
84de3d0
fix output paths for load stage
chrisammon3000 Aug 14, 2023
92a1968
conditionally set VPC variable
chrisammon3000 Aug 16, 2023
54020e0
validate vpc param and env vars before deployment
chrisammon3000 Aug 17, 2023
fc944b7
conditionally create VPC
chrisammon3000 Aug 17, 2023
86d4d78
use environment variable instead of command line arg
chrisammon3000 Aug 18, 2023
874710a
source environment variables by stage
chrisammon3000 Aug 18, 2023
5b9383b
validate stage value matches deployment environment
chrisammon3000 Aug 19, 2023
0efe522
store stage, app variables in SSM Parameter Store
chrisammon3000 Aug 20, 2023
58e1e9c
require user confirmation before deployment
chrisammon3000 Aug 20, 2023
0f3dae1
update README
chrisammon3000 Aug 20, 2023
3a78f12
optionally delete S3 data
chrisammon3000 Aug 20, 2023
a0703f2
typo
chrisammon3000 Aug 20, 2023
e5c722a
Merge branch 'incremental_load/optional-vpc' into process-updated-rel…
chrisammon3000 Aug 22, 2023
aa02dd6
fix missing parameter
chrisammon3000 Aug 22, 2023
80ffa36
specify stage for make
chrisammon3000 Aug 22, 2023
9f596ae
fetch github branches
chrisammon3000 Aug 22, 2023
bb9cdb2
correct default pipeline input
chrisammon3000 Aug 22, 2023
e15b812
Merge pull request #47 from chrisammon3000/process-updated-releases/m…
chrisammon3000 Aug 23, 2023
30ef0b3
Merge pull request #46 from chrisammon3000/process-updated-releases/m…
chrisammon3000 Aug 23, 2023
c99c950
update state during execution
chrisammon3000 Aug 24, 2023
3f6bc76
Merge branch 'incremental_load' of https://github.com/nmdp-bioinforma…
chrisammon3000 Aug 24, 2023
d215a98
remove limit param validation for now
chrisammon3000 Aug 29, 2023
c2050b8
increase timeout and memory on validation Lambda
chrisammon3000 Aug 29, 2023
2ec9433
Merge branch 'nmdp/incremental_load' into incremental_load/fix-valida…
chrisammon3000 Aug 29, 2023
caf9e5c
set release pattern regex
chrisammon3000 Aug 29, 2023
8acd785
fix premature exit on build errors causing container to stop
chrisammon3000 Aug 29, 2023
b336aec
capture error output to disk as ndjson
chrisammon3000 Aug 29, 2023
474dd4c
consolidate error handling within process_allele function; remove sqs
chrisammon3000 Aug 30, 2023
379b719
remove failed alleles queue
chrisammon3000 Aug 30, 2023
ff80986
script proceeds if some alleles fail
chrisammon3000 Aug 30, 2023
5d3c76c
validate build for single release version
chrisammon3000 Aug 31, 2023
8e7f051
fix restore target
chrisammon3000 Aug 31, 2023
6749b3a
fix input paths in state machine
chrisammon3000 Sep 1, 2023
e869acb
use existing build output if available
chrisammon3000 Sep 2, 2023
29033d8
wait for backup document to finish
chrisammon3000 Sep 3, 2023
67e012a
Merge branch 'fix-validation-error/use-existing-build' into increment…
chrisammon3000 Sep 3, 2023
e8b4970
refactor input array for cleaner output
chrisammon3000 Sep 3, 2023
ab83c3a
add use_existing_build to pipeline params
chrisammon3000 Sep 3, 2023
6b0dc56
evaluate use_existing_build after file validation
chrisammon3000 Sep 3, 2023
26b6654
refactor environment validation target
chrisammon3000 Sep 3, 2023
45140a5
add skip_load to pipeline params
chrisammon3000 Sep 3, 2023
2d08920
update README
chrisammon3000 Sep 4, 2023
6b3cc5a
Merge branch 'incremental_load/fix-validation-error' into process-upd…
chrisammon3000 Sep 7, 2023
177d214
delete old pipeline
chrisammon3000 Sep 7, 2023
33938de
merge state machine from incremental_load
chrisammon3000 Sep 7, 2023
991f49d
refactor state scripts
chrisammon3000 Sep 8, 2023
83b0393
refactor scripts directory
chrisammon3000 Sep 9, 2023
5629f52
targets to create and use python env
chrisammon3000 Sep 9, 2023
872ae74
update datetime validation
chrisammon3000 Sep 10, 2023
989a335
fix missing token
chrisammon3000 Sep 10, 2023
8199d49
build and load state using make target
chrisammon3000 Sep 10, 2023
eb0e564
fix missing timestamp param and datetime strings
chrisammon3000 Sep 12, 2023
537c98d
keep limit param as integer
chrisammon3000 Sep 12, 2023
622568c
add pygethub
chrisammon3000 Sep 13, 2023
c739c46
update gitignore
chrisammon3000 Dec 24, 2023
e8743d6
Merge branch 'process-updated-releases/pygethub' into conditional-dep…
chrisammon3000 Dec 28, 2023
b669a49
refactor paths for database assets to match S3
chrisammon3000 Dec 28, 2023
d958d59
fix asset paths in targets to match S3
chrisammon3000 Dec 28, 2023
8c90762
refactor pipeline scripts
chrisammon3000 Dec 28, 2023
6139e7f
build source repository state for DynamoDB table
chrisammon3000 Dec 28, 2023
bd3e811
remove unused invoke pipeline function
chrisammon3000 Dec 28, 2023
24e3b3e
fix SAM build error from dependency mismatch
chrisammon3000 Dec 28, 2023
b0e64a3
add missing cfn params
chrisammon3000 Dec 28, 2023
7df39fe
fix incorrect cfn parameters
chrisammon3000 Dec 30, 2023
9022a5e
remove environment.json
chrisammon3000 Dec 30, 2023
0e36c42
specify update and deletion policies for stateful resources
chrisammon3000 Dec 30, 2023
ae08a64
add comments and clean up
chrisammon3000 Dec 30, 2023
d98d9dc
format and add missing SSM parameter map
chrisammon3000 Dec 31, 2023
5624001
integrate update pipeline for processing one release per execution
chrisammon3000 Dec 31, 2023
5791f97
print consistent API responses to stdout
chrisammon3000 Dec 31, 2023
ef8963f
add missing feature service param to build job
chrisammon3000 Dec 31, 2023
19cac69
update input parameters model
chrisammon3000 Dec 31, 2023
823b256
update input parameter paths and references for build stage
chrisammon3000 Dec 31, 2023
f04808c
fix incorrect path to database config files
chrisammon3000 Jan 2, 2024
746fdf5
refactor validation paths for state machine
chrisammon3000 Jan 2, 2024
4d1cfcb
evaluate query results after load to pass or fail
chrisammon3000 Jan 3, 2024
7d93afb
update state
chrisammon3000 Jan 3, 2024
a766694
format and clean up
chrisammon3000 Jan 3, 2024
c6af62a
update execution status values and convert to enum
chrisammon3000 Jan 3, 2024
e52fa33
refactor state machine to update execution statues and sync to table
chrisammon3000 Jan 4, 2024
4e82dc3
fix status paths
chrisammon3000 Jan 5, 2024
2e413f4
handle build and load errors in state machine
chrisammon3000 Jan 5, 2024
b9a7350
update error handling in state machine
chrisammon3000 Jan 6, 2024
3058ce1
add error fields to state table model
chrisammon3000 Jan 7, 2024
8be47e6
sync error status to state table
chrisammon3000 Jan 7, 2024
2f91124
reset error and date_utc fields from previous executions
chrisammon3000 Jan 7, 2024
a34548a
remove unnecessary fields from Sync State states
chrisammon3000 Jan 7, 2024
780b574
update Lambda test payloads
chrisammon3000 Jan 7, 2024
22bf076
update pipeline state model with execution id field
chrisammon3000 Jan 7, 2024
fa48b13
document steps to restore Neo4j from backup to Docker
chrisammon3000 Jan 8, 2024
26ae308
bake most recent backup into Docker image
chrisammon3000 Jan 8, 2024
0ac3127
store current backup S3 path SSM param
chrisammon3000 Jan 9, 2024
e7f3f37
orchestrate local gfe-db build using make targets
chrisammon3000 Jan 9, 2024
f35ac1c
move env validation for Docker credentials to local Makefile
chrisammon3000 Jan 9, 2024
a6bda60
create and push version tag using backup date
chrisammon3000 Jan 9, 2024
865f312
update README
chrisammon3000 Jan 9, 2024
c12318c
remove authentication for gfe-db in Docker
chrisammon3000 Jan 11, 2024
a72cb80
use 'gfedb' as default database name
chrisammon3000 Jan 12, 2024
9f8e159
use 'gfedb' as default database name for Docker image
chrisammon3000 Jan 12, 2024
cf5b510
update gitignore
chrisammon3000 Jan 12, 2024
b3b3410
mask secret values
chrisammon3000 Jan 12, 2024
67efcb2
update permissions to use least privilege
chrisammon3000 Jan 12, 2024
21dcbcd
add targets to retrieve latest backup path
chrisammon3000 Jan 12, 2024
dd4f41c
skip modifying gateway VPC endpoints
chrisammon3000 Jan 12, 2024
5c0f5e1
fix multiple versions on HAS_IPD_ALLELE releases property
chrisammon3000 Jan 12, 2024
1d457a0
update DatabaseSyncScriptsDocument to copy Cypher scripts
chrisammon3000 Jan 12, 2024
4edd814
sort releases array
chrisammon3000 Jan 13, 2024
8029dfc
minor formatting fixes
chrisammon3000 Jan 13, 2024
31318d9
create Neo4j users
chrisammon3000 Jan 14, 2024
478bc91
validate user credentials
chrisammon3000 Jan 17, 2024
a709dc2
create Neo4j users and set NEO4J_URI in user data
chrisammon3000 Jan 17, 2024
07b4995
fix incorrect restore target validation
chrisammon3000 Jan 17, 2024
267e703
update validation queries
chrisammon3000 Jan 17, 2024
def04c1
install APOC and GDS in Docker
chrisammon3000 Jan 17, 2024
8adfb8e
update README
chrisammon3000 Jan 17, 2024
dc16518
fix missing database security group on existing VPC endpoints
chrisammon3000 Jan 18, 2024
2694555
update README
chrisammon3000 Jan 18, 2024
7ca0948
update TOC and Project Structure in README
chrisammon3000 Jan 18, 2024
93ae974
fix bad link
chrisammon3000 Jan 18, 2024
ea42169
Merge branch 'private-subnet-dns/conditional-deployment' into merge-p…
chrisammon3000 Jan 19, 2024
bb07442
format api responses in stdout
chrisammon3000 Jan 19, 2024
b85ec69
remove cfn logging to catch errors on deployment
chrisammon3000 Jan 19, 2024
9f3eecf
fix mislabeled function
chrisammon3000 Jan 19, 2024
d8fbde9
fix missing permission
chrisammon3000 Jan 19, 2024
3090dcc
add state
chrisammon3000 Jan 19, 2024
41bbd63
fix bad arguments
chrisammon3000 Jan 20, 2024
f2b19c6
handle user events with releases not yet in state table
chrisammon3000 Jan 20, 2024
127af10
avoid overwriting status of previously processed state items if they …
chrisammon3000 Jan 20, 2024
cc5f003
clean up
chrisammon3000 Jan 20, 2024
fd7f0fa
fix failed validation when loading an existing release
chrisammon3000 Jan 20, 2024
fc885b7
add emojis to state labels
chrisammon3000 Jan 20, 2024
720fbc9
add new status enum for aborted executions
chrisammon3000 Jan 20, 2024
42b6dfb
update status for aborted executions
chrisammon3000 Jan 20, 2024
05ea438
dev queue for reading SNS messages
chrisammon3000 Jan 21, 2024
1e3c3e2
refactor and update SNS subscription targets
chrisammon3000 Jan 21, 2024
cd6d80a
add load queue to control concurrency
chrisammon3000 Jan 21, 2024
3130f8b
add invocation_id to state model
chrisammon3000 Jan 21, 2024
32e9564
send release to sqs for loading to Neo4j
chrisammon3000 Jan 21, 2024
bd57520
refactor load scripts for SQS
chrisammon3000 Jan 24, 2024
003fe90
move load queue to database layer so params are available to pipeline
chrisammon3000 Jan 24, 2024
10da626
process message from load queue
chrisammon3000 Jan 25, 2024
3e8b896
fix and refactor DatabaseSyncScripts SSM document
chrisammon3000 Jan 25, 2024
ae7461d
refactor task heartbeat logic
chrisammon3000 Jan 25, 2024
81a1c95
rebuild pipeline state
chrisammon3000 Jan 25, 2024
a6b6305
Merge branch 'merge-process-updated-releases/decouple-build-and-load'…
chrisammon3000 Jan 25, 2024
b828340
format pipeline execution results JSON for email notifications
chrisammon3000 Jan 25, 2024
a82fcf3
emoji for easier readability
chrisammon3000 Jan 25, 2024
b6075db
format error notification
chrisammon3000 Jan 26, 2024
4850117
handle missing backup key
chrisammon3000 Jan 26, 2024
cdcd1a3
remove backup step from state machine to avoid clashes between concur…
chrisammon3000 Jan 26, 2024
df699f0
delete message after success
chrisammon3000 Jan 26, 2024
f040973
restore logic for sfn Activity API
chrisammon3000 Jan 26, 2024
fc7ffbe
build and load state only for initial deployment
chrisammon3000 Jan 27, 2024
7158c5e
trigger alarm and invoke function when queue has messages
chrisammon3000 Jan 27, 2024
2351713
rename function path
chrisammon3000 Jan 28, 2024
6e26a4b
receive message from SQS for LCM state machine
chrisammon3000 Jan 28, 2024
7fcfeff
Load Concurrency Manager (LCM) basic control loop and state machine d…
chrisammon3000 Jan 28, 2024
ca6edfe
resource configurations for LCM service
chrisammon3000 Jan 28, 2024
912ac16
fix SAM rejecting large template
chrisammon3000 Jan 28, 2024
ee85f6f
minor changes, comments and clean up
chrisammon3000 Jan 28, 2024
8e3e913
increase message visibility timeout for processing
chrisammon3000 Jan 28, 2024
865a806
move load states to LCM
chrisammon3000 Jan 28, 2024
6c19fa5
check database status before sending load request
chrisammon3000 Jan 31, 2024
bbdb1cb
update release state from LCM
chrisammon3000 Jan 31, 2024
5cfb60b
return message to queue if load fails
chrisammon3000 Feb 1, 2024
4d1f38a
integrate Update Pipeline with LCM
chrisammon3000 Feb 1, 2024
0540eeb
sync LCM with Update Pipeline executions; add backup steps to LCM
chrisammon3000 Feb 2, 2024
5200a7e
limit LCM concurrency to 1 execution
chrisammon3000 Feb 2, 2024
d16b943
handle releases in user input not yet in state table
chrisammon3000 Feb 2, 2024
f776810
use release version for deduplication id to avoid duplicate processing
chrisammon3000 Feb 2, 2024
a7be620
build and deploy commits to state table
chrisammon3000 Feb 2, 2024
6c2505f
use FIFO queue for builds to maintain idempotency of requests
chrisammon3000 Feb 2, 2024
8b2f2f2
remove pipeline state from version control
chrisammon3000 Feb 2, 2024
a66d81d
disable GfeDbLoadQueueHasMessages alarm and associated resources
chrisammon3000 Feb 2, 2024
33befcd
move queues and alarms to pipeline layer
chrisammon3000 Feb 2, 2024
411b7aa
indicate invalid load
chrisammon3000 Feb 2, 2024
8f9a846
remove validation causing false load failures
chrisammon3000 Feb 2, 2024
2cd9237
eda of commits by branch for missing releases
chrisammon3000 Feb 12, 2024
875563a
get commits for all branches; return error shas
chrisammon3000 Feb 12, 2024
aa13760
add pygethub dependency
chrisammon3000 Feb 12, 2024
9f0e830
fix missing releases and validate that all versions are present
chrisammon3000 Feb 22, 2024
3d0ca80
clean up and format
chrisammon3000 Feb 22, 2024
5bc4a3d
use SV field instead of AC field for IPD_Accession name property
chrisammon3000 Feb 26, 2024
3f66a60
update README
chrisammon3000 Mar 10, 2024
756d6a8
Merge pull request #48 from chrisammon3000/fix/update-IPD_Accession
chrisammon3000 Mar 10, 2024
a1d07c4
update dev requirements
chrisammon3000 Mar 11, 2024
04e470f
sync app state with repo state; handle user request
chrisammon3000 Mar 11, 2024
e5d67cd
update dev notebooks
chrisammon3000 Mar 11, 2024
65eb9e7
update target asset regex
chrisammon3000 Mar 11, 2024
96c7c5c
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 Mar 31, 2024
6f84b92
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 Apr 28, 2024
c98b8db
skip branch if name is not a release version
chrisammon3000 Apr 28, 2024
5c273f2
handle both user and new commits concurrently
chrisammon3000 Apr 28, 2024
61bb03e
clean up
chrisammon3000 Apr 28, 2024
c7c26b4
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 May 7, 2024
71281e9
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 May 9, 2024
321756a
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 May 9, 2024
fdd544c
handle new zip file format for hla.dat
chrisammon3000 May 12, 2024
e4495aa
update Lambda function dependencies
chrisammon3000 May 13, 2024
f302659
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 May 15, 2024
9f08360
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 May 24, 2024
288fda5
Merge branch 'nmdp-bioinformatics:main' into main
chrisammon3000 Jun 5, 2024
fb77ae0
require python path
chrisammon3000 Jul 14, 2024
e269dc2
handle state machine errors
chrisammon3000 Jul 14, 2024
3482f2e
add retries to waiter
chrisammon3000 Jul 14, 2024
4956518
update comments
chrisammon3000 Jul 21, 2024
3d91e6d
Merge branch 'main' into merge-process-updated-releases/merge-build-j…
chrisammon3000 Jul 21, 2024
ad2a4a9
remove duplicate targets
chrisammon3000 Jul 21, 2024
ea6a324
fix config paths
chrisammon3000 Jul 21, 2024
94b9621
remove unsued condition
chrisammon3000 Jul 21, 2024
d24288f
access instance in private subnet using Session Manager
chrisammon3000 Aug 31, 2024
a48372d
target to abort pipeline and purge queues
chrisammon3000 Aug 31, 2024
178b62d
get alarm status
chrisammon3000 Sep 1, 2024
e492843
wait for alarm status to change using target
chrisammon3000 Sep 1, 2024
9655a11
debug statements
chrisammon3000 Sep 1, 2024
00cd05b
add debug statements
chrisammon3000 Sep 8, 2024
1248947
run build job despite errors
chrisammon3000 Sep 13, 2024
ce310ab
revert load scripts
chrisammon3000 Sep 13, 2024
159a637
send Run Command logs to CloudWatch
chrisammon3000 Sep 15, 2024
f04caa9
fix config paths
chrisammon3000 Sep 15, 2024
ed142bb
poll SSM until Run Command succeeds or fails
chrisammon3000 Sep 16, 2024
c96f2d4
include sqs payload
chrisammon3000 Sep 17, 2024
b6ff4c3
stop execution if run command fails
chrisammon3000 Sep 17, 2024
c224f9b
fix path
chrisammon3000 Sep 18, 2024
ebc7f68
fix environment variables
chrisammon3000 Sep 18, 2024
ce35e29
remove unecessary activity state and logic
chrisammon3000 Sep 19, 2024
3c7c225
return message after stopping execution
chrisammon3000 Sep 19, 2024
4a3d138
fix missing variables
chrisammon3000 Sep 25, 2024
e075a6a
use standard error handling approach
chrisammon3000 Sep 27, 2024
cab5327
increase wait time between polling load status
chrisammon3000 Sep 27, 2024
54bba08
add missing fields to state
chrisammon3000 Sep 28, 2024
a4b4e2e
fix target so bastion server doesn't deploy when set to false
chrisammon3000 Sep 29, 2024
d637965
stagger messages to maintain processing order
chrisammon3000 Sep 29, 2024
1ba0458
retry if state fails from ServiceUnavailable
chrisammon3000 Sep 29, 2024
c194089
handle load failures
chrisammon3000 Sep 30, 2024
2dab57e
handle failure inside execution handler block
chrisammon3000 Oct 5, 2024
6833986
include stderr logs for failed load
chrisammon3000 Oct 6, 2024
87ce805
increase retry interval
chrisammon3000 Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,17 @@ WORKLOG.md
payload.json
___*
gfedb.zip
reports/
source-config-v*.json
test.asl.json
_cache*/
ssm-describe*.json
gfe-db/pipeline/jobs/build/event.json
gfe-db/pipeline/statemachines/test*
reports/
output-payload.json
*bkp*
execution-state.json

# Local Deployment
gfe-db/local/neo4j
gfe-db/local/neo4j
153 changes: 118 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export DATABASE_VOLUME_SIZE ?= 64

# Resource identifiers
export DATA_BUCKET_NAME ?= ${STAGE}-${APP_NAME}-${AWS_ACCOUNT}-${AWS_REGION}
export CONFIG_S3_PATH := config
export ECR_BASE_URI := ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com
export BUILD_REPOSITORY_NAME ?= ${STAGE}-${APP_NAME}-build-service
export EC2_KEY_PAIR_NAME := $${STAGE}-$${APP_NAME}-$${AWS_REGION}-neo4j-key
Expand All @@ -48,10 +49,8 @@ export GITHUB_REPOSITORY_OWNER ?= ANHIG
export GITHUB_REPOSITORY_NAME ?= IMGTHLA
export FEATURE_SERVICE_URL ?= https://feature.b12x.org

# S3 paths
export PIPELINE_STATE_PATH = config/IMGTHLA-repository-state.json
export PIPELINE_PARAMS_PATH = config/pipeline-input.json
export FUNCTIONS_PATH = ${PIPELINE_DIR}/functions
# Neo4j
export NEO4J_DATABASE_NAME ?= gfedb

# Neo4j
export NEO4J_DATABASE_NAME ?= gfedb
Expand All @@ -65,7 +64,7 @@ export CREATE_NEO4J_USERS ?= "gfedb:7b26OqomunEQvpPG"
# Required environment variables
REQUIRED_VARS := STAGE APP_NAME AWS_ACCOUNT AWS_REGION AWS_PROFILE SUBSCRIBE_EMAILS \
GITHUB_REPOSITORY_OWNER GITHUB_REPOSITORY_NAME GITHUB_PERSONAL_ACCESS_TOKEN \
ADMIN_EMAIL NEO4J_PASSWORD GDS_VERSION
ADMIN_EMAIL NEO4J_PASSWORD GDS_VERSION PYTHON

BOOLEAN_VARS := CREATE_VPC USE_PRIVATE_SUBNET DEPLOY_NAT_GATEWAY DEPLOY_BASTION_SERVER DEPLOY_VPC_ENDPOINTS SKIP_CHECK_DEPENDENCIES

Expand Down Expand Up @@ -117,6 +116,7 @@ ifeq ($(SPLASH_FONT),slant)
@echo "\033[0;34m \033[0m"
endif


env.print:
@echo "\033[0;33mReview the contents of the .env file:\033[0m"
@echo "+---------------------------------------------------------------------------------+"
Expand All @@ -140,9 +140,22 @@ deploy: splash-screen logs.purge env.validate ##=> Deploy all services
$(MAKE) infrastructure.deploy
$(MAKE) database.deploy
$(MAKE) pipeline.deploy
$(MAKE) monitoring.create-topic-subscriptions topics="GfeDbExecutionResultTopicArn UpdatePipelineErrorsTopicArn"
ifeq ($(HAS_STAGE),null)
@sh -c '$(MAKE) pipeline.state.build && $(MAKE) pipeline.state.load || echo "Pipeline state build failed"'
endif
@echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Finished deploying ${APP_NAME}" 2>&1 | tee -a ${CFN_LOG_PATH}
$(MAKE) options-screen

update: env.validate.stage env.validate
@echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Updating ${APP_NAME} to ${AWS_ACCOUNT}" 2>&1 | tee -a ${CFN_LOG_PATH}
$(MAKE) env.print
@echo "Update stack in the \`${STAGE}\` environment? [y/N] \c " && read ans && [ $${ans:-N} = y ]
$(MAKE) infrastructure.deploy
$(MAKE) database.deploy
$(MAKE) pipeline.deploy
@echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Finished updating ${APP_NAME}" 2>&1 | tee -a ${CFN_LOG_PATH}

logs.purge: logs.dirs
ifeq ($(PURGE_LOGS),true)
@rm ${LOGS_DIR}/cfn/*.txt
Expand Down Expand Up @@ -392,9 +405,7 @@ infrastructure.service.deploy:
$(MAKE) -C ${APP_NAME}/infrastructure/ service.deploy

infrastructure.access-services.deploy:
$(MAKE) -C ${APP_NAME}/infrastructure/access-services/nat-gateway/ deploy
$(MAKE) -C ${APP_NAME}/infrastructure/access-services/bastion-server/ deploy
$(MAKE) -C ${APP_NAME}/infrastructure/access-services/vpc-endpoints/ deploy
$(MAKE) -C ${APP_NAME}/infrastructure/ service.access-services.deploy

infrastructure.access-services.nat-gateway.deploy:
$(MAKE) -C ${APP_NAME}/infrastructure/access-services/nat-gateway/ deploy
Expand All @@ -408,25 +419,61 @@ infrastructure.access-services.bastion-server.connect:
infrastructure.access-services.vpc-endpoints.deploy:
$(MAKE) -C ${APP_NAME}/infrastructure/access-services/vpc-endpoints/ deploy

monitoring.create-topic-subscriptions: #=> topics=<string>
@for topic in $$topics; do \
$(MAKE) monitoring.subscribe-emails topic_ssm_param=$$topic; \
done

monitoring.create-subscriptions:
$(MAKE) -C ${APP_NAME}/infrastructure service.monitoring.create-subscriptions

monitoring.subscribe-email:
$(MAKE) -C ${APP_NAME}/infrastructure service.monitoring.subscribe-email
monitoring.subscribe-emails: #=> topic_ssm_param=<string>
@echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Creating SNS topic subscriptions for $$topic_ssm_param" 2>&1 | tee -a $${CFN_LOG_PATH}
@topic_arn=$$(aws ssm get-parameters \
--names "/$${APP_NAME}/$${STAGE}/$${AWS_REGION}/$$topic_ssm_param" \
--with-decryption \
--query "Parameters[0].Value" \
--output text) && \
for EMAIL in $$(echo $${SUBSCRIBE_EMAILS} | sed 's/,/ /g'); do \
res=$$(aws sns subscribe \
--topic-arn "$$topic_arn" \
--protocol email \
--notification-endpoint "$$EMAIL") && \
echo $$res | jq -r || \
echo "\033[0;31mFailed to subscribe $$EMAIL to SNS topic\033[0m"; \
done

monitoring.subscribe-email: #=> topic_name=<string> email=<string>
@echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Creating SNS topic subscription" 2>&1 | tee -a $${CFN_LOG_PATH}
@topic_arn=$$(aws ssm get-parameters \
--names "/$${APP_NAME}/$${STAGE}/$${AWS_REGION}/"$$topic_name"Arn" \
--with-decryption \
--query "Parameters[0].Value" \
--output text) && \
aws sns subscribe \
--topic-arn "$$topic_arn" \
--protocol email \
--notification-endpoint "$$email" 2>&1 | tee -a $${CFN_LOG_PATH} || true;

database.deploy:
$(MAKE) -C ${APP_NAME}/database/ deploy

database.service.deploy:
$(MAKE) -C ${APP_NAME}/database/ service.deploy

database.config.deploy:
$(MAKE) -C ${APP_NAME}/database/ service.config.deploy

database.connect:
ifeq ($(USE_PRIVATE_SUBNET),true)
$(MAKE) infrastructure.access-services.bastion-server.connect
else
$(MAKE) -C ${APP_NAME}/database/ service.connect
endif

database.start-session:
$(MAKE) -C ${APP_NAME}/database/ service.start-session

database.ui.connect:
ifeq ($(USE_PRIVATE_SUBNET),true)
$(MAKE) -C ${APP_NAME}/infrastructure/access-services/bastion-server/ service.ui.connect
Expand All @@ -435,31 +482,80 @@ else ifeq ($(USE_PRIVATE_SUBNET),false)
endif

pipeline.deploy:
$(MAKE) -C ${APP_NAME}/pipeline/ deploy

pipeline.service.deploy:
$(MAKE) -C ${APP_NAME}/pipeline/ service.deploy

pipeline.service.update:
$(MAKE) -C ${APP_NAME}/pipeline/ service.functions.deploy

pipeline.jobs.deploy:
$(MAKE) -C ${APP_NAME}/pipeline/ service.jobs.deploy

config.deploy:
pipeline.config.deploy:
$(MAKE) -C ${APP_NAME}/pipeline/ service.config.deploy
$(MAKE) -C ${APP_NAME}/database/ service.config.deploy

pipeline.state.build:
$(MAKE) -C ${APP_NAME}/pipeline/ service.state.build

pipeline.state.load:
$(MAKE) -C ${APP_NAME}/pipeline/ service.state.load

pipeline.state.deploy:
$(MAKE) -C ${APP_NAME}/pipeline/ service.state.build
$(MAKE) -C ${APP_NAME}/pipeline/ service.state.load

pipeline.statemachine.update-pipeline.stop:
$(MAKE) -C ${APP_NAME}/pipeline/ service.statemachine.update-pipeline.stop

pipeline.statemachine.load-concurrency-manager.stop:
$(MAKE) -C ${APP_NAME}/pipeline/ service.statemachine.load-concurrency-manager.stop

pipeline.queue.gfe-db-load.purge:
$(MAKE) -C ${APP_NAME}/pipeline/ service.queue.gfe-db-load.purge

pipeline.queue.gfe-db-processing.purge:
$(MAKE) -C ${APP_NAME}/pipeline/ service.queue.gfe-db-processing.purge

pipeline.abort:
@echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Aborting pipeline execution" 2>&1 | tee -a $${CFN_LOG_PATH}
$(MAKE) -C ${APP_NAME}/pipeline/ service.statemachine.update-pipeline.stop
$(MAKE) -C ${APP_NAME}/pipeline/ service.statemachine.load-concurrency-manager.stop
@purge=$${purge:-false}; \
if [ "$$purge" = "true" ]; then \
echo "Purging queues..."; \
$(MAKE) -C ${APP_NAME}/pipeline/ service.queue.gfe-db-load.purge; \
$(MAKE) -C ${APP_NAME}/pipeline/ service.queue.gfe-db-processing.purge; \
else \
echo "\033[0;33mNote: SQS queues were not purged. To purge queues, run with 'purge=true'.\033[0m"; \
fi
@echo "\033[0;33m*** Pipeline execution aborted ***\033[0m"

pipeline.alarm.update-pipeline-execution.status:
$(MAKE) -C ${APP_NAME}/pipeline/ service.alarm.update-pipeline-execution.status

pipeline.alarm.update-pipeline-execution.wait:
$(MAKE) -C ${APP_NAME}/pipeline/ service.alarm.update-pipeline-execution.wait

config.deploy:
$(MAKE) database.config.deploy
$(MAKE) pipeline.config.deploy

database.load.run: # args: align, kir, limit, releases
@res=$$($(MAKE) database.status) && \
echo $$res | jq -r '.State' | grep -q 'stopped' && \
echo "\033[0;31mERROR: Database is stopped. Please start the database before loading data.\033[0m" && \
exit 1 || true
@echo "Confirm payload:" && \
[ "$$align" ] && align="$$align" || align=false && \
[ "$$kir" ] && kir="$$kir" || kir=false && \
[ "$$limit" ] && limit="$$limit" || limit="" && \
[ "$$limit" ] && limit="$$limit" || limit=-1 && \
[ "$$releases" ] && releases="$$releases" || releases="" && \
[ "$$use_existing_build" ] && use_existing_build="$$use_existing_build" || use_existing_build=false && \
[ "$$skip_load" ] && skip_load="$$skip_load" || skip_load=false && \
payload="{\"align\":$$align,\"kir\":$$kir,\"limit\":\"$$limit\",\"releases\":\"$$releases\",\"mem_profile\":false,\"use_existing_build\":$$use_existing_build,\"skip_load\":$$skip_load}"&&\
echo "$$payload" | jq -r && \
echo "$$payload" | jq > payload.json
@echo "Run pipeline with this payload? [y/N] \c " && read ans && [ $${ans:-N} = y ]
@function_name="${STAGE}"-"${APP_NAME}"-"$$(cat ${FUNCTIONS_PATH}/environment.json | jq -r '.Functions.InvokePipeline.FunctionConfiguration.FunctionName')" && \
@function_name="${STAGE}"-"${APP_NAME}"-"check-source-update" && \
echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Invoking $$function_name..." 2>&1 | tee -a ${CFN_LOG_PATH} && \
echo "Payload:" >> ${CFN_LOG_PATH} && \
cat payload.json >> ${CFN_LOG_PATH} && \
Expand All @@ -476,7 +572,7 @@ database.load.run: # args: align, kir, limit, releases
rm payload.json response.json

pipeline.invoke.validation-queries:
@function_name="${STAGE}"-"${APP_NAME}"-"$$(cat ${FUNCTIONS_PATH}/environment.json | jq -r '.Functions.ExecuteValidationQueries.FunctionConfiguration.FunctionName')" && \
@function_name="${STAGE}"-"${APP_NAME}"-"$$(cat ${PIPELINE_DIR}/functions/environment.json | jq -r '.Functions.ExecuteValidationQueries.FunctionConfiguration.FunctionName')" && \
echo "$$(gdate -u +'%Y-%m-%d %H:%M:%S.%3N') - Invoking $$function_name..." 2>&1 | tee -a ${CFN_LOG_PATH} && \
aws lambda invoke \
--cli-binary-format raw-in-base64-out \
Expand Down Expand Up @@ -513,10 +609,6 @@ database.reboot:
@response=$$(aws ec2 reboot-instances --instance-ids ${INSTANCE_ID}) && echo "$$response"
$(MAKE) database.status

database.config.deploy:
@echo "Deploying \`neo4j.conf\` to $${APP_NAME} server..."
$(MAKE) -C ${APP_NAME}/database/ service.config.neo4j.deploy

database.sync-scripts:
$(MAKE) -C ${APP_NAME}/database/ service.config.scripts.sync

Expand Down Expand Up @@ -546,7 +638,7 @@ database.restore: #from_path=s3://<backup path>

database.status:
@aws ec2 describe-instances | \
jq --arg iid "${INSTANCE_ID}" '.Reservations[].Instances[] | (.InstanceId == $$iid) | {InstanceId, InstanceType, "Status": .State.Name, StateTransitionReason, ImageId}'
jq --arg iid "${INSTANCE_ID}" '.Reservations[].Instances[] | select(.InstanceId == $$iid) | {InstanceId: .InstanceId, State: .State.Name}'

database.get.endpoint:
ifeq ($(USE_PRIVATE_SUBNET),true)
Expand Down Expand Up @@ -585,7 +677,7 @@ delete: # data=true/false ##=> Delete services
@[[ $$data != true ]] && echo "Data will not be deleted. To delete pass \`data=true\`" || true
@echo "Delete all stacks from the \`${STAGE}\` environment? [y/N] \c " && read ans && [ $${ans:-N} = y ] && \
if [ "${data}" = "true" ]; then \
aws s3 rm --recursive s3://${DATA_BUCKET_NAME}; \
aws s3 rm --recursive --quiet s3://${DATA_BUCKET_NAME}; \
fi
$(MAKE) pipeline.delete
$(MAKE) database.delete
Expand Down Expand Up @@ -616,9 +708,6 @@ database.delete:
pipeline.delete:
$(MAKE) -C ${APP_NAME}/pipeline/ service.delete

pipeline.service.delete:
$(MAKE) -C ${APP_NAME}/pipeline/ service.functions.delete

pipeline.jobs.delete:
$(MAKE) -C ${APP_NAME}/pipeline/ service.jobs.delete

Expand Down Expand Up @@ -755,9 +844,6 @@ define HELP_MESSAGE
PIPELINE_STATE_PATH: "${PIPELINE_STATE_PATH}"
Description: S3 path to the pipeline state file

PIPELINE_PARAMS_PATH: "${PIPELINE_PARAMS_PATH}"
Description: S3 path to the pipeline parameters file

FUNCTIONS_PATH: "${FUNCTIONS_PATH}"
Description: Path to the Lambda functions directory

Expand Down Expand Up @@ -799,7 +885,7 @@ define HELP_MESSAGE
$ make infrastructure.access-services.bastion-server.delete

...::: Create CloudWatch subscriptions :::...
$ make monitoring.create-subscriptions
$ make monitoring.subscribe-emails

...::: Subscribe an email to CloudWatch notifications :::...
$ make monitoring.subscribe-email
Expand Down Expand Up @@ -874,10 +960,7 @@ define HELP_MESSAGE
$ make pipeline.delete

...::: Update only the pipeline CloudFormation including Lambda functions :::...
$ make pipeline.service.deploy

...::: Delete only the pipeline CloudFormation including Lambda functions :::...
$ make pipeline.service.delete
$ make pipeline.service.update

...::: Deploy the pipeline jobs as Docker images to ECR:::...
$ make pipeline.jobs.deploy
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ Graph database representing IPD-IMGT/HLA sequence data as GFE.
   │   │   └── template.yaml
   │   ├── change-batch.json
   │   └── template.yaml
# Docker Build layer
   ├── local
   │   ├── Dockerfile # Dockerfile for building the Neo4j Docker image
   ├── local # Docker Build layer
   │   ├── Dockerfile # Dockerfile for building the gfe-db Docker image
   │   ├── Makefile
   │   └── build-local.sh # Builds the Neo4j Docker image from backup and installs plugins
# Data Pipeline layer
Expand Down Expand Up @@ -359,7 +358,7 @@ STAGE=<stage> make database.deploy
STAGE=<stage> make pipeline.deploy

# Deploy or update only the pipeline serverless stack including the Lambda functions and state machine
STAGE=<stage> make pipeline.service.deploy
STAGE=<stage> make pipeline.service.update

# Deploy or update only the Docker image for the build job
STAGE=<stage> make pipeline.jobs.deploy
Expand Down Expand Up @@ -852,7 +851,7 @@ STAGE=<stage> make docs.build
## Authors
**Primary Contact:** Martin Maiers ([@mmaiers-nmdp](https://github.com/mmaiers-nmdp))\
**Contact:** Pradeep Bashyal ([@pbashyal-nmdp](https://github.com/pbashyal-nmdp))\
**Contact:** Gregory Lindsey ([@chrisammon3000](https://github.com/chrisammon3000))
**Contact:** Gregory Christopher Lindsey ([@chrisammon3000](https://github.com/chrisammon3000))

<!-- TODO make sure these are up to date -->
## References & Links
Expand Down
Loading