Canner / WrenAI

🚀 Open-source SQL AI Agent for Text-to-SQL. Supporting PostgreSQL, DuckDB, MySQL, MS SQL, ClickHouse, Trino, JSON, CSV, Parquet data sources, and more! 🚀
https://getwren.ai/oss
GNU Affero General Public License v3.0
1.92k stars 198 forks source link

Try to run on kubernetes Bootstrap not working #768

Open didlawowo opened 5 days ago

didlawowo commented 5 days ago

Describe the bug i trying to run wren ai on kubernetes using my own helm chart and get error with bootstrap on engine deployment. i have based my helm chart on analysis of your kustomize.

init config.properties
/app/init.sh: line 21: can't create "/app/data"/config.properties: nonexistent directory
grep: "/app/data"/config.properties: No such file or directory
wren.experimental-enable-dynamic-fields is not set, set it to true
/app/init.sh: line 29: can't create "/app/data"/config.properties: nonexistent directory
create mdl folder
mkdir: can't create directory '"/app/data"/mdl': No such file or directory
init mdl/sample.json
/app/init.sh: line 41: can't create "/app/data"/mdl/sample.json: nonexistent directory
init accounts file
/app/init.sh: line 49: can't create "/app/data"/accounts: nonexistent directory
Stream closed EOF for wren/wren-engine-678cf74cf9-8pdwf (bootstrap)

To Reproduce

just install init container

    initContainers:
    - name: bootstrap
      image: ghcr.io/canner/wren-bootstrap:0.1.4
      env:
      - name: DATA_PATH
        valueFrom:
          configMapKeyRef:
            name: wren
            key: WREN_ENGINE_DATA_PATH
      - name: PG_PASSWORD
        valueFrom:
          secretKeyRef:
            name: wren-postgresql
            key: postgres-password
      - name: PG_USERNAME
        valueFrom:
          secretKeyRef:
            name: wren
            key: PG_USERNAME
      volumeMounts:
      - name: wren-data
        mountPath: /app/data
      command: ["/bin/sh", "/app/init.sh"]

Expected behavior mount working and create file

Additional context

i can provide my helm chart on discord.

wwwy3y3 commented 4 days ago

@didlawowo

As I checked the logs you provided, it's strange the path consists of quotes: "/app/data"/accounts.

Could you confirm the env value you set is correct?

didlawowo commented 4 days ago

i think i have found it's a problem with the configmap , i 'm going to check :)

didlawowo commented 3 days ago

i have another with the UI

Using SQLite
Batch 1 run: 15 migrations
  ▲ Next.js 13.5.6
  - Local:        http://localhost:3000
  - Network:      http://0.0.0.0:3000

 ✓ Ready in 2.2s
[2024-10-19T18:57:07.913] [INFO] TELEMETRY - Telemetry not enabled.
using pg
[2024-10-19T18:57:08.328] [INFO] AskingService - Background tracker started
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5432
}
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5432
}
Stream closed EOF for wren/wren-frontend-56f45d479b-kdrv2 (frontend)
wwwy3y3 commented 1 day ago

Connection issue with postgres. Don't forget to set PG_URL in wren-ui

didlawowo commented 1 day ago

thx now next problem

Batch 1 run: 15 migrations
  ▲ Next.js 13.5.6
  - Local:        http://localhost:3000
  - Network:      http://0.0.0.0:3000

 ✓ Ready in 2.2s
[2024-10-21T06:12:58.207] [INFO] TELEMETRY - Telemetry not enabled.
using pg
[2024-10-21T06:12:58.707] [INFO] AskingService - Background tracker started
error: select * from "thread_response" - relation "thread_response" does not exist
    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  length: 114,
  severity: 'ERROR',
  code: '42P01',
  detail: undefined,
  hint: undefined,
  position: '15',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_relation.c',
  line: '1449',
  routine: 'parserOpenTable'
}

the database admin_ui is empty. where is the job who init it ?

onlyjackfrost commented 18 hours ago

Batch 1 run: 15 migrations Did the migration succeed? We run migrations before starting server. https://github.com/Canner/WrenAI/blob/0cf9f70fcf163562209f2251052ba93b06921347/wren-ui/Dockerfile#L61

didlawowo commented 14 hours ago

Batch 1 run: 15 migrations Did the migration succeed? We run migrations before starting server.

https://github.com/Canner/WrenAI/blob/0cf9f70fcf163562209f2251052ba93b06921347/wren-ui/Dockerfile#L61

the migration seems working if your look at the log

Using SQLite
Batch 1 run: 15 migrations
  ▲ Next.js 13.5.6
  - Local:        http://localhost:3000
  - Network:      http://0.0.0.0:3000

 ✓ Ready in 2.4s
wwwy3y3 commented 11 hours ago

@didlawowo the logs (Using SQLite) show that it's connecting to SQLite, not Postgres.

Could you show us the logs of wren-ui after you setup PG_URL ?

Also, make sure that the postgres user has enough permission to do the database migration.