forked from iusztinpaul/hands-on-llms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement CI/CD for the Streaming Pipeline (iusztinpaul#39)
* feat: Add push & pull streaming pipeline Docker image from ECR logic * feat: Wrap up CI pipeline * feat: Move CI to GitHub Actions * fix: GA file * fix: streaming pipeline CICD * feat: Implement deploy step on GA * refactor: Rename GA files * refactor: Rename GA files * fix: Missing AWS profile * fix: Missing ALPACA_API_SECRET * fix: Key issue * fix: Docker image name issue * feat: Add destory AWS SP GA * chore: Uncomment GA jobs * feat: Move CD only on manual trigger
- Loading branch information
1 parent
e9f7e7f
commit 520a038
Showing
16 changed files
with
286 additions
and
112 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,87 @@ | ||
name: Continuous Deployment (CD) for the Streaming Pipeline | ||
|
||
on: [workflow_dispatch] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REPOSITORY_NAME: streaming_pipeline | ||
|
||
jobs: | ||
build_and_push: | ||
name: Build and Push Docker Image to ECR | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Create ECR Repository | ||
id: ecr-repository | ||
uses: int128/create-ecr-repository-action@v1 | ||
with: | ||
repository: ${{ env.REPOSITORY_NAME }} | ||
|
||
- name: Build images & push to ECR | ||
uses: docker/build-push-action@v4 | ||
env: | ||
COMMIT_TAG: ${{ env.REPOSITORY_NAME }}:commit-${{ github.sha }} | ||
LATEST_TAG: ${{ env.REPOSITORY_NAME }}:latest | ||
with: | ||
context: ./modules/streaming_pipeline | ||
file: ./modules/streaming_pipeline/deploy/Dockerfile | ||
target: release | ||
tags: | | ||
${{ steps.login-ecr.outputs.registry }}/${{ env.COMMIT_TAG }} | ||
${{ steps.login-ecr.outputs.registry }}/${{ env.LATEST_TAG }} | ||
push: true | ||
|
||
deploy: | ||
name: Deploy & start the Docker image on an AWS EC2 Instance | ||
runs-on: ubuntu-latest | ||
needs: build_and_push | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install GNU Make | ||
id: install_make | ||
run: sudo apt-get update && sudo apt-get install -y make | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Remove current deployment | ||
id: undeploy_aws | ||
working-directory: ./modules/streaming_pipeline | ||
run: make undeploy_aws | ||
|
||
- name: Deploy to AWS | ||
id: deploy_aws | ||
working-directory: ./modules/streaming_pipeline | ||
run: make deploy_aws | ||
env: | ||
ALPACA_API_KEY: ${{ secrets.ALPACA_API_KEY }} | ||
ALPACA_API_SECRET: ${{ secrets.ALPACA_API_SECRET }} | ||
QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }} | ||
QDRANT_URL: ${{ secrets.QDRANT_URL }} | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
AWS_ECR_REPO_NAME: ${{ env.REPOSITORY_NAME }} |
2 changes: 1 addition & 1 deletion
2
.github/workflows/pep8_financial_bot.yaml → .github/workflows/ci_financial_bot.yaml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: pep8_financial_bot | ||
name: Continuous Integration (CI) for the Financial Bot | ||
|
||
on: [push] | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...ub/workflows/pep8_streaming_pipeline.yaml → .github/workflows/ci_streaming_pipeline.yaml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: pep8_streaming_pipeline | ||
name: Continuous Integration (CI) for the Streaming Pipeline | ||
|
||
on: [push] | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...hub/workflows/pep8_training_pipeline.yaml → .github/workflows/ci_training_pipeline.yaml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: pep8_training_pipeline | ||
name: Continuous Integration (CI) for the Training Pipeline | ||
|
||
on: [push] | ||
|
||
|
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,35 @@ | ||
name: Destroy the AWS infrastructure for the Streaming Pipeline | ||
|
||
on: [workflow_dispatch] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REPOSITORY_NAME: streaming_pipeline | ||
|
||
jobs: | ||
deploy: | ||
name: Destroy AWS infrastructure for the Streaming Pipeline | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install GNU Make | ||
id: install_make | ||
run: sudo apt-get update && sudo apt-get install -y make | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Destroy AWS infrastructure | ||
id: undeploy_aws | ||
working-directory: ./modules/streaming_pipeline | ||
run: make undeploy_aws |
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 |
---|---|---|
|
@@ -185,3 +185,4 @@ set_env_variables.sh | |
logs/ | ||
.DS_Store | ||
gradio_cached_examples | ||
trust_policy.json |
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
ALPACA_API_KEY=<YOUR_ALPACA_API_KEY> | ||
ALPACA_API_SECRET=<YOUR_ALPACA_API_SECRET> | ||
export ALPACA_API_KEY=<YOUR_ALPACA_API_KEY> | ||
export ALPACA_API_SECRET=<YOUR_ALPACA_API_SECRET> | ||
|
||
QDRANT_API_KEY=<YOUR_QDRANT_API_KEY> | ||
QDRANT_URL=<YOUR_QDRANT_URL> | ||
export QDRANT_API_KEY=<YOUR_QDRANT_API_KEY> | ||
export QDRANT_URL=<YOUR_QDRANT_URL> | ||
|
||
export AWS_ECR_REPO_NAME=streaming_pipeline | ||
export AWS_REGION=eu-central-1 | ||
export AWS_PROFILE=default |
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.