-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Flagsmith/Release/v2.1.0
Release v2.1.0
- Loading branch information
Showing
14 changed files
with
422 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Deploy SSE to ECS | ||
description: "Deploy the SSE service to ECS" | ||
|
||
inputs: | ||
aws_access_key_id: | ||
description: "The AWS access key ID to use for deploying to ECS." | ||
required: true | ||
aws_secret_access_key: | ||
description: "The AWS secret access key to use for deploying to ECS." | ||
required: true | ||
aws_ecs_cluster_name: | ||
description: "The name of the ECS cluster to deploy to." | ||
required: true | ||
aws_ecs_service_name: | ||
description: "The name of the ECS service to deploy to." | ||
required: true | ||
aws_ecr_repository_arn: | ||
description: "The ARN of the ECR repository to deploy docker image to." | ||
required: true | ||
aws_task_definitions_directory_path: | ||
description: "The local path in the repository to the json file containing the task definition template" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Set ECR tag | ||
id: ecr-tag-variable | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | ||
shell: bash | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ inputs.aws_access_key_id }} | ||
aws-secret-access-key: ${{ inputs.aws_secret_access_key }} | ||
aws-region: eu-west-2 | ||
|
||
- 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: | ||
IMAGE_TAG: ${{ steps.ecr-tag-variable.outputs.tag }} | ||
ECR_REPOSITORY: ${{ inputs.aws_ecr_repository_arn }} | ||
DOCKER_BUILDKIT: "1" | ||
run: | | ||
echo "Building docker image with URL: " | ||
echo $ECR_REPOSITORY:$IMAGE_TAG | ||
docker build -t $ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile . | ||
docker push $ECR_REPOSITORY:$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REPOSITORY:$IMAGE_TAG" | ||
shell: bash | ||
|
||
- name: Fill in the new image ID in the Amazon SSE task definition | ||
id: task-def-api | ||
uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
with: | ||
task-definition: ${{ inputs.aws_task_definitions_directory_path }}/ecs-task-definition-sse.json | ||
container-name: flagsmith-sse | ||
image: ${{ steps.build-image.outputs.image }} | ||
|
||
- name: Deploy Amazon ECS SSE task definition | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
cluster: ${{ inputs.aws_ecs_cluster_name }} | ||
service: ${{ inputs.aws_ecs_service_name }} | ||
task-definition: ${{ steps.task-def-api.outputs.task-definition }} | ||
|
||
- name: Wait for service to be stable | ||
run: aws ecs wait services-stable --cluster ${{ inputs.aws_ecs_cluster_name }} --services ${{ inputs.aws_ecs_service_name }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy SSE to Staging ECS | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "api/**" | ||
- ".github/**" | ||
- 'infrastructure/aws/staging/**' | ||
|
||
jobs: | ||
deploy-staging-ecs: | ||
runs-on: ubuntu-latest | ||
name: Deploy SSE to Staging ECS | ||
environment: staging | ||
|
||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Deploy SSE to Staging | ||
uses: ./.github/actions/sse-deploy-ecs | ||
with: | ||
aws_access_key_id: AKIAUM26IRCPH7BHBLVE | ||
aws_secret_access_key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }} | ||
aws_ecs_cluster_name: flagsmith-api-cluster-eu-west-2-f241261 | ||
aws_ecs_service_name: flagsmith-sse-svc-eu-west-2-43f7af2 | ||
aws_ecr_repository_arn: 302456015006.dkr.ecr.eu-west-2.amazonaws.com/flagsmith-sse-ecr-fa16ac8 | ||
aws_task_definitions_directory_path: infrastructure/aws/staging | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"family": "flagsmith-sse", | ||
"networkMode": "awsvpc", | ||
"executionRoleArn": "arn:aws:iam::302456015006:role/task-sse-role-8474d2a", | ||
"taskRoleArn": "arn:aws:iam::302456015006:role/task-sse-role-8474d2a", | ||
"containerDefinitions": [ | ||
{ | ||
"name": "flagsmith-sse", | ||
"command": [ | ||
"uvicorn", | ||
"src.main:app", | ||
"--host", | ||
"0.0.0.0", | ||
"--port", | ||
"8000", | ||
"--no-access-log" | ||
], | ||
"cpu": 0, | ||
"portMappings": [ | ||
{ | ||
"containerPort": 8000, | ||
"hostPort": 8000, | ||
"protocol": "tcp" | ||
} | ||
], | ||
"essential": true, | ||
"environment": [], | ||
"secrets": [], | ||
"logConfiguration": { | ||
"logDriver": "awslogs", | ||
"options": { | ||
"awslogs-group": "flagsmith-sse-eu-west-2-4a10ba2", | ||
"awslogs-region": "eu-west-2", | ||
"awslogs-stream-prefix": "awslogs-flagsmith-sse" | ||
} | ||
} | ||
} | ||
], | ||
"requiresCompatibilities": [ | ||
"FARGATE" | ||
], | ||
"cpu": "1024", | ||
"memory": "2048" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.