feat: added helm clean push (#606)
<!-- .github/pull_request_template.md --> ## Description <!-- Provide a clear description of the changes in this PR --> ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a Helm-based deployment package that streamlines setup for the backend application and PostgreSQL database on Kubernetes. - Added orchestration support via Docker Compose for managing multi-container deployments. - Added new Kubernetes resources including Deployments, Services, and PersistentVolumeClaims for both the backend and PostgreSQL. - **Documentation** - Provided comprehensive infrastructure and deployment instructions for Kubernetes environments. - **Chores** - Established a standardized container build process for the Python application. - Introduced configuration settings for service ports, resource limits, and environment variables. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Daniel Molnar <soobrosa@gmail.com> Co-authored-by: Boris <boris@topoteretes.com>
This commit is contained in:
parent
65d0f7317c
commit
62c84dde5e
10 changed files with 280 additions and 0 deletions
24
helm/Chart.yaml
Normal file
24
helm/Chart.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
apiVersion: v2
|
||||||
|
name: cognee-chart
|
||||||
|
description: A helm chart of the cognee backend deployment on Kubernetes environment
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
||||||
59
helm/Dockerfile
Normal file
59
helm/Dockerfile
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
# Define Poetry extras to install
|
||||||
|
ARG POETRY_EXTRAS="\
|
||||||
|
# Storage & Databases \
|
||||||
|
filesystem postgres weaviate qdrant neo4j falkordb milvus \
|
||||||
|
# Notebooks & Interactive Environments \
|
||||||
|
notebook \
|
||||||
|
# LLM & AI Frameworks \
|
||||||
|
langchain llama-index gemini huggingface ollama mistral groq \
|
||||||
|
# Evaluation & Monitoring \
|
||||||
|
deepeval evals posthog \
|
||||||
|
# Graph Processing & Code Analysis \
|
||||||
|
codegraph graphiti \
|
||||||
|
# Document Processing \
|
||||||
|
docs"
|
||||||
|
|
||||||
|
# Set build argument
|
||||||
|
ARG DEBUG
|
||||||
|
|
||||||
|
# Set environment variable based on the build argument
|
||||||
|
ENV DEBUG=${DEBUG}
|
||||||
|
ENV PIP_NO_CACHE_DIR=true
|
||||||
|
ENV PATH="${PATH}:/root/.poetry/bin"
|
||||||
|
|
||||||
|
|
||||||
|
RUN apt-get install -y \
|
||||||
|
gcc \
|
||||||
|
libpq-dev
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY pyproject.toml poetry.lock /app/
|
||||||
|
|
||||||
|
|
||||||
|
RUN pip install poetry
|
||||||
|
|
||||||
|
# Don't create virtualenv since docker is already isolated
|
||||||
|
RUN poetry config virtualenvs.create false
|
||||||
|
|
||||||
|
# Install the dependencies
|
||||||
|
RUN poetry install --extras "${POETRY_EXTRAS}" --no-root --without dev
|
||||||
|
|
||||||
|
|
||||||
|
# Set the PYTHONPATH environment variable to include the /app directory
|
||||||
|
ENV PYTHONPATH=/app
|
||||||
|
|
||||||
|
COPY cognee/ /app/cognee
|
||||||
|
|
||||||
|
# Copy Alembic configuration
|
||||||
|
COPY alembic.ini /app/alembic.ini
|
||||||
|
COPY alembic/ /app/alembic
|
||||||
|
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
|
RUN sed -i 's/\r$//' /app/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
25
helm/README.md
Normal file
25
helm/README.md
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
# cognee-infra-helm
|
||||||
|
General infrastructure setup for Cognee on Kubernetes using a Helm chart.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
Before deploying the Helm chart, ensure the following prerequisites are met:
|
||||||
|
|
||||||
|
**Kubernetes Cluster**: A running Kubernetes cluster (e.g., Minikube, GKE, EKS).
|
||||||
|
|
||||||
|
**Helm**: Installed and configured for your Kubernetes cluster. You can install Helm by following the [official guide](https://helm.sh/docs/intro/install/).
|
||||||
|
|
||||||
|
**kubectl**: Installed and configured to interact with your cluster. Follow the instructions [here](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
|
||||||
|
|
||||||
|
Clone the Repository Clone this repository to your local machine and navigate to the directory.
|
||||||
|
|
||||||
|
## Deploy Helm Chart:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm install cognee ./cognee-chart
|
||||||
|
```
|
||||||
|
|
||||||
|
**Uninstall Helm Release**:
|
||||||
|
```bash
|
||||||
|
helm uninstall cognee
|
||||||
|
```
|
||||||
46
helm/docker-compose-helm.yml
Normal file
46
helm/docker-compose-helm.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
services:
|
||||||
|
cognee:
|
||||||
|
image : cognee-backend:latest
|
||||||
|
container_name: cognee-backend
|
||||||
|
networks:
|
||||||
|
- cognee-network
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- /app/cognee-frontend/ # Ignore frontend code
|
||||||
|
environment:
|
||||||
|
- HOST=0.0.0.0
|
||||||
|
- ENVIRONMENT=local
|
||||||
|
- PYTHONPATH=.
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
||||||
|
# - 5678:5678 # Debugging
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '4.0'
|
||||||
|
memory: 8GB
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: pgvector/pgvector:pg17
|
||||||
|
container_name: postgres
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: cognee
|
||||||
|
POSTGRES_PASSWORD: cognee
|
||||||
|
POSTGRES_DB: cognee_db
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
networks:
|
||||||
|
- cognee-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
cognee-network:
|
||||||
|
name: cognee-network
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
|
||||||
32
helm/templates/cognee_deployment.yaml
Normal file
32
helm/templates/cognee_deployment.yaml
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-cognee
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-cognee
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ .Release.Name }}-cognee
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-cognee
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: cognee
|
||||||
|
image: {{ .Values.cognee.image }}
|
||||||
|
ports:
|
||||||
|
- containerPort: {{ .Values.cognee.port }}
|
||||||
|
env:
|
||||||
|
- name: HOST
|
||||||
|
value: {{ .Values.cognee.env.HOST }}
|
||||||
|
- name: ENVIRONMENT
|
||||||
|
value: {{ .Values.cognee.env.ENVIRONMENT }}
|
||||||
|
- name: PYTHONPATH
|
||||||
|
value: {{ .Values.cognee.env.PYTHONPATH }}
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: {{ .Values.cognee.resources.cpu }}
|
||||||
|
memory: {{ .Values.cognee.resources.memory }}
|
||||||
13
helm/templates/cognee_service.yaml
Normal file
13
helm/templates/cognee_service.yaml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-cognee
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-cognee
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.cognee.port }}
|
||||||
|
targetPort: {{ .Values.cognee.port }}
|
||||||
|
selector:
|
||||||
|
app: {{ .Release.Name }}-cognee
|
||||||
35
helm/templates/postgres_deployment.yaml
Normal file
35
helm/templates/postgres_deployment.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-postgres
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-postgres
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: {{ .Release.Name }}-postgres
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-postgres
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: postgres
|
||||||
|
image: {{ .Values.postgres.image }}
|
||||||
|
ports:
|
||||||
|
- containerPort: {{ .Values.postgres.port }}
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: {{ .Values.postgres.env.POSTGRES_USER }}
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
value: {{ .Values.postgres.env.POSTGRES_PASSWORD }}
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: {{ .Values.postgres.env.POSTGRES_DB }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgres-storage
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
volumes:
|
||||||
|
- name: postgres-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ .Release.Name }}-postgres-pvc
|
||||||
10
helm/templates/postgres_pvc.yaml
Normal file
10
helm/templates/postgres_pvc.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-postgres-pvc
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.postgres.storage }}
|
||||||
14
helm/templates/postgres_service.yaml
Normal file
14
helm/templates/postgres_service.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-postgres
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-postgres
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.postgres.port }}
|
||||||
|
targetPort: {{ .Values.postgres.port }}
|
||||||
|
selector:
|
||||||
|
app: {{ .Release.Name }}-postgres
|
||||||
|
|
||||||
22
helm/values.yaml
Normal file
22
helm/values.yaml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Configuration for the 'cognee' application service
|
||||||
|
cognee:
|
||||||
|
# Image name (using the local image we’ll build in Minikube)
|
||||||
|
image: "hajdul1988/cognee-backend:latest"
|
||||||
|
port: 8000
|
||||||
|
env:
|
||||||
|
HOST: "0.0.0.0"
|
||||||
|
ENVIRONMENT: "local"
|
||||||
|
PYTHONPATH: "."
|
||||||
|
resources:
|
||||||
|
cpu: "4.0"
|
||||||
|
memory: "8Gi"
|
||||||
|
|
||||||
|
# Configuration for the 'postgres' database service
|
||||||
|
postgres:
|
||||||
|
image: "pgvector/pgvector:pg17"
|
||||||
|
port: 5432
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: "cognee"
|
||||||
|
POSTGRES_PASSWORD: "cognee"
|
||||||
|
POSTGRES_DB: "cognee_db"
|
||||||
|
storage: "8Gi"
|
||||||
Loading…
Add table
Reference in a new issue