-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
172 lines (135 loc) · 4.64 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
setup:
@echo "Setting up virtual environment"
poetry shell
install:
@echo "Installing dependencies"
poetry install
format:
@echo "Formating code"
chmod +x ./format.sh
./format.sh
lint:
@echo "Liting code"
chmod +x ./lint.sh
./lint.sh
test:
@echo "Running tests"
poetry run python -m pytest -vv tests/*.py --cov=tests
run-app:
@echo "Running local app with uvicorn"
poetry run uvicorn src.app.main:app --host 127.0.0.1 --port 8000
ask:
@echo "Running local app with ask"
curl -X POST http://localhost:8000/ask -H "Content-Type: application/json" -d '{"text":"What is Concurso Unificado?"}'
docker-inspect:
@echo "Inspecting Docker container"
docker inspect app
docker-build:
@echo "Building Docker container"
docker build -t app .
docker-run:
@echo "Starting Docker container"
chmod +x ./scripts/docker_run.sh
./scripts/docker_run.sh
deploy-lambda:
@echo "Building Lambda container"
chmod +x ./scripts/deploy_lambda.sh
./scripts/deploy_lambda.sh
lambda-test:
@echo "Testing Lambda function"
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}'
deploy-ecs:
@echo "Deploying to AWS"
chmod +x ./scripts/deploy.sh
./scripts/deploy.sh
hf-del-cache:
@echo "Deleting downloaded models"
huggingface-cli delete-cache
tf-init:
@echo "Initializing Terraform <Initialize the provider with plugin>"
chmod +x ./scripts/terraform_init.sh
./scripts/terraform_init.sh
tf-plan:
@echo "Planning Terraform <Preview of resources to be created>"
cd terraform/ && terraform plan -input=false
tf-outp:
@echo "Output Terraform <Output of resources to be created>"
cd terraform && terraform output
tf-destroy:
@echo "Destroying Terraform <Destroy infrastruture resources>"
cd terraform && terraform destroy -auto-approve
tf-fmt:
@echo "Formating Terraform <Auto-format Terraform code>"
cd terraform && terraform fmt -recursive
tf-val:
@echo "Validating Terraform <Validate Terraform code>"
cd terraform && terraform validate
tf-graph:
@echo "Graph Terraform <Graph Terraform code>"
cd terraform && mkdir -p visualize && terraform graph | dot -Tsvg > visualize/graph.svg
tf-plan-json:
@echo "Graph Terraform <Graph Terraform code>"
cd terraform && mkdir -p visualize && terraform plan -out=plan.out && terraform show -json plan.out > visualize/plan.json
tf-deploy:
@echo "Deploying Terraform <Deploy infrastruture resources>"
cd terraform && terraform fmt -recursive && terraform validate && terraform apply -auto-approve -input=false
tf-upload:
@echo "Uploading Terraform <Upload infrastruture resources>"
cd terraform && terraform init
chmod +x ./scripts/upload_state.sh
chmod +x ./scripts/terraform_migrate.sh
./scripts/upload_state.sh
./scripts/terraform_migrate.sh
tf-mgt:
@echo "Migrating Terraform <Migrate infrastructure resources>"
chmod +x ./scripts/terraform_migrate.sh
./scripts/terraform_migrate.sh
tf-refresh:
@echo "Refreshing Terraform <Refresh infrastruture resources>"
cd terraform && terraform refresh
tf-st-list:
@echo "List Terraform state <List infrastruture resources>"
cd terraform && terraform state list
json-fmt:
@echo "Formating JSON <Auto-format JSON code>"
jq . .aws/task-definition.json > temp.json && mv temp.json .aws/task-definition.json
jq . .aws/task-definition-actions.json > temp.json && mv temp.json .aws/task-definition-actions.json
aws-user:
@echo "Check current AWS user signed in to AWS CLI"
aws sts get-caller-identity
aws-region:
@echo "Check current AWS region"
aws configure get region
qdrant-create:
@echo "Create Qdrant collection"
poetry run python src/cli/qdrant_cli.py create
qdrant-delete:
@echo "Delete Qdrant collection"
poetry run python src/cli/qdrant_cli.py delete
qdrant-info:
@echo "Info Qdrant collection"
poetry run python src/cli/qdrant_cli.py info
upload_secrets:
@echo "Uploading secret to AWS Secret Manager"
chmod +x ./scripts/upload_secrets.sh
./scripts/upload_secrets.sh
zip-lambda:
@echo "Zipping Lambda function"
chmod +x ./scripts/package_lambda.sh
./scripts/package_lambda.sh
lambda-info:
@echo "Info Lambda functions"
aws lambda list-functions --max-items 10
install-tools:
@echo "Installing tools"
@echo "Installing tools"
chmod +x scripts/install_poetry.sh
chmod +x scripts/install_awscli.sh
chmod +x scripts/install_terraform.sh
@echo "Checking if Poetry is installed..."
@if ! command -v poetry &> /dev/null; then scripts/install_poetry.sh; fi
@echo "Checking if AWS CLI is installed..."
@if ! command -v aws &> /dev/null; then scripts/install_awscli.sh; fi
@echo "Checking if Terraform is installed..."
@if ! command -v terraform &> /dev/null; then scripts/install_terraform.sh; fi
all: install format lint