SuperAGI icon indicating copy to clipboard operation
SuperAGI copied to clipboard

GUI stuck on 'Initializing SuperAGI...' on Ubuntu 20.04.3 LTS

Open gpilleux opened this issue 2 years ago • 7 comments
trafficstars

Git cloned the project, updated the keys for Pinecone, OpenAI and Google Search Engine. Applied the changed proposed by watzon on this thread but the GUI is still stuck on 'Initializing SuperAGI...' Here's my log from docker-compose up --build

Attaching to superagi_super__postgres_1, superagi_super__redis_1, superagi_gui_1, superagi_backend_1, superagi_celery_1
backend_1          | wait-for-it.sh: waiting 60 seconds for super__postgres:5432
backend_1          | wait-for-it.sh: super__postgres:5432 is available after 0 seconds
super__postgres_1  | 
super__postgres_1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
super__postgres_1  | 
super__postgres_1  | 2023-06-09 02:07:27.811 UTC [1] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
super__postgres_1  | 2023-06-09 02:07:27.812 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
super__postgres_1  | 2023-06-09 02:07:27.812 UTC [1] LOG:  listening on IPv6 address "::", port 5432
super__postgres_1  | 2023-06-09 02:07:27.817 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
super__postgres_1  | 2023-06-09 02:07:27.823 UTC [30] LOG:  database system was shut down at 2023-06-09 02:05:18 UTC
super__postgres_1  | 2023-06-09 02:07:27.829 UTC [1] LOG:  database system is ready to accept connections
super__redis_1     | 1:C 09 Jun 2023 02:07:27.764 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
super__redis_1     | 1:C 09 Jun 2023 02:07:27.764 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started
super__redis_1     | 1:C 09 Jun 2023 02:07:27.764 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
super__redis_1     | 1:M 09 Jun 2023 02:07:27.765 * monotonic clock: POSIX clock_gettime
super__redis_1     | 1:M 09 Jun 2023 02:07:27.767 * Running mode=standalone, port=6379.
super__redis_1     | 1:M 09 Jun 2023 02:07:27.767 # Server initialized
super__redis_1     | 1:M 09 Jun 2023 02:07:27.767 # 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.
super__redis_1     | 1:M 09 Jun 2023 02:07:27.768 * Loading RDB produced by version 7.0.11
super__redis_1     | 1:M 09 Jun 2023 02:07:27.768 * RDB age 129 seconds
super__redis_1     | 1:M 09 Jun 2023 02:07:27.768 * RDB memory usage when created 1.18 Mb
super__redis_1     | 1:M 09 Jun 2023 02:07:27.768 * Done loading RDB, keys loaded: 1, keys expired: 0.
super__redis_1     | 1:M 09 Jun 2023 02:07:27.768 * DB loaded from disk: 0.000 seconds
super__redis_1     | 1:M 09 Jun 2023 02:07:27.768 * Ready to accept connections
gui_1              | 
gui_1              | > [email protected] dev
gui_1              | > next dev
gui_1              | 
gui_1              | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
backend_1          | INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
backend_1          | INFO  [alembic.runtime.migration] Will assume transactional DDL.
backend_1          | INFO:     Will watch for changes in these directories: ['/app']
backend_1          | INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
backend_1          | INFO:     Started reloader process [1] using WatchFiles
celery_1           | Connected to the database! @ postgresql://superagi:password@super__postgres/super_agi_main
backend_1          | Connected to the database! @ postgresql://superagi:password@super__postgres/super_agi_main
celery_1           | /usr/local/lib/python3.9/site-packages/celery/platforms.py:840: SecurityWarning: You're running the worker with superuser privileges: this is
celery_1           | absolutely not recommended!
celery_1           | 
celery_1           | Please specify a different user using the --uid option.
celery_1           | 
celery_1           | User information: uid=0 euid=0 gid=0 egid=0
celery_1           | 
celery_1           |   warnings.warn(SecurityWarning(ROOT_DISCOURAGED.format(
celery_1           |  
celery_1           |  -------------- celery@63fd7abe0ab4 v5.2.7 (dawn-chorus)
celery_1           | --- ***** ----- 
celery_1           | -- ******* ---- Linux-5.4.0-121-generic-x86_64-with-glibc2.31 2023-06-09 02:07:33
celery_1           | - *** --- * --- 
celery_1           | - ** ---------- [config]
celery_1           | - ** ---------- .> app:         superagi:0x7f8c22038af0
celery_1           | - ** ---------- .> transport:   redis://super__redis:6379/0
celery_1           | - ** ---------- .> results:     redis://super__redis:6379/0
celery_1           | - *** --- * --- .> concurrency: 10 (prefork)
celery_1           | -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
celery_1           | --- ***** ----- 
celery_1           |  -------------- [queues]
celery_1           |                 .> celery           exchange=celery(direct) key=celery
celery_1           |                 
celery_1           | 
celery_1           | [tasks]
celery_1           |   . execute_agent
celery_1           | 
celery_1           | [2023-06-09 02:07:34,643: INFO/MainProcess] Connected to redis://super__redis:6379/0
celery_1           | [2023-06-09 02:07:34,647: INFO/MainProcess] mingle: searching for neighbors
gui_1              | - event compiled client and server successfully in 3.3s (781 modules)
gui_1              | - wait compiling...
celery_1           | [2023-06-09 02:07:35,658: INFO/MainProcess] mingle: all alone
celery_1           | [2023-06-09 02:07:35,676: INFO/MainProcess] celery@63fd7abe0ab4 ready.
gui_1              | - event compiled client and server successfully in 624 ms (781 modules)
backend_1          | INFO:     Started server process [20]
backend_1          | INFO:     Waiting for application startup.
backend_1          | INFO:     Application startup complete.
gui_1              | - wait compiling /_error (client and server)...
gui_1              | - event compiled client and server successfully in 384 ms (782 modules)
gui_1              | Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap"). Use Document instead. 
gui_1              | See more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component
gui_1              | Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"). Use Document instead. 
gui_1              | See more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component
gui_1              | - wait compiling /favicon.ico/route (client and server)...
gui_1              | - event compiled successfully in 90 ms (135 modules)

gpilleux avatar Jun 09 '23 02:06 gpilleux

Same here. Changing every occurence of "localhost" and "127.0.0.1" to the real IP worked for me.

crashr avatar Jun 09 '23 12:06 crashr

@gpilleux it should have worked there seems no error in the logs shared, what do you see in localhost:3000?

I saw errors in browser devtool console caused by teh fact that I am running SuperAGI on another host and not on localhost.

crashr avatar Jun 09 '23 12:06 crashr

Hey, did you set ENV:DEV in config.yaml?

luciferlinx101 avatar Jun 09 '23 12:06 luciferlinx101

Hey, did you set ENV:DEV in config.yaml?

Can you provide more information on this setup? What exactly do we need to do?

sashkavesna avatar Jun 09 '23 12:06 sashkavesna

I got the same error because of i am running it on another server other than lcoalhost. I follow this config steps and successed. The core is add your real address in main.py. image

weianweigan avatar Jun 09 '23 14:06 weianweigan

I tried many combinations of settings of IPs and couldn't get it working and actually got a bit confused. When I execute ifconfig I get many bridges on different IP addresses. Also, the IP set for a specific container is dynamic, so wouldn't that be a problem if I restart the containers?

Can someone please write a step by step, assuming I have a fresh git main branch cloned repo and the APIs for OpenAI, Pinecone and Google Search all setup?

PS: I am running this on a dedicated server, not on my local machine. Let's say for example, I can access the GUI through the following link: http://40.30.20.233:3000/ (not my real IP server btw)

gpilleux avatar Jun 09 '23 17:06 gpilleux

Can someone please write a step by step

This is what I did:

$ egrep -nrI "(127.0.0.1|localhost)" /tmp/SuperAGI
/tmp/SuperAGI/main.py:54:# app.add_middleware(DBSessionMiddleware, db_url=f'postgresql://{db_username}:{db_password}@localhost/{db_name}')
/tmp/SuperAGI/main.py:59:    "http://localhost:3001",
/tmp/SuperAGI/main.py:60:    "http://localhost:3000",
/tmp/SuperAGI/main.py:342:    frontend_url = superagi.config.config.get_config("FRONTEND_URL", "http://localhost:3000")
/tmp/SuperAGI/test_main.http:3:GET http://127.0.0.1:8000/
/tmp/SuperAGI/test_main.http:8:GET http://127.0.0.1:8000/hello/User
/tmp/SuperAGI/gui/pages/api/apiConfig.js:4:const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8001';
/tmp/SuperAGI/gui/README.md:15:Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
/tmp/SuperAGI/docker-compose.yaml:33:      - NEXT_PUBLIC_API_BASE_URL=http://localhost:8001
/tmp/SuperAGI/config_template.yaml:40:FRONTEND_URL: "http://localhost:3000"
/tmp/SuperAGI/README.MD:122:5. Once you have Docker Desktop running, run command : `docker-compose up --build` in SuperAGI directory. Open your browser and go to `localhost:3000` to see SuperAGI running.
/tmp/SuperAGI/superagi/message_broker/redis.py:10:    redis_host = get_config("REDIS_HOST", "localhost")
/tmp/SuperAGI/superagi/message_broker/kafka.py:11:    self.broker_bootstrap_servers = get_config("BROKER_BOOTSTRAP_SERVERS", "localhost:9092")
$ for file in $(egrep -nrI "(127.0.0.1|localhost)" /tmp/SuperAGI* | cut -d: -f1); do sed -i 's/\(127.0.0.1\|localhost\)/192.168.123.4/g' $file; done
$ egrep -nrI "(127.0.0.1|localhost)" /tmp/SuperAGI
$

crashr avatar Jun 09 '23 17:06 crashr

Ahh yes, amazing this worked like a charm. So much thanks @crashr !

gpilleux avatar Jun 09 '23 19:06 gpilleux

@sashkavesna there was change in config_template.yaml with many new configs added many of them have default values you just need to copy them to your config.yaml. ENV:DEV is one of those config and not having it could be one reason to stuck on initializing super agi stuck screen and another could be CORS issue if you are running frontend and backend on dedicated server add the IP address of the frontend in allowed origins array as mentioned by @weianweigan

luciferlinx101 avatar Jun 10 '23 08:06 luciferlinx101

@sashkavesna there was change in config_template.yaml with many new configs added many of them have default values you just need to copy them to your config.yaml. ENV:DEV is one of those config and not having it could be one reason to stuck on initializing super agi stuck screen and another could be CORS issue if you are running frontend and backend on dedicated server add the IP address of the frontend in allowed origins array as mentioned by @weianweigan

luciferlinx101 avatar Jun 10 '23 08:06 luciferlinx101

@crashr , It worked for me! Thank you so much!

Ceasy avatar Jun 12 '23 09:06 Ceasy