openchatai / OpenChat

LLMs custom-chatbots console ⚡
https://open.cx
MIT License
5.17k stars 642 forks source link

error docker #77

Closed JuanAlberjon closed 1 year ago

JuanAlberjon commented 1 year ago

Does anyone know how to solve it? This is in an ubuntu virtual machine, thanks. INFO Configuration cached successfully.

=== Run backend server server migrations === docker-compose exec backend-server php artisan migrate --seed

Illuminate\Database\QueryException

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution (Connection: mysql, SQL: select * from information_schema.tables where table_schema = openchat and table_name = migrations and table_type = 'BASE TABLE')

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:793 789▕ // If an exception occurs when attempting to run a query, we'll format the error 790▕ // message to include the bindings with SQL, which will make this exception a 791▕ // lot more helpful to the developer instead of just the database's errors. 792▕ catch (Exception $e) { ➜ 793▕ throw new QueryException( 794▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 795▕ ); 796▕ } 797▕ }

  +38 vendor frames

39 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

make: *** [Makefile:27: install] Error 1

gharbat commented 1 year ago

Can you try to do make install one more time? usually it happens when the application server starts before the mysql server, this behaviour will be fixed in the coming releases.

JuanAlberjon commented 1 year ago

Rebooted server and tried two more times, nothing.

jairodriguez commented 1 year ago

Im having the same problem. I believe were missing an sql to make the table: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'openchat.chatbots' doesn't exist (Connection: mysql, SQL: select * from chatbots where prompt_message is null) and A table was not found: You might have forgotten to run your database migrations.

beauwilliams commented 1 year ago

I'm having the same issue too

beauwilliams commented 1 year ago

I ran it a week back on another machine and got it up and running so may be breaking change

lopez-hector commented 1 year ago

Same error, cannot get it running.

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'openchat.chatbots' doesn't exist (Connection: mysql, SQL: select * from `chatbots` where `prompt_message` is null)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:793
    789▕         // If an exception occurs when attempting to run a query, we'll format the error
    790▕         // message to include the bindings with SQL, which will make this exception a
    791▕         // lot more helpful to the developer instead of just the database's errors.
    792▕         catch (Exception $e) {
  ➜ 793▕             throw new QueryException(
    794▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    795▕             );
    796▕         }
    797▕     }

  i   A table was not found: You might have forgotten to run your database migrations. 
      https://laravel.com/docs/master/migrations#running-migrations

      +11 vendor frames 

  12  app/Console/Commands/FillInitialPromptCommand.php:32
      Illuminate\Database\Eloquent\Builder::get()
      +12 vendor frames 

  25  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

make: *** [install] Error 1
gharbat commented 1 year ago

Deployed a fix for this problem.

Can you please do git pull then make install again?

fmedinaq commented 1 year ago

Hello there. Im having the same issue. I pulled 10 mins ago.

jairodriguez commented 1 year ago

I pulled and it works localhost. Thank you! However ingesting pdf`s is failing.

RoiArthurB commented 1 year ago

@gharbat The issue reappeared on latest main...

$ make install
\033[1m=== Putting the services down (if already running) ===\033[0m
docker-compose down --remove-orphans
[+] Running 5/5
 ✔ Container openchat-backend-server-1  Removed                                                                10.8s 
 ✔ Container openchat-redis-1           Removed                                                                 1.3s 
 ✔ Container openchat-llm-server-1      Removed                                                                 1.4s 
 ✔ Container openchat-mysql-1           Removed                                                                10.6s 
 ✔ Network openchat_openchat_network    Removed                                                                 0.5s 
\033[1m=== Setting up Docker environment ===\033[0m
\033[1m=== This will overwrite your .env files, you still have some time to abort ===\033[0m
\033[1m=== Copying .env files ===\033[0m
cp -n backend-server/.env.example backend-server/.env 2>/dev/null || true
cp common.env llm-server/.env 2>/dev/null || true
docker-compose build #--no-cache
[+] Building 2.0s (25/25) FINISHED                                                                                   
 => [llm-server internal] load build definition from Dockerfile                                                 0.0s
 => => transferring dockerfile: 436B                                                                            0.0s
 => [llm-server internal] load .dockerignore                                                                    0.0s
 => => transferring context: 2B                                                                                 0.0s
 => [llm-server internal] load metadata for docker.io/library/node:18                                           0.9s
 => [llm-server 1/6] FROM docker.io/library/node:18@sha256:19892542dd80e33aec50a51619ab36db0921de240c6a4ff6024  0.0s
 => [llm-server internal] load build context                                                                    0.0s
 => => transferring context: 1.25kB                                                                             0.0s
 => CACHED [llm-server 2/6] WORKDIR /usr/src/app                                                                0.0s
 => CACHED [llm-server 3/6] COPY package*.json yarn.lock ./                                                     0.0s
 => CACHED [llm-server 4/6] COPY .env .env                                                                      0.0s
 => CACHED [llm-server 5/6] RUN yarn install                                                                    0.0s
 => CACHED [llm-server 6/6] COPY . .                                                                            0.0s
 => [llm-server] exporting to image                                                                             0.0s
 => => exporting layers                                                                                         0.0s
 => => writing image sha256:e44e1069e7feed6254b8d3200fd77564845eea4acb368e0698ee128937a172fe                    0.0s
 => => naming to docker.io/library/openchat-llm-server                                                          0.0s
 => [backend-server internal] load build definition from Dockerfile                                             0.0s
 => => transferring dockerfile: 924B                                                                            0.0s
 => [backend-server internal] load .dockerignore                                                                0.0s
 => => transferring context: 2B                                                                                 0.0s
 => [backend-server internal] load metadata for docker.io/library/php:8.1-cli                                   0.8s
 => [backend-server 1/9] FROM docker.io/library/php:8.1-cli@sha256:7d41d8fdb6fd8ef5ab9e53df39894d88297b34615da  0.0s
 => [backend-server internal] load build context                                                                0.0s
 => => transferring context: 22.13kB                                                                            0.0s
 => CACHED [backend-server 2/9] RUN apt-get update && apt-get install -y     libpq-dev     libzip-dev     zip   0.0s
 => CACHED [backend-server 3/9] RUN docker-php-ext-install pdo pdo_mysql                                        0.0s
 => CACHED [backend-server 4/9] WORKDIR /var/www/html                                                           0.0s
 => CACHED [backend-server 5/9] COPY . .                                                                        0.0s
 => CACHED [backend-server 6/9] COPY .env .env                                                                  0.0s
 => CACHED [backend-server 7/9] RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/loc  0.0s
 => CACHED [backend-server 8/9] RUN composer install --no-plugins --no-scripts                                  0.0s
 => CACHED [backend-server 9/9] RUN php artisan key:generate                                                    0.0s
 => [backend-server] exporting to image                                                                         0.0s
 => => exporting layers                                                                                         0.0s
 => => writing image sha256:74b8979b79801843e1008885d067355196b90e66b3b2fd3df58bd8ce5043e7bd                    0.0s
 => => naming to docker.io/library/openchat-backend-server                                                      0.0s
docker-compose up -d #--force-recreate
[+] Running 5/5
 ✔ Network openchat_openchat_network    Created                                                                 0.1s 
 ✔ Container openchat-redis-1           Started                                                                 0.7s 
 ✔ Container openchat-llm-server-1      Started                                                                 0.9s 
 ✔ Container openchat-mysql-1           Started                                                                 0.8s 
 ✔ Container openchat-backend-server-1  Started                                                                 1.0s 
\033[1m=== Waiting for services to start (~20 seconds) ===\033[0m
\033[1m=== Clearing backend server config cache ===\033[0m
docker-compose exec backend-server php artisan cache:clear

   INFO  Application cache cleared successfully.  

docker-compose exec backend-server php artisan config:cache

   INFO  Configuration cached successfully.  

\033[1m=== Run backend server migrations ===\033[0m
docker-compose exec backend-server php artisan migrate --seed

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from information_schema.tables where table_schema = openchat and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:793
    789▕         // If an exception occurs when attempting to run a query, we'll format the error
    790▕         // message to include the bindings with SQL, which will make this exception a
    791▕         // lot more helpful to the developer instead of just the database's errors.
    792▕         catch (Exception $e) {
  ➜ 793▕             throw new QueryException(
    794▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    795▕             );
    796▕         }
    797▕     }

      +38 vendor frames 

  39  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

make: *** [Makefile:35: install] Error 1
gharbat commented 1 year ago

Hey @RoiArthurB

Can you please double check that the mysql container was alive? it takes some time for MySQL to be ready to take new connections.

RoiArthurB commented 1 year ago

@gharbat Didn't helped ... :

$ docker ps
CONTAINER ID   IMAGE                     COMMAND                  CREATED             STATUS             PORTS                                                  NAMES
f956be236619   openchat-backend-server   "docker-php-entrypoi…"   About an hour ago   Up About an hour   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp              openchat-backend-server-1
533bcae666ba   redis:3.2                 "docker-entrypoint.s…"   About an hour ago   Up About an hour   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp              openchat-redis-1
dad54b13e808   mysql:5.7                 "docker-entrypoint.s…"   About an hour ago   Up About an hour   33060/tcp, 0.0.0.0:3307->3306/tcp, :::3307->3306/tcp   openchat-mysql-1
bb80f38e3475   openchat-llm-server       "docker-entrypoint.s…"   About an hour ago   Up About an hour                                                          openchat-llm-server-1

$ make install          
\033[1m=== Putting the services down (if already running) ===\033[0m
#docker-compose down --remove-orphans
\033[1m=== Setting up Docker environment ===\033[0m
\033[1m=== This will overwrite your .env files, you still have some time to abort ===\033[0m
#@sleep 5
\033[1m=== Copying .env files ===\033[0m
#cp -n backend-server/.env.example backend-server/.env 2>/dev/null || true
#cp common.env llm-server/.env 2>/dev/null || true
#docker-compose build #--no-cache
#docker-compose up -d #--force-recreate
\033[1m=== Waiting for services to start (~20 seconds) ===\033[0m
#@sleep 20
\033[1m=== Clearing backend server config cache ===\033[0m
docker-compose exec backend-server php artisan cache:clear

   INFO  Application cache cleared successfully.  

docker-compose exec backend-server php artisan config:cache

   INFO  Configuration cached successfully.  

\033[1m=== Run backend server migrations ===\033[0m
docker-compose exec backend-server php artisan migrate --seed

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [1130] Host '172.18.0.5' is not allowed to connect to this MySQL server (Connection: mysql, SQL: select * from information_schema.tables where table_schema = openchat and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:793
    789▕         // If an exception occurs when attempting to run a query, we'll format the error
    790▕         // message to include the bindings with SQL, which will make this exception a
    791▕         // lot more helpful to the developer instead of just the database's errors.
    792▕         catch (Exception $e) {
  ➜ 793▕             throw new QueryException(
    794▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    795▕             );
    796▕         }
    797▕     }

      +35 vendor frames 

  36  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

make: *** [Makefile:35: install] Error 1