Skip to content

Commit 00dcf24

Browse files
authored
Merge pull request #152 from rostilos/1.5.3-rc
1.5.3 rc
2 parents 42e8b5b + c371cb4 commit 00dcf24

107 files changed

Lines changed: 5981 additions & 5321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
set -e
3+
4+
MCP_SERVERS_JAR_PATH="java-ecosystem/mcp-servers/vcs-mcp/target/codecrow-vcs-mcp-1.0.jar"
5+
PLATFORM_MCP_JAR_PATH="java-ecosystem/mcp-servers/platform-mcp/target/codecrow-platform-mcp-1.0.jar"
6+
FRONTEND_DIR="frontend"
7+
FRONTEND_BRANCH="${FRONTEND_BRANCH:-main}"
8+
JAVA_DIR="java-ecosystem"
9+
DOCKER_PATH="deployment"
10+
CONFIG_PATH="deployment/config"
11+
12+
cd "$(dirname "$0")/../../"
13+
14+
echo "--- 1. Ensuring frontend submodule is synchronized ---"
15+
# if [ -d "$FRONTEND_DIR" ] && [ ! -f "$FRONTEND_DIR/.git" ]; then
16+
# echo "Stale frontend directory detected (not a submodule). Removing and re-initializing..."
17+
# rm -rf "$FRONTEND_DIR"
18+
# git submodule update --init -- "$FRONTEND_DIR"
19+
# elif [ ! -d "$FRONTEND_DIR" ]; then
20+
# echo "Initializing frontend submodule..."
21+
# git submodule update --init -- "$FRONTEND_DIR"
22+
# else
23+
# echo "Frontend submodule exists."
24+
# fi
25+
# echo "Fetching latest from origin and resetting to origin/$FRONTEND_BRANCH..."
26+
# (cd "$FRONTEND_DIR" && git fetch origin "$FRONTEND_BRANCH" && git reset --hard "origin/$FRONTEND_BRANCH")
27+
# echo "Frontend at: $(cd "$FRONTEND_DIR" && git log --oneline -1)"
28+
29+
echo "--- 2. Injecting Environment Configurations ---"
30+
31+
echo "Copying inference-orchestrator .env..."
32+
cp "$CONFIG_PATH/inference-orchestrator/.env" "python-ecosystem/inference-orchestrator/.env"
33+
34+
echo "Copying rag-pipeline .env..."
35+
cp "$CONFIG_PATH/rag-pipeline/.env" "python-ecosystem/rag-pipeline/.env"
36+
37+
echo "Copying web-frontend .env..."
38+
# Using the variable ensures we target the folder defined at the top
39+
cp "$CONFIG_PATH/web-frontend/.env" "$FRONTEND_DIR/.env"
40+
41+
42+
echo "--- 3. Building Java Artifacts (mvn clean package) ---"
43+
(cd "$JAVA_DIR" && mvn clean package -DskipTests)
44+
45+
echo "--- 4. MCP Servers jar update ---"
46+
cp "$MCP_SERVERS_JAR_PATH" python-ecosystem/inference-orchestrator/codecrow-vcs-mcp-1.0.jar
47+
48+
echo "--- 4.1. Platform MCP jar update ---"
49+
if [ -f "$PLATFORM_MCP_JAR_PATH" ]; then
50+
cp "$PLATFORM_MCP_JAR_PATH" python-ecosystem/inference-orchestrator/codecrow-platform-mcp-1.0.jar
51+
echo "Platform MCP JAR copied successfully."
52+
else
53+
echo "Warning: Platform MCP JAR not found at $PLATFORM_MCP_JAR_PATH"
54+
fi
55+
56+
echo "--- 5. Shutting down existing services cleanly ---"
57+
cd "$DOCKER_PATH"
58+
docker compose down --remove-orphans
59+
60+
echo "--- 6. Building Docker images and starting services ---"
61+
docker compose up -d --build --wait
62+
63+
echo "--- Deployment Complete! Services are up and healthy. ---"
64+
docker compose ps

deployment/build/production-build.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ CONFIG_PATH="deployment/config"
1111

1212
cd "$(dirname "$0")/../../"
1313

14-
echo "--- 1. Ensuring frontend submodule is synchronized ---"
15-
if [ -d "$FRONTEND_DIR" ] && [ ! -f "$FRONTEND_DIR/.git" ]; then
16-
echo "Stale frontend directory detected (not a submodule). Removing and re-initializing..."
17-
rm -rf "$FRONTEND_DIR"
18-
git submodule update --init -- "$FRONTEND_DIR"
19-
elif [ ! -d "$FRONTEND_DIR" ]; then
20-
echo "Initializing frontend submodule..."
21-
git submodule update --init -- "$FRONTEND_DIR"
22-
else
23-
echo "Frontend submodule exists."
24-
fi
25-
echo "Fetching latest from origin and resetting to origin/$FRONTEND_BRANCH..."
26-
(cd "$FRONTEND_DIR" && git fetch origin "$FRONTEND_BRANCH" && git reset --hard "origin/$FRONTEND_BRANCH")
27-
echo "Frontend at: $(cd "$FRONTEND_DIR" && git log --oneline -1)"
14+
# echo "--- 1. Ensuring frontend submodule is synchronized ---"
15+
# if [ -d "$FRONTEND_DIR" ] && [ ! -f "$FRONTEND_DIR/.git" ]; then
16+
# echo "Stale frontend directory detected (not a submodule). Removing and re-initializing..."
17+
# rm -rf "$FRONTEND_DIR"
18+
# git submodule update --init -- "$FRONTEND_DIR"
19+
# elif [ ! -d "$FRONTEND_DIR" ]; then
20+
# echo "Initializing frontend submodule..."
21+
# git submodule update --init -- "$FRONTEND_DIR"
22+
# else
23+
# echo "Frontend submodule exists."
24+
# fi
25+
# echo "Fetching latest from origin and resetting to origin/$FRONTEND_BRANCH..."
26+
# (cd "$FRONTEND_DIR" && git fetch origin "$FRONTEND_BRANCH" && git reset --hard "origin/$FRONTEND_BRANCH")
27+
# echo "Frontend at: $(cd "$FRONTEND_DIR" && git log --oneline -1)"
2828

2929
echo "--- 2. Injecting Environment Configurations ---"
3030

@@ -40,7 +40,7 @@ cp "$CONFIG_PATH/web-frontend/.env" "$FRONTEND_DIR/.env"
4040

4141

4242
echo "--- 3. Building Java Artifacts (mvn clean package) ---"
43-
(cd "$JAVA_DIR" && mvn clean package -DskipTests)
43+
(cd "$JAVA_DIR" && mvn clean package)
4444

4545
echo "--- 4. MCP Servers jar update ---"
4646
cp "$MCP_SERVERS_JAR_PATH" python-ecosystem/inference-orchestrator/codecrow-vcs-mcp-1.0.jar

deployment/config/inference-orchestrator/.env.sample

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ SERVICE_SECRET=change-me-to-a-random-secret
2828
# Temperature for code review (0.0 = deterministic, 0.1-0.3 = more creative)
2929
# LLM_TEMPERATURE=0.0
3030

31+
# === Gemini Thinking Level ===
32+
# Controls depth of reasoning for Gemini 3+ models
33+
# Options: minimal | low | medium | high
34+
# Recommended: "low" for code review (balanced speed/quality)
35+
# GEMINI_THINKING_LEVEL=low
36+
3137

3238
# === Direct Review Mode ===
3339
# When rawDiff is provided in request, bypasses MCP agent for faster review
@@ -38,11 +44,11 @@ SERVICE_SECRET=change-me-to-a-random-secret
3844
# Maximum file size in bytes (default: 25KB - same as LargeContentFilter.DEFAULT_SIZE_THRESHOLD_BYTES)
3945
# DIFF_MAX_FILE_SIZE=25600
4046
# Maximum files to include in review (default: 100)
41-
# DIFF_MAX_FILES=100
42-
# Maximum total diff size in bytes (default: 500KB)
43-
# DIFF_MAX_TOTAL_SIZE=500000
47+
# DIFF_MAX_FILES=400
48+
# Maximum total diff size in bytes (default: 1MB)
49+
# DIFF_MAX_TOTAL_SIZE=1000000
4450
# Maximum lines per file (default: 1000)
45-
# DIFF_MAX_LINES_PER_FILE=1000
51+
# DIFF_MAX_LINES_PER_FILE=3000
4652

4753
# === LLM Reranking (for large PRs) ===
4854
# Enable LLM-based reranking for large PRs

deployment/config/java-shared/application.properties.sample

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ codecrow.internal.api.secret=codecrow-internal-secret-change-me
2020
codecrow.rag.api.secret=change-me-to-a-random-secret
2121

2222

23+
# ============================================================================
24+
# CORS Configuration
25+
# ============================================================================
26+
# Comma-separated list of allowed origin patterns for CORS requests.
27+
# IMPORTANT: Set this to your actual frontend URL(s) in production.
28+
# Default (when not set): http://localhost:8080
29+
# Example for single domain: https://app.example.com
30+
# Example for multiple domains: https://app.example.com,https://staging.example.com
31+
#codecrow.security.cors.allowed-origins=http://localhost:8080
32+
33+
2334
# ============================================================================
2435
# Spring MVC and Multipart Configuration
2536
# ============================================================================
@@ -282,4 +293,17 @@ logging.level.org.hibernate.orm.jdbc.bind=OFF
282293
# ============================================================================
283294
# Maximum number of custom review rules per project (default: 20)
284295
#codecrow.project.rules.max-count=20
285-
#llm.sync.anthropic.api-key
296+
#llm.sync.anthropic.api-key
297+
298+
299+
# ============================================================================
300+
# Flyway Database Migration Configuration
301+
# ============================================================================
302+
# Flyway manages schema changes via versioned SQL scripts.
303+
# web-server is the migration owner; pipeline-agent has Flyway disabled.
304+
# These settings are overridden by docker-compose.yml environment variables.
305+
#
306+
# spring.flyway.enabled=true
307+
# spring.flyway.baseline-on-migrate=true
308+
# spring.flyway.baseline-version=0
309+
# spring.flyway.locations=classpath:db/migration/managed

deployment/config/rag-pipeline/.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ OPENROUTER_MODEL=qwen/qwen3-embedding-8b
3030
#================================================================================================
3131
#================================================================================================
3232

33+
REDIS_URL=redis://redis:6379/1
34+
3335
# QDRANT_VECTORS_ON_DISK=true
3436

3537
## === Path Traversal Guard ===

deployment/docker-compose.prod.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ services:
4242
qdrant:
4343
image: qdrant/qdrant:latest
4444
container_name: codecrow-qdrant
45+
environment:
46+
QDRANT__SERVICE__API_KEY: ${QDRANT_API_KEY:?QDRANT_API_KEY must be set in .env}
4547
ports:
4648
- "127.0.0.1:6333:6333"
4749
- "127.0.0.1:6334:6334"
@@ -65,12 +67,18 @@ services:
6567
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-codecrow_user}
6668
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env}
6769

68-
SPRING_JPA_HIBERNATE_DDL_AUTO: update
70+
SPRING_JPA_HIBERNATE_DDL_AUTO: validate
6971
SPRING_JPA_SHOW_SQL: "false"
7072
SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL: "false"
7173
SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
7274
SPRING_CONFIG_LOCATION: file:/app/config/application.properties
7375

76+
# Flyway database migrations (web-server is the migration owner)
77+
SPRING_FLYWAY_ENABLED: "true"
78+
SPRING_FLYWAY_BASELINE_ON_MIGRATE: "true"
79+
SPRING_FLYWAY_BASELINE_VERSION: "0"
80+
SPRING_FLYWAY_LOCATIONS: classpath:db/migration/managed
81+
7482
SERVER_PORT: 8081
7583

7684
SPRING_SESSION_STORE_TYPE: redis
@@ -91,6 +99,7 @@ services:
9199
networks:
92100
- codecrow-network
93101
volumes:
102+
- source_code_tmp:/tmp
94103
- web_logs:/app/logs
95104
- ./config/java-shared/application.properties:/app/config/application.properties
96105
- ./config/java-shared/github-private-key/github-app-private-key.pem:/app/config/github-app-private-key.pem
@@ -111,12 +120,15 @@ services:
111120
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-codecrow_user}
112121
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env}
113122

114-
SPRING_JPA_HIBERNATE_DDL_AUTO: update
123+
SPRING_JPA_HIBERNATE_DDL_AUTO: validate
115124
SPRING_JPA_SHOW_SQL: "false"
116125
SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL: "false"
117126
SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
118127
SPRING_CONFIG_LOCATION: file:/app/config/application.properties
119128

129+
# Flyway disabled — web-server is the migration owner
130+
SPRING_FLYWAY_ENABLED: "false"
131+
120132
SERVER_PORT: 8082
121133

122134
SPRING_SESSION_STORE_TYPE: redis
@@ -160,12 +172,15 @@ services:
160172
depends_on:
161173
- rag-pipeline
162174
- web-server
175+
- redis
163176
environment:
164177
# API access for Platform MCP (internal network only)
165178
CODECROW_API_URL: http://codecrow-web-application:8081
166179
PLATFORM_MCP_JAR: /app/codecrow-platform-mcp-1.0.jar
167180
# Internal API secret for service-to-service communication
168181
INTERNAL_API_SECRET: ${INTERNAL_API_SECRET:?INTERNAL_API_SECRET must be set in .env}
182+
# Redis connection for async analysis queue (DB 1 to isolate from session storage on DB 0)
183+
REDIS_URL: redis://redis:6379/1
169184
networks:
170185
- codecrow-network
171186
volumes:
@@ -188,9 +203,13 @@ services:
188203
environment:
189204
CODECROW_WEB_SERVER_URL: http://web-server:8081
190205
CODECROW_INTERNAL_SECRET: ${INTERNAL_API_SECRET:?INTERNAL_API_SECRET must be set in .env}
206+
QDRANT_API_KEY: ${QDRANT_API_KEY:?QDRANT_API_KEY must be set in .env}
207+
REDIS_URL: redis://redis:6379/1
191208
ports:
192209
- "127.0.0.1:8001:8001"
193210
depends_on:
211+
redis:
212+
condition: service_healthy
194213
fix-permissions:
195214
condition: service_completed_successfully
196215
qdrant:

deployment/docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ services:
4242
qdrant:
4343
image: qdrant/qdrant:latest
4444
container_name: codecrow-qdrant
45+
environment:
46+
QDRANT__SERVICE__API_KEY: ${QDRANT_API_KEY:?QDRANT_API_KEY must be set in .env}
4547
ports:
4648
- "127.0.0.1:6333:6333"
4749
- "127.0.0.1:6334:6334"
@@ -72,6 +74,12 @@ services:
7274
SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
7375
SPRING_CONFIG_LOCATION: file:/app/config/application.properties
7476

77+
# Flyway database migrations (web-server is the migration owner)
78+
SPRING_FLYWAY_ENABLED: "true"
79+
SPRING_FLYWAY_BASELINE_ON_MIGRATE: "true"
80+
SPRING_FLYWAY_BASELINE_VERSION: "0"
81+
SPRING_FLYWAY_LOCATIONS: classpath:db/migration/managed
82+
7583
SERVER_PORT: 8081
7684

7785
SPRING_SESSION_STORE_TYPE: redis
@@ -92,6 +100,7 @@ services:
92100
networks:
93101
- codecrow-network
94102
volumes:
103+
- source_code_tmp:/tmp
95104
- web_logs:/app/logs
96105
- ./config/java-shared/application.properties:/app/config/application.properties
97106
- ./config/java-shared/github-private-key/github-app-private-key.pem:/app/config/github-app-private-key.pem
@@ -118,6 +127,9 @@ services:
118127
SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
119128
SPRING_CONFIG_LOCATION: file:/app/config/application.properties
120129

130+
# Flyway disabled — web-server is the migration owner
131+
SPRING_FLYWAY_ENABLED: "false"
132+
121133
SERVER_PORT: 8082
122134

123135
SPRING_SESSION_STORE_TYPE: redis
@@ -163,10 +175,13 @@ services:
163175
depends_on:
164176
- rag-pipeline
165177
- web-server
178+
- redis
166179
environment:
167180
CODECROW_API_URL: http://codecrow-web-application:8081
168181
PLATFORM_MCP_JAR: /app/codecrow-platform-mcp-1.0.jar
169182
INTERNAL_API_SECRET: ${INTERNAL_API_SECRET:?INTERNAL_API_SECRET must be set in .env}
183+
# Redis connection for async analysis queue (DB 1 to isolate from session storage on DB 0)
184+
REDIS_URL: redis://redis:6379/1
170185
networks:
171186
- codecrow-network
172187
volumes:
@@ -190,9 +205,13 @@ services:
190205
environment:
191206
CODECROW_WEB_SERVER_URL: http://web-server:8081
192207
CODECROW_INTERNAL_SECRET: ${INTERNAL_API_SECRET:?INTERNAL_API_SECRET must be set in .env}
208+
QDRANT_API_KEY: ${QDRANT_API_KEY:?QDRANT_API_KEY must be set in .env}
209+
REDIS_URL: redis://redis:6379/1
193210
ports:
194211
- "127.0.0.1:8001:8001"
195212
depends_on:
213+
redis:
214+
condition: service_healthy
196215
fix-permissions:
197216
condition: service_completed_successfully
198217
qdrant:

deployment/setup.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ EOF
178178
set_value "$RAG_ENV" "SERVICE_SECRET" "$SERVICE_SECRET"
179179
success "Service secret (synced: application.properties + inference-orchestrator/.env + rag-pipeline/.env)"
180180

181+
# Qdrant API key — lives only in deployment/.env
182+
# Docker Compose injects it as QDRANT__SERVICE__API_KEY into the Qdrant container
183+
# and as QDRANT_API_KEY into the rag-pipeline container.
184+
local QDRANT_API_KEY
185+
QDRANT_API_KEY=$(generate_hex)
186+
echo "QDRANT_API_KEY=${QDRANT_API_KEY}" >> "$ROOT_ENV"
187+
success "Qdrant API key (written to .env — injected into containers by docker-compose)"
188+
181189
# ─── Step 3: Configure embedding provider ─────────────────────────
182190

183191
header "Step 3/3 — Embedding LLM configuration"
@@ -245,7 +253,7 @@ EOF
245253
echo -e "${BOLD}${GREEN}╚══════════════════════════════════════════════════╝${NC}\n"
246254

247255
echo -e "Generated files:"
248-
echo -e " ${DIM}.env${NC} (DB credentials + INTERNAL_API_SECRET)"
256+
echo -e " ${DIM}.env${NC} (DB credentials + INTERNAL_API_SECRET + QDRANT_API_KEY)"
249257
echo -e " ${DIM}config/java-shared/application.properties${NC}"
250258
echo -e " ${DIM}config/inference-orchestrator/.env${NC}"
251259
echo -e " ${DIM}config/rag-pipeline/.env${NC} (embedding provider configured)"

java-ecosystem/libs/analysis-engine/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
<artifactId>spring-boot-starter-data-jpa</artifactId>
5757
</dependency>
5858

59+
<dependency>
60+
<groupId>org.rostilos.codecrow</groupId>
61+
<artifactId>codecrow-queue</artifactId>
62+
</dependency>
63+
5964
<!-- Jackson for JSON processing -->
6065
<dependency>
6166
<groupId>com.fasterxml.jackson.core</groupId>

0 commit comments

Comments
 (0)