-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
70 lines (58 loc) · 2.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
install:
python -m pip install --upgrade pip && \
python -m pip install -r requirements.txt
install-pypgstac:
python -m pip install --upgrade pip && \
python -m pip install $$(grep pypgstac requirements.txt)
install-lambda-deps:
python -m pip install --upgrade pip && \
python -m pip install -r requirements-apps-api.txt -t apps/api/src/
deploy:
aws cloudformation package \
--template-file apps/cloudformation.yml \
--s3-bucket ${s3_bucket} \
--output-template-file packaged.yml \
&& aws cloudformation deploy \
--template-file packaged.yml \
--stack-name ${stack_name} \
--capabilities CAPABILITY_NAMED_IAM \
--role-arn ${cloudformation_role_arn} \
--parameter-overrides \
DatabaseAdminPassword=${db_admin_password} \
DatabaseReadPassword=${db_read_password} \
CidrIp=${cidr_ip} \
GithubBranch=${github_branch} \
DomainName=${domain_name} \
CertificateArn=${certificate_arn}
psql:
PGHOST=${db_host} PGPORT=5432 PGDATABASE=postgres PGUSER=${db_user} PGPASSWORD=${db_password} psql
configure-database: install-or-upgrade-postgis pypgstac-migrate configure-database-roles
install-or-upgrade-postgis:
PGHOST=${db_host} PGPORT=5432 PGDATABASE=postgres PGUSER=postgres PGPASSWORD=${db_admin_password} psql \
-f install-or-upgrade-postgis.sql
pypgstac-migrate:
PGHOST=${db_host} PGPORT=5432 PGDATABASE=postgres PGUSER=postgres PGPASSWORD=${db_admin_password} pypgstac migrate
configure-database-roles:
PGHOST=${db_host} PGPORT=5432 PGDATABASE=postgres PGUSER=postgres PGPASSWORD=${db_admin_password} psql \
--set=db_read_password=${db_read_password} \
-f configure-database-roles.sql
pypgstac-load:
PGHOST=${db_host} PGPORT=5432 PGDATABASE=postgres PGUSER=postgres PGPASSWORD=${db_admin_password} \
pypgstac load ${table} ${ndjson_file} --method upsert
run-api:
POSTGRES_HOST_READER=${db_host} POSTGRES_HOST_WRITER=${db_host} POSTGRES_PORT=5432 \
POSTGRES_DBNAME=postgres POSTGRES_USER=postgres POSTGRES_PASS=${db_admin_password} \
ENABLED_EXTENSIONS=${enabled_extensions} \
python -m stac_fastapi.pgstac.app
test:
PYTHONPATH=${PWD}/collections/sentinel-1-global-coherence/:${PWD}/collections/glo-30-hand/ python -m pytest tests/
cfn-lint:
# Ignore "W1011 Use dynamic references over parameters for secrets" because we store secrets
# using GitHub Secrets.
#
# Ignore E3691 for validating the database instance engine and version, because RDS automatically
# applies minor version upgrades to keep the deployed database instance up-to-date, so we do not
# need to keep the engine version specified in the CloudFormation template up-to-date.
#
# See https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/rules.md
cfn-lint --template `find . -name cloudformation.yml` --info --ignore-checks W3002 W1011 E3691