WrenAI icon indicating copy to clipboard operation
WrenAI copied to clipboard

Try to run on kubernetes Bootstrap not working

Open didlawowo opened this issue 1 year ago • 15 comments

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.

didlawowo avatar Oct 17 '24 08:10 didlawowo

@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?

wwwy3y3 avatar Oct 18 '24 08:10 wwwy3y3

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

didlawowo avatar Oct 18 '24 17:10 didlawowo

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)

didlawowo avatar Oct 19 '24 18:10 didlawowo

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

wwwy3y3 avatar Oct 21 '24 05:10 wwwy3y3

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 ?

didlawowo avatar Oct 21 '24 06:10 didlawowo

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

onlyjackfrost avatar Oct 22 '24 02:10 onlyjackfrost

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

didlawowo avatar Oct 22 '24 06:10 didlawowo

@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.

wwwy3y3 avatar Oct 22 '24 09:10 wwwy3y3

on my side, i don't have config for sqlite,

inside the container:

/app # env | grep sql PG_URL=postgres://wren:postgres@wren-postgresql:5432/admin_ui /app # env | grep lite

didlawowo avatar Oct 23 '24 16:10 didlawowo

if you set DB_TYPE=pg (insteand of WREN_UI_DB_TYPE) it's work but then i have a probleme when i try to create connection to database in ui (if connection fail i have another message)

Unexpected token o in JSON at position 1

didlawowo avatar Oct 23 '24 17:10 didlawowo

@wwwy3y3

didlawowo avatar Oct 23 '24 23:10 didlawowo

@didlawowo could you share your logs to us ?

wwwy3y3 avatar Oct 24 '24 01:10 wwwy3y3

image

didlawowo avatar Oct 24 '24 18:10 didlawowo

and nothing in the logs @wwwy3y3

didlawowo avatar Oct 24 '24 18:10 didlawowo

could you get logs from wren-engine & wren-ibis-server as well ?

I think there might be some issues on the network connection between services. That's why we saw response not in JSON format.

Could you also make sure the network connection from ui to engine & ibis work ? Please double-check on the following env: WREN_ENGINE_ENDPOINT , WREN_ENGINE_PORT, IBIS_SERVER_ENDPOINT. Make sure IBIS_SERVER_ENDPOINT is sth like http://wren-ibis-server:8000. It should point to the ibis service

wwwy3y3 avatar Oct 25 '24 09:10 wwwy3y3

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

I also encountered the problem that wrenai_bootstrap_1 container can't start, docker logs :wren.experimental-enable-dynamic-fields is not set, set it to true. So I add EXPERIMENTAL_ENABLE_DYNAMIC_FIELDS=true in .env file but still it doesn't start, but now docker logs shows empty. Can you tell me your solution for this? thanks!!!

tatuke avatar Feb 17 '25 08:02 tatuke

我认为我发现这是 configmap 的问题,我要检查一下:)

我也遇到了 wrenai_bootstrap_1 容器无法启动的问题, docker logs :wren.experimental-enable-dynamic-fields 未设置,请将其设置为 true。 因此,我在 .env 文件中添加了 EXPERIMENTAL_ENABLE_DYNAMIC_FIELDS=true,但仍然无法启动,但现在 docker logs 显示为空。你能告诉我你的解决方案吗?谢谢!!!

same here , did you solve the problem?

Archilht avatar Feb 27 '25 02:02 Archilht

without response from developper we can't dot anything. i wait for .

didlawowo avatar Mar 03 '25 06:03 didlawowo