bmarsh9 / gapps

Security compliance platform - SOC2, CMMC, ASVS, ISO27001, HIPAA, NIST CSF, NIST 800-53, CSC CIS 18, PCI DSS, SSF tracking. https://gapps.darkbanner.com
Other
437 stars 99 forks source link

ERROR: relation "tasks" does not exist at character 265 #63

Closed mrmoon0986 closed 1 year ago

mrmoon0986 commented 1 year ago

Deploying using docker compose default yml file on a completely fresh VPS and having the following issue on the docker logs for postgres, tried playing around with env variables as described in the FAQ - no luck:

vmi767383  gapps : docker logs --tail 10 postgres    
2023-06-07 10:59:43.815 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-06-07 10:59:43.816 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-06-07 10:59:43.820 UTC [65] LOG:  database system was shut down at 2023-06-07 10:59:43 UTC
2023-06-07 10:59:43.825 UTC [1] LOG:  database system is ready to accept connections
2023-06-07 10:59:45.722 UTC [74] ERROR:  relation "tasks" does not exist at character 265
2023-06-07 10:59:45.722 UTC [74] STATEMENT:  SELECT tasks.id AS tasks_id, tasks.uuid AS tasks_uuid, tasks.name AS tasks_name, tasks.last_run AS tasks_last_run, tasks.not_before AS tasks_not_before, tasks.cron AS tasks_cron, tasks.date_added AS tasks_date_added, tasks.date_updated AS tasks_date_updated 
        FROM tasks
2023-06-07 11:00:00.539 UTC [74] ERROR:  current transaction is aborted, commands ignored until end of transaction block
2023-06-07 11:00:00.539 UTC [74] STATEMENT:  SELECT tasks.id AS tasks_id, tasks.uuid AS tasks_uuid, tasks.name AS tasks_name, tasks.last_run AS tasks_last_run, tasks.not_before AS tasks_not_before, tasks.cron AS tasks_cron, tasks.date_added AS tasks_date_added, tasks.date_updated AS tasks_date_updated 
        FROM tasks
bmarsh9 commented 1 year ago

Could you post the startup logs from the gapps container as well?

mrmoon0986 commented 1 year ago

@bmarsh9

docker logs gapps [INFO] Checking if we can connect to the database server: postgresql://db1:db1@postgres/db1 [ERROR] could not connect to server: Connection refused Is the server running on host "postgres" (192.168.32.2) and accepting TCP/IP connections on port 5432? [ERROR] Unable to connect to the database server [INFO] Waiting for 3 seconds [INFO] Checking if we can connect to the database server: postgresql://db1:db1@postgres/db1 [INFO] Successfully connected to the database server [INFO] Checking if we should create the models [INFO] Successfully queried the database models [INFO] Starting the server with 2 workers [2023-06-07 10:59:47 +0000] [25] [INFO] Starting gunicorn 20.1.0 [2023-06-07 10:59:47 +0000] [25] [INFO] Listening at: http://0.0.0.0:5000 (25) [2023-06-07 10:59:47 +0000] [25] [INFO] Using worker: sync [2023-06-07 10:59:47 +0000] [27] [INFO] Booting worker with pid: 27 [2023-06-07 10:59:47 +0000] [28] [INFO] Booting worker with pid: 28 178.32.197.85 - - [07/Jun/2023:11:10:22 +0000] "GET / HTTP/1.1" 302 199 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 142.4.218.114 - - [07/Jun/2023:11:33:53 +0000] "GET / HTTP/1.1" 302 199 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 192.241.198.109 - - [07/Jun/2023:12:37:07 +0000] "GET /v2/ HTTP/1.1" 404 1545 "-" "Mozilla/5.0 zgrab/0.x" 188.165.87.100 - - [07/Jun/2023:13:19:50 +0000] "GET /favicon.ico HTTP/1.1" 404 1545 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 188.165.87.105 - - [07/Jun/2023:13:21:59 +0000] "GET /favicon.ico HTTP/1.1" 404 1545 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 37.187.215.242 - - [07/Jun/2023:13:33:05 +0000] "GET /login HTTP/1.1" 200 2901 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" 188.165.87.100 - - [07/Jun/2023:14:13:15 +0000] "GET /login HTTP/1.1" 200 2901 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; r

bmarsh9 commented 1 year ago

That looks good. What behavior are you experiencing? Does the app load properly, are there any errors (outside of the postgres logs)?

Could you also visit the "tasks" endpoint (e.g. http://your-ip:5000/tasks) and see if that triggers any errors in the "gapps" container

mrmoon0986 commented 1 year ago

That looks good. What behavior are you experiencing? Does the app load properly, are there any errors (outside of the postgres logs)?

Could you also visit the "tasks" endpoint (e.g. http://your-ip:5000/tasks) and see if that triggers any errors in the "gapps" container

The problem I have is when I login I see "Internal Error" straight after and if I click home it redirects me back to the login page.

bmarsh9 commented 1 year ago

@mrmoon0986 Yeah I was able to recreate this... It may be a issue with the docker-compose version. Ill put in a fix soon to address this. In the meantime, you will need to create the database models:

Warning - this will delete data in database (assuming you don't have any data in there)

docker exec -it gapps bash
python3 manage.py init_db

After running the above commands, you can reload the app and it should be ok

mrmoon0986 commented 1 year ago

@bmarsh9 thank you, it works now, thank you very much.

bmarsh9 commented 1 year ago

Fixed in 3.4.4