langchain-ai / opengpts

MIT License
6.48k stars 863 forks source link

Docker Compose Not Working #40

Closed Suleman-Elahi closed 10 months ago

Suleman-Elahi commented 1 year ago
[jerry@jerry opengpts]$ sudo docker compose up
[+] Running 21/21
 ✔ redis 20 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                                   32.7s 
   ✔ 9d21b12d5fab Pull complete                                                                                                                     6.7s 
   ✔ a457ec9ff352 Pull complete                                                                                                                     0.9s 
   ✔ 9bd73ed4d8b9 Pull complete                                                                                                                     0.9s 
   ✔ ed023719933c Pull complete                                                                                                                     1.9s 
   ✔ 5fde52d01b18 Pull complete                                                                                                                     4.6s 
   ✔ ae242a47a353 Pull complete                                                                                                                     3.3s 
   ✔ 9bbff103df04 Pull complete                                                                                                                     4.2s 
   ✔ 9f656dab9f4b Pull complete                                                                                                                     9.5s 
   ✔ 28220e5d06cf Pull complete                                                                                                                     6.2s 
   ✔ 4f4fb700ef54 Pull complete                                                                                                                     7.1s 
   ✔ 3cd790c05dfb Pull complete                                                                                                                     8.7s 
   ✔ 4477b6e2ca91 Pull complete                                                                                                                    10.0s 
   ✔ 2d0ae6aa5159 Pull complete                                                                                                                    10.5s 
   ✔ 20e9e43163d0 Pull complete                                                                                                                    11.9s 
   ✔ d2299cfde76f Pull complete                                                                                                                    10.9s 
   ✔ a7da2faca65f Pull complete                                                                                                                    13.4s 
   ✔ 81705345a8e5 Pull complete                                                                                                                    11.8s 
   ✔ ae986cff44af Pull complete                                                                                                                    13.5s 
   ✔ d597d5e736a1 Pull complete                                                                                                                    12.9s 
   ✔ 816b7973a3f3 Pull complete                                                                                                                    26.7s 
[+] Building 4.9s (11/11) FINISHED                                                                                                        docker:default
 => [backend internal] load build definition from Dockerfile                                                                                        0.4s
 => => transferring dockerfile: 253B                                                                                                                0.0s
 => [backend internal] load .dockerignore                                                                                                           0.5s
 => => transferring context: 2B                                                                                                                     0.0s
 => [backend internal] load metadata for docker.io/library/python:3.11                                                                              3.6s
 => [backend 1/7] FROM docker.io/library/python:3.11@sha256:9e00960bde4d9aafdcbf2f0fc5b31b15e1824fc795fd9b472717d085b59cf07b                        0.5s
 => => resolve docker.io/library/python:3.11@sha256:9e00960bde4d9aafdcbf2f0fc5b31b15e1824fc795fd9b472717d085b59cf07b                                0.5s
 => [backend internal] load build context                                                                                                           0.4s
 => => transferring context: 2.81MB                                                                                                                 0.0s
 => CACHED [backend 2/7] RUN apt-get install -y libmagic1                                                                                           0.0s
 => CACHED [backend 3/7] WORKDIR /backend                                                                                                           0.0s
 => CACHED [backend 4/7] COPY ./backend .                                                                                                           0.0s
 => CACHED [backend 5/7] RUN rm poetry.lock                                                                                                         0.0s
 => CACHED [backend 6/7] RUN pip install .                                                                                                          0.0s
 => ERROR [backend 7/7] COPY ./frontend/dist ./ui                                                                                                   0.0s
------
 > [backend 7/7] COPY ./frontend/dist ./ui:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref 21fc8804-6580-40a2-80eb-a48136143dd8::2uzni64j6vki8mknqop8k4dkz: "/frontend/dist": not found
eyurtsev commented 1 year ago

Hi @Suleman-Elahi Thanks for reporting! Follow the instructions in the README for now

Taytay commented 1 year ago

For what it's worth, I changed my Dockerfile to this for now and got it working. I immediately ran into #46 though, but this performs the build on the docker container:

FROM python:3.11

RUN apt-get install -y libmagic1

WORKDIR /backend

COPY ./backend .

RUN rm poetry.lock

RUN pip install .

# We are going to install yarn and do the build inside the docker container:
# Install yarn:
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list && \
    apt update && \
    apt install -y yarn

# Copy the frontend folder into the container:
COPY ./frontend ./frontend

# Install the frontend dependencies and build the frontend:
RUN cd ./frontend && yarn install
RUN cd ./frontend && yarn build

# Now copy the built `dist` folder that is inside of the container into ./ui:
RUN cp -r ./frontend/dist ./ui

CMD exec uvicorn app.server:app --host 0.0.0.0 --port $PORT
sudarshan-koirala commented 11 months ago

@Suleman-Elahi if you replace ./frontend/dist with ./frontend/src it will work. There is no dist folder inside frontend.

dentro-innovation commented 11 months ago

I tried running the docker compose setup with the config that's currently in the main branch, with the dockerfile of @Taytay and I also replaced the path as @sudarshan-koirala suggested.

All of them show success logs, but when I open the website there's always a blank page.

Logs:

 ✔ Network opengpts_default      Created                                                                                                                                                 0.1s 
 ✔ Container redis               Created                                                                                                                                                 0.0s 
 ✔ Container opengpts-backend-1  Created                                                                                                                                                 0.0s 
Attaching to backend-1, redis
redis      | 1:C 30 Nov 2023 23:03:27.501 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis      | 1:C 30 Nov 2023 23:03:27.501 # Redis version=6.2.13, bits=64, commit=00000000, modified=0, pid=1, just started
redis      | 1:C 30 Nov 2023 23:03:27.501 # Configuration loaded
redis      | 1:M 30 Nov 2023 23:03:27.502 * monotonic clock: POSIX clock_gettime
redis      | 1:M 30 Nov 2023 23:03:27.502 * Running mode=standalone, port=6379.
redis      | 1:M 30 Nov 2023 23:03:27.502 # Server initialized
redis      | 1:M 30 Nov 2023 23:03:27.502 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> Redis version found by RedisSearch : 6.2.13 - oss
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> RediSearch version 2.6.13 (Git=HEAD-f966d37f)
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> Low level api version 1 initialized successfully
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> concurrent writes: OFF, gc: ON, prefix min length: 2, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results:  1000000, search pool size: 20, index pool size: 8, 
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> Initialized thread pool!
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> Enabled diskless replication
redis      | 1:M 30 Nov 2023 23:03:27.504 * <search> Enabled role change notification
redis      | 1:M 30 Nov 2023 23:03:27.504 * Module 'search' loaded from /usr/lib/redis/modules/redisearch.so
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> Created new data type 'ReJSON-RL'
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> version: 999999 git sha: unknown branch: unknown
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> Exported RedisJSON_V1 API
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> Exported RedisJSON_V2 API
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> Exported RedisJSON_V3 API
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> Exported RedisJSON_V4 API
redis      | 1:M 30 Nov 2023 23:03:27.505 * <ReJSON> Enabled diskless replication
redis      | 1:M 30 Nov 2023 23:03:27.505 * Module 'ReJSON' loaded from /usr/lib/redis/modules/rejson.so
redis      | 1:M 30 Nov 2023 23:03:27.505 * <search> Acquired RedisJSON_V3 API
redis      | 1:M 30 Nov 2023 23:03:27.505 * Ready to accept connections
backend-1  | INFO:     Started server process [1]
backend-1  | INFO:     Waiting for application startup.
backend-1  | INFO:     Application startup complete.
backend-1  | INFO:     Uvicorn running on http://0.0.0.0:8100 (Press CTRL+C to quit)

Webpage: image

ls-git-17 commented 11 months ago

@dentro-innovation Are you working locally? If yes, you can try http://localhost:8100/ instead of http://0.0.0.0:8100/. Locally, it works for me, but I see the white web page on the VPS server. Perhaps, there are some dependences, which I did not have on the server?

sudarshan-koirala commented 11 months ago

@dentro-innovation I created a video on how to use docker for opengpts, link here -> https://youtu.be/8wZreQL0V44?si=WIkV9MtjfzwGUVu7

ls-git-17 commented 11 months ago

@sudarshan-koirala Thank you for nice video! Unfortunately, I have a problem similar to @dentro-innovation, but on VPS. In the browser, I see just white web page. Logs do not show errors, but I do not see in them good comments as for example ""GET /runs/config_schema HTTP/1.1" 200 OK", which I see locally. Locally my docker is working.

StefanGalissie commented 11 months ago

Same here. Blank page when not working locally : http://_myhost_:8100/ Has anyone managed to make this service available on a server (excluding localhost access)?

Suleman-Elahi commented 11 months ago

Same here. Blank page when not working locally : http://_myhost_:8100/ Has anyone managed to make this service available on a server (excluding localhost access)?

You can try tunnelling the localhost using Cloudflare or ngrok or something like that to expose to internet.