Adds final version with new prompt
This commit is contained in:
@@ -21,12 +21,12 @@ config:
|
||||
- 3.14.44.224/32
|
||||
ecs_subnet_ids:
|
||||
- subnet-0f50f25a2fbb054d4
|
||||
- subnet-0014ea77951bbeb6c
|
||||
- subnet-043a427630309c2f4
|
||||
app-ecs:ecs:
|
||||
- task_name: assisnte-analitico-db-dev
|
||||
ecr_repo_name: assistente-analitico-db-dev
|
||||
ecr_image_tag: latest
|
||||
ecr_image_digest: sha256:7a2aede33d8dd34822b73291d64e1ccce26980fc531290c54d992bcb7dee26fa
|
||||
ecr_image_digest: sha256:c9cd83a7caf51e7eee471d47649bbe0157d4c2703f365010f12997e63d941d3d
|
||||
cpu: 256
|
||||
memory: 512
|
||||
desired_count: 1
|
||||
@@ -36,11 +36,15 @@ config:
|
||||
min_capacity: 1
|
||||
max_capacity: 3
|
||||
target_value: 60.0
|
||||
lb_config:
|
||||
name: listener
|
||||
lb_configs:
|
||||
- name: streamlit
|
||||
listener_port: 8501
|
||||
target_port: 8501
|
||||
container_port: 8501
|
||||
- name: api
|
||||
listener_port: 8000
|
||||
target_port: 8000
|
||||
container_port: 8000
|
||||
env_variables:
|
||||
LANGFUSE_HOST: http://172.31.252.176:3000
|
||||
# SECRET_NAME: dev/ai-pge-doc-classification
|
||||
|
||||
@@ -6,33 +6,42 @@ import ecr
|
||||
import json
|
||||
|
||||
def deploy_app(config_ecs_app, app_ecs_cluster, alb_security_group, app_load_balancer_arn):
|
||||
lb_config = config_ecs_app["lb_config"]
|
||||
target_group = aws.lb.TargetGroup(f"app-target-group-{lb_config['listener_port']}",
|
||||
port=lb_config["target_port"],
|
||||
protocol="HTTP",
|
||||
vpc_id=config.network["vpc_id"],
|
||||
target_type="ip",
|
||||
health_check=aws.lb.TargetGroupHealthCheckArgs(
|
||||
path="/", # TODO if it doesn't work, can use /docs for fastapi
|
||||
protocol="HTTP",
|
||||
port="traffic-port",
|
||||
healthy_threshold=2,
|
||||
unhealthy_threshold=2,
|
||||
timeout=5,
|
||||
interval=30,
|
||||
matcher="200-499",
|
||||
),
|
||||
)
|
||||
aws.lb.Listener(f"app-listener-{lb_config['listener_port']}",
|
||||
load_balancer_arn=app_load_balancer_arn,
|
||||
port=lb_config["listener_port"],
|
||||
protocol="HTTP",
|
||||
default_actions=[aws.lb.ListenerDefaultActionArgs(
|
||||
type="forward",
|
||||
target_group_arn=target_group.arn,
|
||||
)],
|
||||
)
|
||||
# target_groups.append(target_group)
|
||||
lb_configs = config_ecs_app["lb_configs"]
|
||||
target_groups = []
|
||||
load_balancers = []
|
||||
|
||||
for lb_config in lb_configs:
|
||||
tg = aws.lb.TargetGroup(f"app-target-group-{lb_config['listener_port']}",
|
||||
port=lb_config["target_port"],
|
||||
protocol="HTTP",
|
||||
vpc_id=config.network["vpc_id"],
|
||||
target_type="ip",
|
||||
health_check=aws.lb.TargetGroupHealthCheckArgs(
|
||||
path="/",
|
||||
protocol="HTTP",
|
||||
port="traffic-port",
|
||||
healthy_threshold=2,
|
||||
unhealthy_threshold=2,
|
||||
timeout=5,
|
||||
interval=30,
|
||||
matcher="200-499",
|
||||
),
|
||||
)
|
||||
aws.lb.Listener(f"app-listener-{lb_config['listener_port']}",
|
||||
load_balancer_arn=app_load_balancer_arn,
|
||||
port=lb_config["listener_port"],
|
||||
protocol="HTTP",
|
||||
default_actions=[aws.lb.ListenerDefaultActionArgs(
|
||||
type="forward",
|
||||
target_group_arn=tg.arn,
|
||||
)],
|
||||
)
|
||||
target_groups.append(tg)
|
||||
load_balancers.append(aws.ecs.ServiceLoadBalancerArgs(
|
||||
target_group_arn=tg.arn,
|
||||
container_name=f"{config.project_name}-{config_ecs_app['task_name']}-{config.environment}-service",
|
||||
container_port=lb_config["target_port"],
|
||||
))
|
||||
|
||||
# Build and Push ECR
|
||||
# ecr_repos = ecr.create_ecr_repo(config_ecs_app['ecr_repo_name'])
|
||||
@@ -79,12 +88,11 @@ def deploy_app(config_ecs_app, app_ecs_cluster, alb_security_group, app_load_bal
|
||||
"cpu": 0,
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "api",
|
||||
"containerPort": lb_config["container_port"],
|
||||
"hostPort": lb_config["target_port"],
|
||||
"name": lb_cfg["name"],
|
||||
"containerPort": lb_cfg["container_port"],
|
||||
"hostPort": lb_cfg["target_port"],
|
||||
"protocol": "tcp",
|
||||
}
|
||||
# } for lb_config_item in lb_configs
|
||||
} for lb_cfg in lb_configs
|
||||
],
|
||||
"essential": True,
|
||||
"logConfiguration": {
|
||||
@@ -135,12 +143,6 @@ def deploy_app(config_ecs_app, app_ecs_cluster, alb_security_group, app_load_bal
|
||||
)
|
||||
|
||||
# ECS Service Setup
|
||||
load_balancer = aws.ecs.ServiceLoadBalancerArgs(
|
||||
target_group_arn=target_group.arn,
|
||||
container_name=f"{config.project_name}-{config_ecs_app['task_name']}-{config.environment}-service",
|
||||
container_port=lb_config["target_port"],
|
||||
)
|
||||
|
||||
app_service = aws.ecs.Service(f"{config.project_name}-{config_ecs_app['task_name']}-service",
|
||||
cluster=app_ecs_cluster.arn,
|
||||
task_definition=app_task_definition.arn,
|
||||
@@ -151,7 +153,7 @@ def deploy_app(config_ecs_app, app_ecs_cluster, alb_security_group, app_load_bal
|
||||
security_groups=[app_ecs_security_group.id],
|
||||
subnets=config.network["ecs_subnet_ids"],
|
||||
),
|
||||
load_balancers=[load_balancer],
|
||||
load_balancers=load_balancers,
|
||||
scheduling_strategy="REPLICA",
|
||||
service_connect_configuration=aws.ecs.ServiceServiceConnectConfigurationArgs(
|
||||
enabled=True,
|
||||
|
||||
@@ -186,7 +186,10 @@ def create_task_role():
|
||||
"dynamodb:Query",
|
||||
"dynamodb:DescribeTable"
|
||||
],
|
||||
"Resource": "arn:aws:dynamodb:us-east-1:305427701314:table/poc_dnx_monthly_summary"
|
||||
"Resource": [
|
||||
"arn:aws:dynamodb:us-east-1:305427701314:table/poc_dnx_monthly_summary",
|
||||
"arn:aws:dynamodb:us-east-1:305427701314:table/poc_dnx_monthly_summary/index/*"
|
||||
]
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user