pezzolabs / pezzo

🕹️ Open-source, developer-first LLMOps platform designed to streamline prompt design, version management, instant delivery, collaboration, troubleshooting, observability and more.
https://pezzo.ai
Apache License 2.0
2.55k stars 211 forks source link

can use docker compose deploy? #181

Closed av8dtop closed 1 year ago

av8dtop commented 1 year ago

Proposal

one docker-compose deploy all service open : 4200

Use-Case

No response

Is this a feature you are interested in implementing yourself?

No

arielweinberger commented 1 year ago

Hi, please provide more details in the issue - I'm not sure what exactly you're looking for.

We currently have a docker-compose file in the repo for both local development and production.

Have you tried running it? If so, are you getting any errors? If you do, share them please.

av8dtop commented 1 year ago

原諒我用中文 英文不好怕有誤會 一開始使用docker dev 只會啟動部分服務 轉成不使用dev 開始測試每個問題 針對.env的參數慢慢了解跟修改 有不少的問題 但是後來我解決 直到全部的服務都能啟動成功 但是實際上並非真的成功 pezzo_pezzo-server_1 log

Prisma onModuleInit error PrismaClientInitializationError: Database `pezzo` does not exist on the database server at `postgres:5432`.

at kr.<anonymous> (/app/node_modules/@prisma/client/runtime/binary.js:157:3075)

$ at kr.emit (node:events:513:28)

at addChunk (node:internal/streams/readable:324:12)

? at readableAddChunk (node:internal/streams/readable:297:9)

= at Readable.push (node:internal/streams/readable:234:10)

at kr._pushBuffer (/app/node_modules/@prisma/client/runtime/binary.js:75:369)

at kr._transform (/app/node_modules/@prisma/client/runtime/binary.js:75:199)

@ at Transform._write (node:internal/streams/transform:175:8)

= at writeOrBuffer (node:internal/streams/writable:392:12)

at _write (node:internal/streams/writable:333:10) {

 clientVersion: '5.1.1',

 errorCode: 'P1003'

}

�[Nest] 1 - 09/03/2023, 9:56:09 AM  LOG [NestApplication] Nest application successfully started +113ms

�[Nest] 1 - 09/03/2023, 9:56:09 AM  LOG 🚀 Application is running on: http://localhost:3000/api

=========================================== 直到server started 再開啟 pezzo_pezzo-console_1 log

LReplacing environment variable "[object Object]" with value [object Object]

Updated environment variables

2023/09/03 09:58:40 [notice] 1#1: using the "epoll" event method

/2023/09/03 09:58:40 [notice] 1#1: nginx/1.20.2

2023/09/03 09:58:40 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424)

>2023/09/03 09:58:40 [notice] 1#1: OS: Linux 5.15.0-79-generic

2023/09/03 09:58:40 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576

2023/09/03 09:58:40 [notice] 1#1: start worker processes

:2023/09/03 09:58:40 [notice] 1#1: start worker process 18

:2023/09/03 09:58:40 [notice] 1#1: start worker process 19

:2023/09/03 09:58:40 [notice] 1#1: start worker process 20

:2023/09/03 09:58:40 [notice] 1#1: start worker process 21

我就到這步驟失敗了 再請幫忙找原因 謝謝

arielweinberger commented 1 year ago

Two questions come to mind:

  1. Have you applied the database migration after spinning up the Docker images (as shown in the readme)?

  2. Perhaps you already have a Postgres DB running on the same port?

  3. Please provide the exact command you used in your terminal that resulted in this error.

Better to put logs/errors in a code block using backticks.

``

av8dtop commented 1 year ago

猜測 我的postgres是否需要重新使用,還是一切都要重新使用,因為好像DB沒有自動建立??找不到DB

docker-compose.yaml

version: "3"

services:
  **postgres-pezzo**:
    image: postgres:latest
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    ports:
      - "5433:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 3

  supertokens:
    image: supertokens/supertokens-postgresql:5.0
    restart: always
    ports:
      - "3567:3567"
    environment:
      POSTGRES_CONNECTION_URI: postgres://postgres:postgres@**postgres-pezzo**:5432/supertokens

  pezzo-server:
    image: ghcr.io/pezzolabs/pezzo/server:latest
    restart: always
    env_file:
      - ./.env
      - ./apps/server/.env
    environment:
      - DATABASE_URL=postgres://postgres:postgres@**_postgres-pezzo_**:5432/pezzo
      - SUPERTOKENS_CONNECTION_URI=http://supertokens:3567
      - OPENSEARCH_URL=http://opensearch-node1:9200
      **- REDIS_URL=redis://redis-stack-server:6379**
    ports:
      - "3000:3000"
    depends_on:
      **postgres-pezzo**:
        condition: service_healthy
    healthcheck:
      test: ["CMD-SHELL", "curl 'http://pezzo-server:3000/api/healthz'"]
      interval: 5s
      timeout: 5s
      retries: 3

  pezzo-console:
    image: ghcr.io/pezzolabs/pezzo/console:latest
    restart: always
    env_file:
      - ./.env
      - ./apps/console/.env
    ports:
      - "4200:8080"
    depends_on:
      pezzo-server:
        condition: service_healthy

  opensearch-node1:
    image: opensearchproject/opensearch:2.5.0
    container_name: opensearch-node1
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node1
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "plugins.security.disabled=true"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - opensearch-data1:/usr/share/opensearch/data
    ports:
      - 9200:9200 # REST API
      - 9600:9600 # Performance Analyzer
    deploy:
      resources:
        limits:
          memory: 3g

  opensearch-dashboards:
    image: opensearchproject/opensearch-dashboards:2.5.0
    container_name: opensearch-dashboards
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      - "DISABLE_SECURITY_DASHBOARDS_PLUGIN=true"
      - "OPENSEARCH_HOSTS=http://opensearch-node1:9200"

  redis-stack-server:
    image: redis/redis-stack-server:7.2.0-v0
    container_name: redis-stack-server
    ports:
      - "6379:6379"

volumes:
  postgres_data: ~
  opensearch-data1:

server

Prisma onModuleInit error PrismaClientInitializationError: Database `pezzo` does not exist on the database server at `postgres-pezzo:5432`.

at kr.<anonymous> (/app/node_modules/@prisma/client/runtime/binary.js:157:3075)

$ at kr.emit (node:events:513:28)

at addChunk (node:internal/streams/readable:324:12)

? at readableAddChunk (node:internal/streams/readable:297:9)

= at Readable.push (node:internal/streams/readable:234:10)

at kr._pushBuffer (/app/node_modules/@prisma/client/runtime/binary.js:75:369)

at kr._transform (/app/node_modules/@prisma/client/runtime/binary.js:75:199)

@ at Transform._write (node:internal/streams/transform:175:8)

= at writeOrBuffer (node:internal/streams/writable:392:12)

at _write (node:internal/streams/writable:333:10) {

 clientVersion: '5.1.1',

 errorCode: 'P1003'

}

�[Nest] 1 - 09/04/2023, 3:50:26 AM  LOG [NestApplication] Nest application successfully started +130ms

�[Nest] 1 - 09/04/2023, 3:50:26 AM  LOG 🚀 Application is running on: http://localhost:3000/api

console

LReplacing environment variable "[object Object]" with value [object Object]

Updated environment variables

2023/09/04 03:50:54 [notice] 1#1: using the "epoll" event method

/2023/09/04 03:50:54 [notice] 1#1: nginx/1.20.2

2023/09/04 03:50:54 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424)

>2023/09/04 03:50:54 [notice] 1#1: OS: Linux 5.15.0-79-generic

2023/09/04 03:50:54 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576

2023/09/04 03:50:54 [notice] 1#1: start worker processes

:2023/09/04 03:50:54 [notice] 1#1: start worker process 18

:2023/09/04 03:50:54 [notice] 1#1: start worker process 19

:2023/09/04 03:50:54 [notice] 1#1: start worker process 20

:2023/09/04 03:50:54 [notice] 1#1: start worker process 21

�192.168.1.1 - - [04/Sep/2023:03:51:28 +0000] "GET / HTTP/1.1" 200 1074 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69" "-"

192.168.1.1 - - [04/Sep/2023:03:51:28 +0000] "GET /main.b6486433444435ff.css HTTP/1.1" 200 5809 "http://192.168.1.103:4200/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69" "-"

192.168.1.1 - - [04/Sep/2023:03:51:28 +0000] "GET /runtime.4566db95c916845e.js HTTP/1.1" 200 2215 "http://192.168.1.103:4200/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69" "-"

192.168.1.1 - - [04/Sep/2023:03:51:29 +0000] "GET /main.88f9fa1f9fe10527.js HTTP/1.1" 200 3703844 "http://192.168.1.103:4200/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69" "-"

�192.168.1.1 - - [04/Sep/2023:03:54:44 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69" "-"
arielweinberger commented 1 year ago

Apologies, but I cannot understand much from this. Are you able to communicate in English? Are you still facing issues?

deTian0 commented 1 year ago

可以参考这个步骤,我这边已经运行起来了。用最新版本的镜像就行了,但是为了防止未来的更新引入bug 。可以修改 docker-compose.yaml 固定 server 和 console 的版本

  1. 安装环境
  2. 启动docker compose
  3. 迁移数据库
  4. 重启 cokercompose

Just use the latest version of the image, but to prevent future updates from introducing bugs. You can modify 'docker-compose.yaml' to fix the server and console versions

av8dtop commented 1 year ago

迁移数据库 這段我缺少在哪看呢?

deTian0 commented 1 year ago

项目首页,参考一下 dev那块,我电脑已经关机了 明天找找

---Original--- From: @.> Date: Wed, Sep 6, 2023 19:46 PM To: @.>; Cc: @.**@.>; Subject: Re: [pezzolabs/pezzo] can use docker compose deploy? (Issue #181)

迁移数据库 這段我缺少在哪看呢?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

av8dtop commented 1 year ago

我開始懷疑我自己有誤解的地方了 是不是要按照他全部的動作執行?? 我以為是一個docker-compose up -d 就能跑 4200了??

deTian0 commented 1 year ago

不是。除了这个。还需要进行两个操作

  1. 在 .env加入  openai key(具体是啥忘了,看报错)
  2. 数据库迁移

最重要的一点是,使用最新版本的镜像。前几个版本的镜像都有bug,已经在最新版本修复了

---Original--- From: @.> Date: Wed, Sep 6, 2023 20:02 PM To: @.>; Cc: @.**@.>; Subject: Re: [pezzolabs/pezzo] can use docker compose deploy? (Issue #181)

我開始懷疑我自己有誤解的地方了 是不是要按照他全部的動作執行?? 我以為是一個docker-compose up -d 就能跑 4200了??

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

av8dtop commented 1 year ago

恩 .env TESTER_OPENAI_API_KEY確實是作者漏掉的重點 這個我一開始有看影片確定過 但是數據庫遷移 哈 我還是找不到 那我應該就是缺這個而已 畢竟我在怎麼搞 他都告訴我他找不到DB 我就是在是不是他沒有初始化DB的動作 應該在docker啟動的時候連上DB就應該要做初始化就好了 這只是我的想法 感謝你的回復

deTian0 commented 1 year ago

没事,docker没做初始化相关的操作,手动搞一下就行了

---Original--- From: @.> Date: Wed, Sep 6, 2023 20:09 PM To: @.>; Cc: @.**@.>; Subject: Re: [pezzolabs/pezzo] can use docker compose deploy? (Issue #181)

恩 .env TESTER_OPENAI_API_KEY確實是作者漏掉的重點 這個我一開始有看影片確定過 但是數據庫遷移 哈 我還是找不到 那我應該就是缺這個而已 畢竟我在怎麼搞 他都告訴我他找不到DB 我就是在是不是他沒有初始化DB的動作 應該在docker啟動的時候連上DB就應該要做初始化就好了 這只是我的想法 感謝你的回復

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

arielweinberger commented 1 year ago

The conclusion here based on my understanding is:

  1. Adding the TESTER_OPENAI_API_KEY to the documentation so it's clearer that it's in use.
  2. An idea to automatically run DB migrations when running docker-compose. I think that's a good idea.

I'll close this for now, and address the issues separately. Thank you for the discussion!