Skip to content

Commit

Permalink
Merge pull request #7 from audioboxer217/feature/justfile
Browse files Browse the repository at this point in the history
  • Loading branch information
audioboxer217 authored Sep 20, 2024
2 parents c02439f + 8690654 commit 25349a8
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 34 deletions.
16 changes: 0 additions & 16 deletions envs/okcc.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
---
dev:
domain: okchmp24.kseppler.com
certificate_arn: arn:aws:acm:us-east-1:799879571353:certificate/08dcf05b-792c-4bea-b7d5-75acc69a5813
app_function: app.app
aws_region: us-east-1
profile_name: personal
project_name: frontend
runtime: python3.11
s3_bucket: zappa-okc-chmp-frontend-dev
http_methods:
- GET
- POST
remote_env: s3://okchmp-dev-reg-config/frontend.json
parameter_depth: 1
memory_size: 512
use_precompiled_packages: true
prod:
domain: okc.oktkdevents.com
certificate_arn: arn:aws:acm:us-east-1:851725437474:certificate/3f9b2618-4282-4f64-8d62-ded89512c2d9
Expand Down
20 changes: 2 additions & 18 deletions envs/okgp.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
prod:
domain: okgp.oktkdevents.com
certificate_arn: arn:aws:acm:us-east-1: 799879571353:certificate/8a0b2828-e9dc-4b74-8c5a-8fe47ee5ab98
certificate_arn: arn:aws:acm:us-east-1:799879571353:certificate/8a0b2828-e9dc-4b74-8c5a-8fe47ee5ab98
app_function: app.app
aws_region: us-east-2
profile_name: personal
Expand All @@ -11,23 +11,7 @@ prod:
http_methods:
- GET
- POST
remote_env: s3: //okgp24-reg-config/frontend.json
parameter_depth: 1
memory_size: 512
use_precompiled_packages: true
dev:
domain: okgp24.kseppler.com
certificate_arn: arn:aws:acm:us-east-1: 799879571353:certificate/8893e1e9-4a35-43a3-a547-eed14e496a50
app_function: app.app
aws_region: us-east-2
profile_name: personal
project_name: frontend
runtime: python3.11
s3_bucket: zappa-gdtkd-frontend-dev
http_methods:
- GET
- POST
remote_env: s3: //gdtkd-reg-config/frontend.json
remote_env: s3://okgp24-reg-config/frontend.json
parameter_depth: 1
memory_size: 512
use_precompiled_packages: true
17 changes: 17 additions & 0 deletions envs/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
dev:
domain: okchmp24.kseppler.com
certificate_arn: arn:aws:acm:us-east-1:799879571353:certificate/08dcf05b-792c-4bea-b7d5-75acc69a5813
app_function: app.app
aws_region: us-east-1
profile_name: personal
project_name: frontend
runtime: python3.11
s3_bucket: zappa-okc-chmp-frontend-dev
http_methods:
- GET
- POST
remote_env: s3://okchmp-dev-reg-config/frontend.json
parameter_depth: 1
memory_size: 512
use_precompiled_packages: true
39 changes: 39 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
python_ver := '3.11.5'
python_subdir := if os_family() == "windows" { "/Scripts" } else { "/bin" }
python_exec := if os_family() == "windows" { "/python.exe" } else { "/python3" }
system_python := if os_family() == "windows" { ".pyenv/shims" } else { "${HOME}/.pyenv/versions/" + python_ver + "/bin/python3" }
zappa := './.venv/' + python_subdir + '/zappa'

default:
@just --list

# Bootstrap Python Env. Valid Types: 'deploy' & 'dev'
bootstrap venv_dir='.venv' type="deploy":
if test ! -e {{ venv_dir }}; then {{ system_python }} -m venv {{ venv_dir }}; fi
./{{ venv_dir }}{{ python_subdir }}{{ python_exec }} -m pip install --upgrade pip
./{{ venv_dir }}{{ python_subdir }}{{ python_exec }} -m pip install --upgrade -r requirements.txt {{ if type == 'dev' { '-r dev_requirements.txt' } else { '' } }}

_aws_login AWS_PROFILE:
@aws --profile {{ AWS_PROFILE }} sts get-caller-identity || aws sso login

_zappa CMD ACCT ENV:
@just _aws_login "$(yq '.{{ ENV }}.profile_name' envs/{{ ACCT }}.yml)"
{{ zappa }} {{ CMD }} -s envs/{{ ACCT }}.yml {{ ENV }}

# Deploy new environment
deploy ACCT='test' ENV='dev': (_zappa "deploy" ACCT ENV)

# Certify new environment
certify ACCT='test' ENV='dev': (_zappa "certify" ACCT ENV)

# Update existing environment
update ACCT='test' ENV='dev': (_zappa "update" ACCT ENV)

# Check status of existing environment
status ACCT='test' ENV='dev': (_zappa "status" ACCT ENV)

# Check logs of running environment
logs ACCT='test' ENV='dev': (_zappa "tail" ACCT ENV)

# Undeploy a running environment
undeploy ACCT='test' ENV='dev': (_zappa "undeploy" ACCT ENV)

0 comments on commit 25349a8

Please sign in to comment.