mirror of
https://github.com/StanGirard/quivr.git
synced 2024-08-17 00:50:37 +03:00
Feat/microservice aws (#976)
* feat(chat-service): added task definition * feat(ci): added ci
This commit is contained in:
parent
74da7dde2d
commit
d1dfd6c7ec
@ -14,6 +14,14 @@
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"command": [
|
||||
"uvicorn",
|
||||
"main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050"
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
|
102
.aws/task_definition_preview_chat.json
Normal file
102
.aws/task_definition_preview_chat.json
Normal file
@ -0,0 +1,102 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-preview-chat:1",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:600ff1ede02741c66853cc3e4e7f5001aaba3bc2",
|
||||
"cpu": 0,
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr-chat-5050-tcp",
|
||||
"containerPort": 5050,
|
||||
"hostPort": 5050,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"essential": true,
|
||||
"command": [
|
||||
"uvicorn",
|
||||
"chat_service:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050"
|
||||
],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/preview.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-preview-chat",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "quivr-preview-chat",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 1,
|
||||
"volumes": [],
|
||||
"status": "ACTIVE",
|
||||
"requiresAttributes": [
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-awslogs"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.env-files.s3"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.execution-role-ecr-pull"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
|
||||
},
|
||||
{
|
||||
"name": "ecs.capability.task-eni"
|
||||
},
|
||||
{
|
||||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
|
||||
}
|
||||
],
|
||||
"placementConstraints": [],
|
||||
"compatibilities": [
|
||||
"EC2",
|
||||
"FARGATE"
|
||||
],
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "256",
|
||||
"memory": "512",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
},
|
||||
"registeredAt": "2023-08-18T09:01:56.187Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
21
.github/workflows/aws-preview.yml
vendored
21
.github/workflows/aws-preview.yml
vendored
@ -10,11 +10,15 @@ env:
|
||||
AWS_REGION: eu-west-3 # set this to your preferred AWS region, e.g. us-west-1
|
||||
ECR_REPOSITORY: quivr # set this to your Amazon ECR repository name
|
||||
ECS_SERVICE: quivr-preview # set this to your Amazon ECS service name
|
||||
ECS_SERVICE_CHAT: quivr-preview-chat # set this to your Amazon ECS service name
|
||||
ECS_CLUSTER: quivr # set this to your Amazon ECS cluster name
|
||||
ECS_TASK_DEFINITION: .aws/task_definition_preview.json # set this to the path to your Amazon ECS task definition
|
||||
ECS_TASK_DEFINITION_CHAT: .aws/task_definition_preview_chat.json # set this to the path to your Amazon ECS task definition
|
||||
# file, e.g. .aws/task-definition.json
|
||||
CONTAINER_NAME: quivr # set this to the name of the container in the
|
||||
# containerDefinitions section of your task definition
|
||||
CONTAINER_NAME_CHAT: quivr-chat # set this to the name of the container in the
|
||||
# containerDefinitions section of your task definition
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@ -63,6 +67,14 @@ jobs:
|
||||
task-definition: ${{ env.ECS_TASK_DEFINITION }}
|
||||
container-name: ${{ env.CONTAINER_NAME }}
|
||||
image: ${{ steps.build-image.outputs.image }}
|
||||
|
||||
- name: Fill in the new image ID in the Amazon ECS task definition
|
||||
id: task-def-chat
|
||||
uses: aws-actions/amazon-ecs-render-task-definition@v1
|
||||
with:
|
||||
task-definition: ${{ env.ECS_TASK_DEFINITION_CHAT }}
|
||||
container-name: ${{ env.CONTAINER_NAME_CHAT }}
|
||||
image: ${{ steps.build-image.outputs.image }}
|
||||
|
||||
- name: Deploy Amazon ECS task definition
|
||||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
|
||||
@ -70,4 +82,11 @@ jobs:
|
||||
task-definition: ${{ steps.task-def.outputs.task-definition }}
|
||||
service: ${{ env.ECS_SERVICE }}
|
||||
cluster: ${{ env.ECS_CLUSTER }}
|
||||
wait-for-service-stability: true
|
||||
wait-for-service-stability: false
|
||||
- name: Deploy Amazon ECS task definition Chat
|
||||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
|
||||
with:
|
||||
task-definition: ${{ steps.task-def-chat.outputs.task-definition }}
|
||||
service: ${{ env.ECS_SERVICE_CHAT }}
|
||||
cluster: ${{ env.ECS_CLUSTER }}
|
||||
wait-for-service-stability: false
|
||||
|
@ -35,7 +35,6 @@ app = FastAPI()
|
||||
|
||||
add_cors_middleware(app)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup_event():
|
||||
if not os.path.exists(pypandoc.get_pandoc_path()):
|
||||
|
Loading…
Reference in New Issue
Block a user