Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] .gh for shared services #2459

Merged
merged 4 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/workflows/push-to-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
env:
BACKEND_IMAGE_NAME: agenta-backend
WEB_IMAGE_NAME: agenta-web
CHAT_IMAGE_NAME: agenta-chat
COMPLETION_IMAGE_NAME: agenta-completion
IMAGE_OWNER_NAME: agenta-ai
REPOSITORY_USERNAME: ${{ github.actor }}

Expand Down Expand Up @@ -38,14 +40,32 @@ jobs:
- name: Build, tag and push Backend image to Github Container Registry
id: build-backend-image
run: |
set -e
cd agenta-backend
docker build -t ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.BACKEND_IMAGE_NAME }} -f Dockerfile.gh .
docker push ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.BACKEND_IMAGE_NAME }}
docker push ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.BACKEND_IMAGE_NAME }} || echo "Push (backend) failed"

- name: Build, tag and push Web image to Github Container Registry
id: build-web-image
run: |
set -e
cd agenta-web
docker build --no-cache -t ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.WEB_IMAGE_NAME }} -f prod.gh.Dockerfile .
docker push ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.WEB_IMAGE_NAME }}
docker push ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.WEB_IMAGE_NAME }} || echo "Push (web) failed"

- name: Build, tag and push Chat image to Github Container Registry
id: build-chat-image
run: |
set -e
cd services/chat
docker build --no-cache -t ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.CHAT_IMAGE_NAME }} -f Dockerfile.gh .
docker push ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.CHAT_IMAGE_NAME }} || echo "Push (chat) failed"

- name: Build, tag and push Completion image to Github Container Registry
id: build-completion-image
run: |
set -e
cd services/completion
docker build --no-cache -t ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.COMPLETION_IMAGE_NAME }} -f Dockerfile.gh .
docker push ghcr.io/${{ env.IMAGE_OWNER_NAME }}/${{ env.COMPLETION_IMAGE_NAME }} || echo "Push (completion) failed"

8 changes: 4 additions & 4 deletions agenta-backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ FROM python:3.9-slim-buster

WORKDIR /app

# Install git and clone the necessary repository
RUN apt-get update -y \
&& apt-get install -y git

# Ensure pip and poetry are up to date
RUN pip install --upgrade pip \
&& pip install poetry

# Install git and clone the necessary repository
RUN apt-get update -y \
&& apt-get install -y git

# Copy only requirements and alembic configuration file
# to cache them in docker layer
COPY pyproject.toml poetry.lock* alembic.* README.md /app/
Expand Down
2 changes: 1 addition & 1 deletion agenta-cli/agenta/sdk/agenta_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def init(
or "https://cloud.agenta.ai"
)

log.info("Agenta - host: %s", self.host)
log.info("Agenta - Host: %s", self.host)

self.app_id = app_id or config.get("app_id") or getenv("AGENTA_APP_ID")
# if not self.app_id:
Expand Down
4 changes: 1 addition & 3 deletions agenta-cli/agenta/sdk/decorators/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

app.include_router(router, prefix=AGENTA_RUNTIME_PREFIX)

log.error("Agenta - Runtime Prefix:" + AGENTA_RUNTIME_PREFIX)
log.info("Agenta - Runtime Prefix:" + (AGENTA_RUNTIME_PREFIX or None))


class PathValidator(BaseModel):
Expand Down Expand Up @@ -645,8 +645,6 @@ def openapi(self):
# ✅ Add Agenta SDK version info
openapi_schema["agenta_sdk"] = {"version": get_current_version()}

print(openapi_schema)

return openapi_schema

def override_config_in_schema(
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,22 @@ services:
postgres:
condition: service_healthy

completion:
image: ghcr.io/agenta-ai/agenta-completion
extends:
file: ./services/completion/docker-compose.gh.yml
service: completion
environment:
- AGENTA_HOST=${DOMAIN_NAME:-http://host.docker.internal}:${AGENTA_PORT:-80}

chat:
image: ghcr.io/agenta-ai/agenta-chat
extends:
file: ./services/chat/docker-compose.gh.yml
service: chat
environment:
- AGENTA_HOST=${DOMAIN_NAME:-http://host.docker.internal}:${AGENTA_PORT:-80}

networks:
agenta-network:
name: agenta-network
Expand Down
15 changes: 15 additions & 0 deletions services/chat/Dockerfile.gh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.10-slim

ARG ROOT_PATH=/
ENV ROOT_PATH=${ROOT_PATH}

WORKDIR /app

COPY . .

RUN pip install --upgrade pip \
&& pip install --no-cache-dir agenta openai python-dotenv uvicorn "litellm>=1.0,<2.0" google-generativeai

EXPOSE 80

CMD ["python", "main.py"]
34 changes: 34 additions & 0 deletions services/chat/docker-compose.gh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
chat:
build:
context: .
dockerfile: Dockerfile.gh
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- MISTRAL_API_KEY=${MISTRAL_API_KEY}
- COHERE_API_KEY=${COHERE_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- ANYSCALE_API_KEY=${ANYSCALE_API_KEY}
- PERPLEXITYAI_API_KEY=${PERPLEXITYAI_API_KEY}
- DEEPINFRA_API_KEY=${DEEPINFRA_API_KEY}
- TOGETHERAI_API_KEY=${TOGETHERAI_API_KEY}
- ALEPHALPHA_API_KEY=${ALEPHALPHA_API_KEY}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- GROQ_API_KEY=${GROQ_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
networks:
- agenta-network
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
- "traefik.http.routers.chat.rule=PathPrefix(`/services/chat/`)"
- "traefik.http.routers.chat.entrypoints=web"
- "traefik.http.middlewares.chat-strip.stripprefix.prefixes=/services/chat"
- "traefik.http.middlewares.chat-strip.stripprefix.forceslash=true"
- "traefik.http.routers.chat.middlewares=chat-strip"
- "traefik.http.services.chat.loadbalancer.server.port=80"
- "traefik.http.routers.chat.service=chat"

networks:
agenta-network:
external: true
15 changes: 15 additions & 0 deletions services/completion/Dockerfile.gh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.10-slim

ARG ROOT_PATH=/
ENV ROOT_PATH=${ROOT_PATH}

WORKDIR /app

COPY . .

RUN pip install --upgrade pip \
&& pip install --no-cache-dir agenta openai python-dotenv uvicorn "litellm>=1.0,<2.0" google-generativeai

EXPOSE 80

CMD ["python", "main.py"]
34 changes: 34 additions & 0 deletions services/completion/docker-compose.gh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
completion:
build:
context: .
dockerfile: Dockerfile.gh
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- MISTRAL_API_KEY=${MISTRAL_API_KEY}
- COHERE_API_KEY=${COHERE_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- ANYSCALE_API_KEY=${ANYSCALE_API_KEY}
- PERPLEXITYAI_API_KEY=${PERPLEXITYAI_API_KEY}
- DEEPINFRA_API_KEY=${DEEPINFRA_API_KEY}
- TOGETHERAI_API_KEY=${TOGETHERAI_API_KEY}
- ALEPHALPHA_API_KEY=${ALEPHALPHA_API_KEY}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- GROQ_API_KEY=${GROQ_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
networks:
- agenta-network
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
- "traefik.http.routers.completion.rule=PathPrefix(`/services/completion/`)"
- "traefik.http.routers.completion.entrypoints=web"
- "traefik.http.middlewares.completion-strip.stripprefix.prefixes=/services/completion"
- "traefik.http.middlewares.completion-strip.stripprefix.forceslash=true"
- "traefik.http.routers.completion.middlewares=completion-strip"
- "traefik.http.services.completion.loadbalancer.server.port=80"
- "traefik.http.routers.completion.service=completion"

networks:
agenta-network:
external: true
Loading