Skip to content

Commit

Permalink
Merge pull request #33 from topoteretes/feature/test_deployment_of_do…
Browse files Browse the repository at this point in the history
…cker

Build the docker and push
  • Loading branch information
Vasilije1990 authored Jan 23, 2024
2 parents e3f3633 + dab514f commit e189213
Show file tree
Hide file tree
Showing 85 changed files with 4,331 additions and 3,112 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 8 additions & 4 deletions level_4/.env.template → .env.template
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
OPENAI_API_KEY=sk
WEAVIATE_URL =
WEAVIATE_API_KEY =
ENVIRONMENT = docker
ENV = docker
POSTGRES_USER = bla
POSTGRES_PASSWORD = bla
POSTGRES_DB = bubu
POSTGRES_HOST = localhost
POSTGRES_HOST_DOCKER = postgres
SEGMENT_KEY = Etl4WJwzOkeDPAjaOXOMgyU16hO7mV7B
COG_ARCH_DIR = cognitive_architecture
GRAPH_DB_URL =
GRAPH_DB_PW =
GRAPH_DB_USER =
GRAPH_DB_URL =
GRAPH_DB_PW =
GRAPH_DB_USER =
AWS_ACCESS_KEY_ID =
AWS_SECRET_ACCESS_KEY =
QDRANT_API_KEY
QDRANT_API_URL
1 change: 0 additions & 1 deletion .github/actions/image_builder/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ runs:
image_name="${{ inputs.ecr_image_repo_name }}" docker_login="true" version="$VERSION" account="${{ inputs.aws_account_id }}" app_dir="$APP_DIR" publish="${{ inputs.should_publish }}" ./bin/dockerize
echo "Docker tag is: $VERSION"
echo $VERSION > /tmp/.DOCKER_IMAGE_VERSION
36 changes: 18 additions & 18 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
stage: dev
aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }}
should_publish: true
ecr_image_repo_name: promethai-dev-backend-promethai-backend-memory
dockerfile_location: level_2/.
ecr_image_repo_name: promethai-dev-backend-promethai-backend
dockerfile_location: ./
- name: Export Docker image tag
id: export-promethai-docker-tag
run: |
Expand All @@ -58,19 +58,19 @@ jobs:
outputs:
promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }}

# apply_tf:
# name: Trigger terraform apply workflow
# runs-on: ubuntu-latest
# needs: publish_docker_to_ecr
# steps:
# - name: TF apply workflow triggers step
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'topoteretes',
# repo: 'PromethAI-Infra',
# workflow_id: 'terraform.apply.yml',
# ref: 'main'
# })
apply_tf:
name: Trigger terraform apply workflow
runs-on: ubuntu-latest
needs: publish_docker_to_ecr
steps:
- name: TF apply workflow triggers step
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'topoteretes',
repo: 'PromethAI-Infra',
workflow_id: 'terraform.apply.yml',
ref: 'main'
})
100 changes: 50 additions & 50 deletions .github/workflows/cd_prd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ jobs:
steps:
- name: Take code from repo
uses: actions/checkout@v3
# - name: Set environment variable for stage
# id: set-env
# run: |
# if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# echo "STAGE=prd" >> $GITHUB_ENV
# echo "::set-output name=stage::prd"
# else
# echo "STAGE=dev" >> $GITHUB_ENV
# echo "::set-output name=stage::dev"
# fi
# - name: Use output
# run: echo "The stage is ${{ steps.set-env.outputs.stage }}"
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }}
# aws-region: eu-west-1
# - name: Create Docker image and push to ECR
# uses: ./.github/actions/image_builder
# id: generate-promethai-docker
# with:
# stage: prd
# aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }}
# should_publish: true
# ecr_image_repo_name: promethai-prd-backend-promethai-backend-memory
# dockerfile_location: ./level_2
# - name: Export Docker image tag
# id: export-promethai-docker-tag
# run: |
# export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
# echo "Docker tag is: $DOCKER_TAG"
# echo "promethai_docker_tag_backend=$DOCKER_TAG" >> $GITHUB_OUTPUT
- name: Set environment variable for stage
id: set-env
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "STAGE=prd" >> $GITHUB_ENV
echo "::set-output name=stage::prd"
else
echo "STAGE=dev" >> $GITHUB_ENV
echo "::set-output name=stage::dev"
fi
- name: Use output
run: echo "The stage is ${{ steps.set-env.outputs.stage }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.AWS_ROLE_DEV_CICD }}
aws-region: eu-west-1
- name: Create Docker image and push to ECR
uses: ./.github/actions/image_builder
id: generate-promethai-docker
with:
stage: prd
aws_account_id: ${{ env.AWS_ACCOUNT_ID_DEV }}
should_publish: true
ecr_image_repo_name: promethai-prd-backend-promethai-backend
dockerfile_location: ./
- name: Export Docker image tag
id: export-promethai-docker-tag
run: |
export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
echo "Docker tag is: $DOCKER_TAG"
echo "promethai_docker_tag_backend=$DOCKER_TAG" >> $GITHUB_OUTPUT
# - name: Create Tag and Release
# runs-on: ubuntu-latest
Expand All @@ -78,22 +78,22 @@ jobs:
# with:
# tag_name: ${{ steps.bump_version_and_push_tag.outputs.tag }}
# release_name: Release ${{ steps.bump_version_and_push_tag.outputs.tag }}
# outputs:
# promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }}
outputs:
promethai_docker_tag_backend: ${{ steps.export-promethai-docker-tag.outputs.promethai_docker_tag_backend }}

# apply_tf:
# name: Trigger terraform apply workflow
# runs-on: ubuntu-latest
# needs: publish_docker_to_ecr
# steps:
# - name: TF apply workflow triggers step
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'topoteretes',
# repo: 'PromethAI-Infra',
# workflow_id: 'terraform.apply.yml',
# ref: 'main'
# })
apply_tf:
name: Trigger terraform apply workflow
runs-on: ubuntu-latest
needs: publish_docker_to_ecr
steps:
- name: TF apply workflow triggers step
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'topoteretes',
repo: 'PromethAI-Infra',
workflow_id: 'terraform.apply.yml',
ref: 'main'
})
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
export SHA_SHORT="$(git rev-parse --short HEAD)"
export CUR_DATE="$(date +%Y%m%d%H%M%S)"
export VERSION="dev-$CUR_DATE-$SHA_SHORT"
image_name="backend-memory" docker_login="false" version="$VERSION" account="${{ env.AWS_ACCOUNT_ID_DEV }}" app_dir="level_2" publish="false" ./bin/dockerize
export DOCKER_TAG=$(cat level_2/tmp/.DOCKER_IMAGE_VERSION)
image_name="backend" docker_login="false" version="$VERSION" account="${{ env.AWS_ACCOUNT_ID_DEV }}" app_dir="backend" publish="false" ./bin/dockerize
export DOCKER_TAG=$(cat /tmp/.DOCKER_IMAGE_VERSION)
echo "Successfully built PromethAI backend Docker tag is: $DOCKER_TAG"
File renamed without changes.
1 change: 1 addition & 0 deletions level_4/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update -q && \
curl \
zip \
jq \
# libgl1-mesa-glx \
netcat-traditional && \
pip install poetry && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
Expand Down
Loading

0 comments on commit e189213

Please sign in to comment.