-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: Refactor project structure for maintainability & modularity #309
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
base: main
Are you sure you want to change the base?
Changes from all commits
7b5f351
f4b706b
f73bb08
ba950e7
5f0a148
08e5e0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# backend/Dockerfile | ||
FROM python:3.11-slim | ||
WORKDIR /app | ||
|
||
# Install curl for health checks | ||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Python dependencies | ||
COPY backend/api/requirements.txt ./api/ | ||
RUN python -m venv /opt/venv && \ | ||
/opt/venv/bin/pip install --no-cache -r api/requirements.txt | ||
|
||
# Copy source | ||
COPY backend/api/ ./api/ | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
ENV PORT=8001 | ||
|
||
# Health check endpoint is implemented at /health | ||
EXPOSE 8001 | ||
CMD ["python", "-m", "api.main"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
version: '3.8' | ||
|
||
services: | ||
deepwiki: | ||
backend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
dockerfile: backend/Dockerfile | ||
container_name: deepwiki-backend | ||
ports: | ||
- "${PORT:-8001}:${PORT:-8001}" # API port | ||
- "3000:3000" # Next.js port | ||
- "8001:8001" | ||
env_file: | ||
- .env | ||
environment: | ||
- PORT=${PORT:-8001} | ||
- NODE_ENV=production | ||
- SERVER_BASE_URL=http://localhost:${PORT:-8001} | ||
- LOG_LEVEL=${LOG_LEVEL:-INFO} | ||
- LOG_FILE_PATH=${LOG_FILE_PATH:-api/logs/application.log} | ||
volumes: | ||
- ~/.adalflow:/root/.adalflow # Persist repository and embedding data | ||
- ./api/logs:/app/api/logs # Persist log files across container restarts | ||
# Resource limits for docker-compose up (not Swarm mode) | ||
mem_limit: 6g | ||
mem_reservation: 2g | ||
# Health check configuration | ||
- ./backend/api/logs:/app/api/logs # Persist log files across container restarts | ||
Comment on lines
9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:${PORT:-8001}/health"] | ||
interval: 60s | ||
timeout: 10s | ||
test: ["CMD-SHELL", "curl -f http://localhost:8001/health || exit 1"] | ||
interval: 30s | ||
timeout: 5s | ||
retries: 3 | ||
start_period: 30s | ||
|
||
frontend: | ||
build: | ||
context: . | ||
dockerfile: frontend/Dockerfile | ||
args: | ||
- SERVER_BASE_URL=http://backend:8001 | ||
container_name: deepwiki-frontend | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
- NODE_ENV=production | ||
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Without it, the frontend will default to
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The frontend service needs to communicate with the backend service. The
|
||
- SERVER_BASE_URL=http://backend:8001 | ||
depends_on: | ||
backend: | ||
condition: service_healthy | ||
|
||
networks: | ||
default: | ||
driver: bridge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
backend
service is missing thevolumes
and resource limits (mem_limit
,mem_reservation
) that were present in the olddeepwiki
service.~/.adalflow:/root/.adalflow
and./api/logs:/app/api/logs
) were responsible for persisting repository data, embeddings, and logs. Without them, all this data will be lost when the container is stopped or restarted. This is likely a critical regression.I recommend re-adding these configurations to the
backend
service to ensure data persistence and resource management.