DefectDojo / django-DefectDojo

DevSecOps, ASPM, Vulnerability Management. All on one platform.
https://defectdojo.com
BSD 3-Clause "New" or "Revised" License
3.68k stars 1.55k forks source link

upgrade to 2.39.2 error: The data directory was initialized by PostgreSQL version 16, which is not compatible with this version 17.0 #11123

Open saeedsrm opened 4 days ago

saeedsrm commented 4 days ago

Slack us first! The easiest and fastest way to help you is via Slack. There's a free and easy signup to join our #defectdojo channel in the OWASP Slack workspace: Get Access. If you're confident you've found a bug, or are allergic to Slack, you can submit an issue anyway.

Be informative

I want to upgrade from version 2.38 to version 2.39 and I am facing this error

Expected behavior A clear and concise description of what you expected to happen.

Deployment method (select with an X)

Environment information

Logs

django-defectdojo-postgres-1 | django-defectdojo-postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization django-defectdojo-postgres-1 | django-defectdojo-postgres-1 | 2024-10-23 12:37:02.396 UTC [1] FATAL: database files are incompatible with server django-defectdojo-postgres-1 | 2024-10-23 12:37:02.396 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 16, which is not compatible with this version 17.0.

django-defectdojo-celerybeat-1 | [23/Oct/2024 12:37:38] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celeryworker-1 | [23/Oct/2024 12:37:38] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celeryworker-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celeryworker-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celerybeat-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celerybeat-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celeryworker-1 | [23/Oct/2024 12:37:40] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celerybeat-1 | [23/Oct/2024 12:37:40] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celerybeat-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celerybeat-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celeryworker-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celeryworker-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celeryworker-1 | [23/Oct/2024 12:37:42] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celerybeat-1 | [23/Oct/2024 12:37:42] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celerybeat-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celeryworker-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celerybeat-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celeryworker-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celerybeat-1 | [23/Oct/2024 12:37:44] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celeryworker-1 | [23/Oct/2024 12:37:44] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celerybeat-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celerybeat-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celeryworker-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celeryworker-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celerybeat-1 | [23/Oct/2024 12:37:46] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celeryworker-1 | [23/Oct/2024 12:37:46] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celerybeat-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celerybeat-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celeryworker-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution django-defectdojo-celeryworker-1 | CommandError: "psql -U defectdojo -h postgres -p 5432 defectdojo" returned non-zero exit status 2. django-defectdojo-celerybeat-1 | [23/Oct/2024 12:37:49] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celeryworker-1 | [23/Oct/2024 12:37:49] INFO [dojo.models:4583] enabling audit logging django-defectdojo-celeryworker-1 | psql: error: could not translate host name "postgres" to address: Temporary failure in name resolution

Sample scan files If applicable, add sample scan files to help reproduce your problem.

Screenshots If applicable, add screenshots to help explain your problem.

image

Additional context (optional) Add any other context about the problem here.

mtesauro commented 17 hours ago

@saeedsrm I'm guessing that you're not using an external DB running on a VM or similar external to where DefectDojo is running.

I'm also not sure how you're doing your docker compose, but you can fix the version in the Postgres stanza to avoid it from changing to a new major version of Postgres until you want to change e.g.

  postgres:
    image: postgres:16.4@sha256:91f464e7ba0ad91a106c94cff079fb4384139291b8c0502fd36989cf2c788bbb

Doing so, allows you to choose when to update the version of Postgres you're using.

Alternatively, Postgres includes pg_upgrade to upgrade table data from one major version to the next - see https://www.postgresql.org/docs/current/pgupgrade.html

Either of those should get you back up and running.