Skip to content

Commit 08a6fbd

Browse files
committed
Fix startup path for local docker run
1 parent 69da252 commit 08a6fbd

10 files changed

Lines changed: 41 additions & 32 deletions

Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
FROM eclipse-temurin:17-jdk-alpine AS builder
1+
FROM maven:3.9.9-eclipse-temurin-17 AS builder
22
WORKDIR /app
33

44
COPY pom.xml .
55
COPY src ./src
66

7-
RUN apk add --no-cache maven && \
8-
mvn -DskipTests package -q && \
7+
RUN mvn -DskipTests package -q && \
98
mkdir -p deps && \
109
cp target/*.jar deps/app.jar
1110

12-
FROM eclipse-temurin:17-jre-alpine
11+
FROM eclipse-temurin:17-jre
1312
WORKDIR /app
1413

15-
# Security baseline: run app as non-root user.
16-
RUN addgroup -S appgroup && adduser -S appuser -G appgroup && \
14+
RUN apt-get update && \
15+
apt-get install -y --no-install-recommends wget && \
16+
rm -rf /var/lib/apt/lists/* && \
17+
groupadd --system appgroup && \
18+
useradd --system --gid appgroup appuser && \
1719
chown -R appuser:appgroup /app
1820

1921
USER appuser

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ services:
77
- "8080:8080"
88
environment:
99
SPRING_PROFILES_ACTIVE: prod
10-
DB_URL: jdbc:mysql://mysql:3306/knowledgeops_agent?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
10+
DB_URL: jdbc:mysql://mysql:3306/knowledgeops_agent?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
1111
DB_USERNAME: root
1212
DB_PASSWORD: root
13-
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
13+
OPENAI_API_KEY: ${OPENAI_API_KEY:-sk-local-dev-placeholder}
1414
OPENAI_BASE_URL: ${OPENAI_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode}
1515
APP_SECURITY_ENABLED: "true"
1616
APP_JWT_SECRET: ${APP_JWT_SECRET:-dev-jwt-secret-change-this-in-prod-123456}
17-
APP_VECTOR_STORE_BACKEND: pgvector
18-
APP_REQUIRE_PGVECTOR: "false"
17+
APP_VECTOR_STORE_BACKEND: simple
18+
APP_VECTOR_STORE_REQUIRE_PGVECTOR: "false"
1919
APP_INGESTION_QUEUE_BACKEND: redis_stream
2020
REDIS_HOST: redis
2121
RABBITMQ_HOST: rabbitmq
@@ -37,7 +37,7 @@ services:
3737
retries: 5
3838

3939
mysql:
40-
image: mysql:8.4
40+
image: mysql:8.0.36
4141
container_name: knowledgeops-agent-mysql
4242
environment:
4343
MYSQL_ROOT_PASSWORD: root
@@ -81,7 +81,7 @@ services:
8181
volumes:
8282
- ./observability/tempo/tempo.yml:/etc/tempo/tempo.yml:ro
8383
ports:
84-
- "4318:4318"
84+
- "4319:4318"
8585

8686
web:
8787
build:
@@ -93,9 +93,9 @@ services:
9393
app:
9494
condition: service_healthy
9595
ports:
96-
- "80:80"
96+
- "8088:80"
9797
healthcheck:
98-
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost/"]
98+
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1/"]
9999
interval: 20s
100100
timeout: 5s
101101
retries: 5

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
<groupId>org.flywaydb</groupId>
6464
<artifactId>flyway-core</artifactId>
6565
</dependency>
66+
<dependency>
67+
<groupId>org.flywaydb</groupId>
68+
<artifactId>flyway-mysql</artifactId>
69+
</dependency>
6670
<dependency>
6771
<groupId>com.bucket4j</groupId>
6872
<artifactId>bucket4j-core</artifactId>

src/main/resources/application.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ spring:
88
name: knowledgeops-agent
99
profiles:
1010
active: ${SPRING_PROFILES_ACTIVE:dev}
11+
autoconfigure:
12+
exclude:
13+
- org.springframework.ai.autoconfigure.vectorstore.pgvector.PgVectorStoreAutoConfiguration
1114
ai:
1215
ollama:
1316
base-url: http://localhost:11434
@@ -37,7 +40,7 @@ spring:
3740
flyway:
3841
enabled: true
3942
baseline-on-migrate: true
40-
locations: classpath:db/migration,classpath:db/migration/{vendor}
43+
locations: classpath:db/migration,classpath:db/vendor/{vendor}
4144
data:
4245
redis:
4346
host: ${REDIS_HOST:localhost}

src/main/resources/db/migration/V1__init_core_and_platform_tables.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS conversation (
3030
create_time DATETIME NOT NULL
3131
);
3232

33-
CREATE INDEX IF NOT EXISTS idx_conversation_id_create_time
33+
CREATE INDEX idx_conversation_id_create_time
3434
ON conversation (conversation_id, create_time);
3535

3636
CREATE TABLE IF NOT EXISTS ingestion_job (
@@ -53,10 +53,10 @@ CREATE TABLE IF NOT EXISTS ingestion_job (
5353
updated_at DATETIME NOT NULL
5454
);
5555

56-
CREATE INDEX IF NOT EXISTS idx_ingestion_status_next_retry
56+
CREATE INDEX idx_ingestion_status_next_retry
5757
ON ingestion_job (status, next_retry_at);
5858

59-
CREATE INDEX IF NOT EXISTS idx_ingestion_chat_created
59+
CREATE INDEX idx_ingestion_chat_created
6060
ON ingestion_job (chat_id, created_at);
6161

6262
CREATE TABLE IF NOT EXISTS users (
@@ -122,7 +122,7 @@ CREATE TABLE IF NOT EXISTS audit_log (
122122
created_at DATETIME NOT NULL
123123
);
124124

125-
CREATE INDEX IF NOT EXISTS idx_audit_created
125+
CREATE INDEX idx_audit_created
126126
ON audit_log (created_at);
127127

128128
INSERT IGNORE INTO roles (id, role_name, created_at) VALUES
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
ALTER TABLE api_keys
2-
ADD COLUMN IF NOT EXISTS expires_at DATETIME NULL,
3-
ADD COLUMN IF NOT EXISTS revoked_at DATETIME NULL,
4-
ADD COLUMN IF NOT EXISTS revoked_reason VARCHAR(255) NULL,
5-
ADD COLUMN IF NOT EXISTS rotated_from_id BIGINT NULL;
2+
ADD COLUMN expires_at DATETIME NULL,
3+
ADD COLUMN revoked_at DATETIME NULL,
4+
ADD COLUMN revoked_reason VARCHAR(255) NULL,
5+
ADD COLUMN rotated_from_id BIGINT NULL;
66

7-
CREATE INDEX IF NOT EXISTS idx_api_keys_expire_revoke
7+
CREATE INDEX idx_api_keys_expire_revoke
88
ON api_keys (enabled, expires_at, revoked_at);
99

1010
CREATE TABLE IF NOT EXISTS refresh_tokens (
@@ -17,5 +17,5 @@ CREATE TABLE IF NOT EXISTS refresh_tokens (
1717
created_at DATETIME NOT NULL
1818
);
1919

20-
CREATE INDEX IF NOT EXISTS idx_refresh_tokens_principal
20+
CREATE INDEX idx_refresh_tokens_principal
2121
ON refresh_tokens (principal, expires_at);

src/main/resources/db/migration/V5__route_level_permissions_and_api_key_index.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE INDEX IF NOT EXISTS idx_api_keys_key_name_active
1+
CREATE INDEX idx_api_keys_key_name_active
22
ON api_keys (key_name, enabled, revoked_at, expires_at);
33

44
INSERT IGNORE INTO permissions (permission_name, created_at) VALUES
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
ALTER TABLE api_keys
2-
ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(64) NOT NULL DEFAULT 'public';
2+
ADD COLUMN tenant_id VARCHAR(64) NOT NULL DEFAULT 'public';
33

4-
CREATE INDEX IF NOT EXISTS idx_api_keys_tenant_key_name_active
4+
CREATE INDEX idx_api_keys_tenant_key_name_active
55
ON api_keys (tenant_id, key_name, enabled, revoked_at, expires_at);
66

77
ALTER TABLE refresh_tokens
8-
ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(64) NOT NULL DEFAULT 'public';
8+
ADD COLUMN tenant_id VARCHAR(64) NOT NULL DEFAULT 'public';
99

10-
CREATE INDEX IF NOT EXISTS idx_refresh_tokens_tenant_principal
10+
CREATE INDEX idx_refresh_tokens_tenant_principal
1111
ON refresh_tokens (tenant_id, principal, expires_at);
1212

1313
ALTER TABLE audit_log
14-
ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(64) NOT NULL DEFAULT 'public';
14+
ADD COLUMN tenant_id VARCHAR(64) NOT NULL DEFAULT 'public';
1515

16-
CREATE INDEX IF NOT EXISTS idx_audit_tenant_created
16+
CREATE INDEX idx_audit_tenant_created
1717
ON audit_log (tenant_id, created_at);

src/main/resources/db/migration/postgresql/V3__pgvector_formal_schema.sql renamed to src/main/resources/db/vendor/postgresql/V3__pgvector_formal_schema.sql

File renamed without changes.

src/main/resources/db/migration/postgresql/V7__pgvector_hnsw_index.sql renamed to src/main/resources/db/vendor/postgresql/V8__pgvector_hnsw_index.sql

File renamed without changes.

0 commit comments

Comments
 (0)