mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-08-16 09:50:22 +03:00
Feat/preview env (#399)
* feat(preview): added * feat(vercel): preview env
This commit is contained in:
parent
3946dbc668
commit
4ce080b785
95
.aws/task_definition_preview.json
Normal file
95
.aws/task_definition_preview.json
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"taskDefinitionArn": "arn:aws:ecs:eu-west-3:253053805092:task-definition/quivr-preview:4",
|
||||
"containerDefinitions": [
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:c0ff0301002fe6d043270b26dabcfda797437afc",
|
||||
"cpu": 0,
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr-5050-tcp",
|
||||
"containerPort": 5050,
|
||||
"hostPort": 5050,
|
||||
"protocol": "tcp",
|
||||
"appProtocol": "http"
|
||||
}
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
{
|
||||
"value": "arn:aws:s3:::quivr-env-variables/preview.env",
|
||||
"type": "s3"
|
||||
}
|
||||
],
|
||||
"mountPoints": [],
|
||||
"volumesFrom": [],
|
||||
"ulimits": [],
|
||||
"logConfiguration": {
|
||||
"logDriver": "awslogs",
|
||||
"options": {
|
||||
"awslogs-create-group": "true",
|
||||
"awslogs-group": "/ecs/quivr-preview",
|
||||
"awslogs-region": "eu-west-3",
|
||||
"awslogs-stream-prefix": "ecs"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"family": "quivr-preview",
|
||||
"taskRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"executionRoleArn": "arn:aws:iam::253053805092:role/ecsTaskExecutionRole",
|
||||
"networkMode": "awsvpc",
|
||||
"revision": 4,
|
||||
"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-06-29T07:33:39.537Z",
|
||||
"registeredBy": "arn:aws:iam::253053805092:root",
|
||||
"tags": []
|
||||
}
|
71
.github/workflows/aws-preview.yml
vendored
Normal file
71
.github/workflows/aws-preview.yml
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
name: Deploy to Amazon ECS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
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_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
|
||||
# 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
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./backend
|
||||
environment: production
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: ${{ env.AWS_REGION }}
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
|
||||
- name: Build, tag, and push image to Amazon ECR
|
||||
id: build-image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
run: |
|
||||
# Build a docker container and
|
||||
# push it to ECR so that it can
|
||||
# be deployed to ECS.
|
||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Fill in the new image ID in the Amazon ECS task definition
|
||||
id: task-def
|
||||
uses: aws-actions/amazon-ecs-render-task-definition@v1
|
||||
with:
|
||||
task-definition: ${{ env.ECS_TASK_DEFINITION }}
|
||||
container-name: ${{ env.CONTAINER_NAME }}
|
||||
image: ${{ steps.build-image.outputs.image }}
|
||||
|
||||
- name: Deploy Amazon ECS task definition
|
||||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
|
||||
with:
|
||||
task-definition: ${{ steps.task-def.outputs.task-definition }}
|
||||
service: ${{ env.ECS_SERVICE }}
|
||||
cluster: ${{ env.ECS_CLUSTER }}
|
||||
wait-for-service-stability: true
|
5
.github/workflows/aws.yml
vendored
5
.github/workflows/aws.yml
vendored
@ -1,8 +1,9 @@
|
||||
name: Deploy to Amazon ECS
|
||||
|
||||
on:
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
AWS_REGION: eu-west-3 # set this to your preferred AWS region, e.g. us-west-1
|
||||
|
20
.github/workflows/vercel-preview.yml
vendored
Normal file
20
.github/workflows/vercel-preview.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Preview Deployment
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
jobs:
|
||||
Deploy-Preview:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Vercel CLI
|
||||
run: npm install --global vercel@latest
|
||||
- name: Pull Vercel Environment Information
|
||||
run: vercel pull --yes --environment=development --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Build Project Artifacts
|
||||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Deploy Project Artifacts to Vercel
|
||||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
|
22
.github/workflows/vercel.yml
vendored
Normal file
22
.github/workflows/vercel.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: Production Tag Deployment
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
on:
|
||||
push:
|
||||
# Pattern matched against refs/tags
|
||||
tags:
|
||||
- '*' # Push events to every tag not containing /
|
||||
jobs:
|
||||
Deploy-Production:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Vercel CLI
|
||||
run: npm install --global vercel@latest
|
||||
- name: Pull Vercel Environment Information
|
||||
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Build Project Artifacts
|
||||
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Deploy Project Artifacts to Vercel
|
||||
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
|
7
vercel.json
Normal file
7
vercel.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"git": {
|
||||
"deploymentEnabled": {
|
||||
"main": false
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user