Skip to content
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
14 changes: 14 additions & 0 deletions admin-ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules
npm-debug.log
.git
.gitignore
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
dist
coverage
.nyc_output
.DS_Store
*.log
34 changes: 34 additions & 0 deletions admin-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Build stage
FROM node:18-alpine AS builder

WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm ci

# Copy source code
COPY . .

# Build the application
RUN npx vite build

# Production stage
FROM node:18-alpine

# Install serve globally
RUN npm install -g serve

# Copy built files from builder stage
COPY --from=builder /app/dist /app/dist

# Set working directory
WORKDIR /app

# Expose port 80
EXPOSE 80

# Start serve with SPA support
CMD ["serve", "-s", "dist", "-l", "80", "--single"]

Copilot AI Aug 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The production stage uses a full Node.js image but only needs the 'serve' package. Consider using a lighter base image like nginx:alpine for better security and smaller image size.

Suggested change
CMD ["serve", "-s", "dist", "-l", "80", "--single"]
FROM nginx:alpine
# Copy built files from builder stage to nginx's static directory
COPY --from=builder /app/dist /usr/share/nginx/html
# Expose port 80
EXPOSE 80

Copilot uses AI. Check for mistakes.
6 changes: 3 additions & 3 deletions core/src/main/java/com/opencontext/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public RestTemplate restTemplate() {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOriginPatterns("*") // Allow all origins in development environment
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS","PATCH")
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("*")

Copilot AI Aug 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing all HTTP methods (*) in CORS configuration may expose unintended endpoints to cross-origin requests. Consider explicitly listing only the required methods (GET, POST, PUT, DELETE, OPTIONS, PATCH).

Suggested change
.allowedMethods("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")

Copilot uses AI. Check for mistakes.
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600);
Expand Down
51 changes: 39 additions & 12 deletions core/src/main/resources/application-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,58 @@ spring:
# JPA Configuration
jpa:
hibernate:
ddl-auto: create-drop
ddl-auto: validate

Copilot AI Aug 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing from 'create-drop' to 'validate' requires existing database schema to match entity definitions. This change should be coordinated with proper database migration strategy to avoid runtime failures.

Suggested change
ddl-auto: validate
ddl-auto: none

Copilot uses AI. Check for mistakes.
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true

# Flyway Configuration (Docker)
flyway:
baseline-on-migrate: true
locations: classpath:db/migration
validate-on-migrate: true

# Servlet Configuration
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB

# Application-specific Configuration (Docker)
app:
# Elasticsearch Configuration (Docker)
elasticsearch:
uris: http://elasticsearch:9200

# Ollama Configuration (Docker)
ollama:
base-url: http://ollama:11434
model: dengcao/Qwen3-Embedding-0.6B:F16
url: http://elasticsearch:9200
index: document_chunks_index

# Ollama Configuration (Docker)
ollama:
api:
url: http://ollama:11434
embedding:
model: dengcao/Qwen3-Embedding-0.6B:F16

# Embedding Configuration
embedding:
batch-size: 10

# Search Configuration
search:
snippet-max-length: 50
bm25-weight: 0.3
vector-weight: 0.7

# Content Configuration
content:
default-max-tokens: 25000
tokenizer: tiktoken-cl100k_base

# Unstructured API Configuration
unstructured:
api:
url: http://unstructured-api:8000

# MinIO Configuration (Docker)
minio:
Expand All @@ -44,11 +75,7 @@ minio:
secret-key: minioadmin123!
bucket-name: opencontext-documents

# Unstructured.io Configuration (Docker)
app:
unstructured:
api:
url: http://unstructured-api:8000


# Application Configuration
opencontext:
Expand Down
38 changes: 0 additions & 38 deletions core/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,41 +98,3 @@ logging:

server:
port: 8080

---
# Docker Profile Configuration
spring:
config:
activate:
on-profile: docker

# Database Configuration (Docker)
datasource:
url: jdbc:postgresql://postgres:5432/opencontext
username: user
password: password

# Application-specific Configuration (Docker)
app:
# Elasticsearch Configuration (Docker)
elasticsearch:
url: http://elasticsearch:9200
index: document_chunks_index

# Ollama Configuration (Docker)
ollama:
api:
url: http://ollama:11434
embedding:
model: dengcao/Qwen3-Embedding-0.6B:F16

# MinIO Configuration (Docker)
minio:
endpoint: http://minio:9000
access-key: minioadmin
secret-key: minioadmin123!
bucket-name: opencontext-documents

# Unstructured.io Configuration (Docker)
unstructured:
base-url: http://unstructured-api:8000
33 changes: 20 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- opencontext-network
healthcheck:
Expand Down Expand Up @@ -74,10 +73,12 @@ services:
- opencontext-network
environment:
- OLLAMA_HOST=0.0.0.0
# - OLLAMA_GPU_OVERHEAD=0
# - OLLAMA_NUM_PARALLEL=1
- OLLAMA_NUM_PARALLEL=1
depends_on:
- ollama-init
# To enable GPU support, set OLLAMA_RUNTIME=nvidia in your environment.
# If you do not have an NVIDIA GPU, leave OLLAMA_RUNTIME unset.
runtime: ${OLLAMA_RUNTIME:-}
restart: unless-stopped

# Kibana for Elasticsearch management
Expand Down Expand Up @@ -123,7 +124,7 @@ services:
ports:
- "8000:8000"
environment:
- UNSTRUCTURED_MEMORY_FREE_MINIMUM_MB=512
- UNSTRUCTURED_MEMORY_FREE_MINIMUM_MB=512
networks:
- opencontext-network
restart: unless-stopped
Expand All @@ -139,15 +140,6 @@ services:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/opencontext
- SPRING_DATASOURCE_USERNAME=user
- SPRING_DATASOURCE_PASSWORD=password
- ELASTICSEARCH_URL=http://elasticsearch:9200
- OLLAMA_BASE_URL=http://ollama:11434
- UNSTRUCTURED_API_URL=http://unstructured-api:8000
- MINIO_URL=http://minio:9000
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin123!
depends_on:
postgres:
condition: service_healthy
Expand Down Expand Up @@ -201,6 +193,21 @@ services:
command: ["node", "dist/index.js", "--transport", "http", "--port", "3000"]
restart: unless-stopped

# Admin UI Frontend
open-context-admin-ui:
build:
context: ./admin-ui
dockerfile: Dockerfile
image: opencontext/admin-ui:0.1.0
container_name: open-context-admin-ui
ports:
- "3001:80"
depends_on:
- open-context-core
networks:
- opencontext-network
restart: unless-stopped

volumes:
postgres_data:
es_data:
Expand Down