Skip to content

Commit

Permalink
Merge pull request #40 from sireto/feature/supportTemplate
Browse files Browse the repository at this point in the history
Feature/support template
  • Loading branch information
ankit-sapkota authored Jun 6, 2024
2 parents ba2c5f0 + 3de7c3a commit 850bd30
Show file tree
Hide file tree
Showing 226 changed files with 9,656 additions and 1,028 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/black-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
src: "./autonomous_agent_api"
src: "./autonomous-agents-api"
28 changes: 0 additions & 28 deletions .github/workflows/build-backend-image.yml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Docker Build and Deploy

on:
push:
branches:
- master
- dev
tags:
- "*"

jobs:
build_on_push:
runs-on: self-hosted
strategy:
matrix:
service:
- autonomous-agent-manager
- autonomous-agents-api
- autonomous-agent
- autonomous-agent-frontend
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ vars.DOCKER_REGISTRY_HOST }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_SECRET }}

- name: Build and push Docker image
id: docker_build
env:
SERVICE_NAME: ${{ matrix.service }}
run: |
REPO_NAME="${GITHUB_REPOSITORY##*/}"
COMMON_TAG="${{ github.ref_name }}"
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
COMMON_TAG="latest"
fi
IMAGE_NAME="${{ vars.DOCKER_REGISTRY_HOST }}/${REPO_NAME}/${SERVICE_NAME}"
docker build -t "$IMAGE_NAME:${{ github.sha }}" -t "$IMAGE_NAME:$COMMON_TAG" ${SERVICE_NAME}
docker push "$IMAGE_NAME:${{ github.sha }}"
docker push "$IMAGE_NAME:$COMMON_TAG"
deploy_services:
needs: build_on_push
strategy:
matrix:
service:
- autonomous-agent-manager
- autonomous-agents-api
- autonomous-agent
max-parallel: 1

runs-on: self-hosted
env:
SERVICE_NAME: ${{ matrix.service }}
GITHUB_REPOSITORY: ${{ github.repository }}

steps:
- name: Deploy built image
id: docker_deploy
run: |
REPO_NAME="${GITHUB_REPOSITORY##*/}"
IMAGE_NAME="${{ vars.DOCKER_REGISTRY_HOST }}/${REPO_NAME}/${SERVICE_NAME}"
DEPLOY_TAG="${{ github.sha }}"
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
DOCKER_HOST="${{ vars.PROD_HOST }}"
DOCKER_STACK="${REPO_NAME}"
DEPLOY_TAG="${{ github.ref_name }}"
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
DOCKER_HOST="${{ vars.DEV_HOST }}"
DOCKER_STACK="${{ vars.DEV_STACK }}"
elif [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
DOCKER_HOST="${{ vars.STAGING_HOST }}"
DOCKER_STACK="${REPO_NAME}_staging"
fi
docker --host "$DOCKER_HOST" service update --image $IMAGE_NAME:$DEPLOY_TAG ${DOCKER_STACK}_${SERVICE_NAME}
6 changes: 3 additions & 3 deletions .github/workflows/test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ jobs:
python-version: 3.12.2

- name: Install Poetry
working-directory: autonomous_agent_api
working-directory: autonomous-agents-api
run: pip install poetry==1.8.2

- name: Install Dependencies
working-directory: autonomous_agent_api
working-directory: autonomous-agents-api
run: |
poetry install
poetry run prisma generate
- name: Run test cases
working-directory: autonomous_agent_api
working-directory: autonomous-agents-api
env:
DATABASE_URL : ""
run: poetry run pytest -m github_actions
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Cardano Autonomous Agent Monorepo
============

1. [Backend](./autonomous_agent_api/)
2. [Frontend](./automonous_agent_frontend/)
1. [Backend](autonomous-agents-api/)
2. [Agent Manager](autonomous-agent-manager/)
3. [Agent](autonomous-agent/)
4. [Frontend](./automonous_agent_frontend/)

Python version : 3.12.2


- docker-compose.local - ( Docker Container for Postgres database and pgadmin4 )
Python version : 3.12.2

- For Backend setup refer to autonomous_agent_api/readme guide.
- docker-compose.local - ( Docker Container for Postgres database,kafka, pgadmin4 )

- For further Setup details go to each directory's READ ME docs....
70 changes: 0 additions & 70 deletions agent_manager/src/repository/agent_manager_repository.ts

This file was deleted.

86 changes: 0 additions & 86 deletions agent_manager/src/service/agent_manager_service.ts

This file was deleted.

File renamed without changes.
21 changes: 21 additions & 0 deletions autonomous-agent-manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use Node.js base image with a specific version (you can change this as needed)
FROM node:18-alpine

# Set working directory in the container
WORKDIR /app

# Copy package.json and yarn.lock to the container
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --frozen-lockfile --production

# Copy the rest of the application code to the container
COPY . .

RUN yarn prisma generate
# Expose the port the app runs on (if applicable)
EXPOSE 3001

# Command to run the application
CMD ["yarn", "start"]
Loading

0 comments on commit 850bd30

Please sign in to comment.