Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when migrating database #6550

Open
DesNotMe opened this issue Jan 16, 2025 · 19 comments
Open

Error when migrating database #6550

DesNotMe opened this issue Jan 16, 2025 · 19 comments
Assignees
Labels
component/api status/waiting-for-revision Waiting for maintainer's revision

Comments

@DesNotMe
Copy link

Steps to Reproduce

  1. Just started installing prowler app using github.

Expected behavior

Actual Result with Screenshots or Logs

(venv) mervyn.lee.int@IT-MAC backend % python manage.py migrate --database admin usage: manage.py migrate [-h] [--noinput] [--database {default}] [--fake] [--fake-initial] [--plan] [--run-syncdb] [--check] [--prune] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] [app_label] [migration_name] manage.py migrate: error: argument --database: invalid choice: 'admin' (choose from default)

(venv) mervyn.lee.int@IT-MAC backend % python manage.py migrate --database default Traceback (most recent call last): File "/Users/mervyn.lee.int/prowler/api/src/backend/manage.py", line 24, in <module> main() ~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/manage.py", line 20, in main execute_from_command_line(sys.argv) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() ~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/base.py", line 107, in wrapper res = handle_func(*args, **kwargs) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/commands/migrate.py", line 118, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/loader.py", line 58, in __init__ self.build_graph() ~~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/loader.py", line 235, in build_graph self.applied_migrations = recorder.applied_migrations() ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/recorder.py", line 89, in applied_migrations if self.has_table(): ~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/recorder.py", line 63, in has_table with self.connection.cursor() as cursor: ~~~~~~~~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/utils/asyncio.py", line 26, in inner return func(*args, **kwargs) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/backends/base/base.py", line 320, in cursor return self._cursor() ~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/backends/dummy/base.py", line 20, in complain raise ImproperlyConfigured( ...<3 lines>... ) django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

How did you install Prowler?

Cloning the repository from github.com (git clone)

Environment Resource

  1. On terminal.

OS used

  1. MacOS

Prowler version

Prowler 5.1.0

Pip version

(venv) mervyn.lee.int@IT-MAC backend % python manage.py migrate --database default Traceback (most recent call last): File "/Users/mervyn.lee.int/prowler/api/src/backend/manage.py", line 24, in main() ~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/manage.py", line 20, in main execute_from_command_line(sys.argv) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() ~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/init.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/base.py", line 107, in wrapper res = handle_func(*args, **kwargs) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/core/management/commands/migrate.py", line 118, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/executor.py", line 18, in init self.loader = MigrationLoader(self.connection) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/loader.py", line 58, in init self.build_graph() ~~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/loader.py", line 235, in build_graph self.applied_migrations = recorder.applied_migrations() ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/recorder.py", line 89, in applied_migrations if self.has_table(): ~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/migrations/recorder.py", line 63, in has_table with self.connection.cursor() as cursor: ~~~~~~~~~~~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/utils/asyncio.py", line 26, in inner return func(*args, **kwargs) File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/backends/base/base.py", line 320, in cursor return self._cursor() ~~~~~~~~~~~~^^ File "/Users/mervyn.lee.int/prowler/api/src/backend/venv/lib/python3.13/site-packages/django/db/backends/dummy/base.py", line 20, in complain raise ImproperlyConfigured( ...<3 lines>... ) django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

Context

No response

@DesNotMe DesNotMe added bug status/needs-triage Issue pending triage labels Jan 16, 2025
@vicferpoy vicferpoy self-assigned this Jan 16, 2025
@vicferpoy
Copy link
Member

Hello @DesNotMe ,

My guess is that you are probably not using all the necessary environment variables. If you want to install and use the Prowler App from sources, installing and running each service by yourself, please follow the steps from https://github.com/prowler-cloud/prowler/blob/master/README.md#from-github.

If you have docker and docker-compose installed, you can simply clone the repository and run docker compose up to use the Prowler App right away.

Let me know if you need anything else.

@DesNotMe
Copy link
Author

i am facing this error when running docker compose up:
mervyn.lee.int@IT-MAC prowler % docker compose up [+] Running 11/17 ✘ ui Error no matching manifest for linux/a... 6.8s ⠏ worker-beat Pulling 6.8s ⠏ worker Pulling 6.8s ⠏ api [⣿⣿⣿⣿⣷⣤⣿⣿⣿⣿⣿⣿] 432MB / 752.3MB Pulling 6.8s ✔ 4f4fb700ef54 Already exists 0.4s ✔ c526301b8513 Already exists 0.4s ✔ b8d041061154 Already exists 0.4s ✔ 0cd9613e12e6 Already exists 0.4s ⠼ 0ed976e787b5 Downloading 119.5MB/127.6MB 3.4s ⠼ 15e5892e8638 Downloading 312.5MB/624.8MB 3.4s ✔ 9214935ee872 Already exists 0.4s ✔ b0435d4e6672 Already exists 0.4s ✔ 1bba0cd25fe0 Already exists 0.4s ✔ 3c4e0c14650a Already exists 0.4s ✔ 75dc55e4073b Already exists 0.4s ✔ 66a3d608f3fa Already exists 0.4s ⠏ postgres Pulling 6.8s Error response from daemon: no matching manifest for linux/arm64/v8 in the manifest list entries: no match for platform in manifest: not found

@DesNotMe
Copy link
Author

Additionally, I can't find dockerfile.

@vicferpoy vicferpoy added status/waiting-for-revision Waiting for maintainer's revision and removed status/needs-triage Issue pending triage labels Jan 16, 2025
@vicferpoy
Copy link
Member

The error is probably coming from the platform issues with MacOS and docker. Please take a look at the requirements for docker installation in https://github.com/prowler-cloud/prowler/blob/master/README.md#docker-compose:

Containers are built for linux/amd64. If your workstation's architecture is different, please set DOCKER_DEFAULT_PLATFORM=linux/amd64 in your environment or use the --platform linux/amd64 flag in the docker command. Enjoy Prowler App at http://localhost:3000/ by signing up with your email and password.

Regarding the Dockerfile, it's at root level: https://github.com/prowler-cloud/prowler/blob/5.1.0/Dockerfile

@DesNotMe
Copy link
Author

thanks for the reply @vicferpoy! So I gotta copy and paste the docker file from the link into a created Dockerfile, am I right? For context, I followed the 2 commands before composing. Additionally, do I have to build first, before composing?
Screenshot 2025-01-16 at 5 56 57 PM
https://docs.prowler.com/projects/prowler-open-source/en/latest/#__tabbed_1_1

@vicferpoy
Copy link
Member

Apologies for the confusion. I assumed you were going to use the docker-compose.yml from the repository since you have it already cloned, but it's really the same.

If you take a look at the docker-compose.yml contents, you will see that Prowler App services pull images instead of building any local image through Dockerfile. It should be as simple as running docker compose up -d in your prowler-dockercompose directory.

@DesNotMe
Copy link
Author

but isn't my platform wrong? I need to change linux/amd64 right?

@vicferpoy
Copy link
Member

You can use export DOCKER_DEFAULT_PLATFORM=linux/amd64.

I have that line in my ~/.zshrc file so I don't have to take care of it every time I open a new terminal.

@DesNotMe
Copy link
Author

DesNotMe commented Jan 16, 2025

So currently, I did the 2 commands and only 2 files were created. The rest of the prowler files were not included. So I just need to edit in the docker-compose.yml?

https://docs.prowler.com/projects/prowler-open-source/en/latest/#__tabbed_1_1

@vicferpoy
Copy link
Member

No. If you already have the 2 files, you just need to:

  1. Run export DOCKER_DEFAULT_PLATFORM=linux/amd64
  2. Run docker compose up -d

Then, the Prowler App will be running in the background, but you will be able to check the services status with docker ps.

@DesNotMe
Copy link
Author

sorry for my noob technicality, but im getting this error:
mervyn.lee.int@IT-MAC prowler-dockercompose % docker compose up -d [+] Running 4/5 ✘ worker Error no matching manifest for linux/arm64... 4.0s ✘ api Error context canceled 4.0s ✘ worker-beat Error context canceled 4.0s ✘ ui Error context canceled 4.0s ⠏ postgres Pulling 4.0s Error response from daemon: no matching manifest for linux/arm64 in the manifest list entries: no match for platform in manifest: not found

@DesNotMe
Copy link
Author

hey @vicferpoy, was able to access the application, however, I have this issue while the app is running.:
mervyn.lee.int@IT-MAC prowler-dockercompose % docker compose up -d [+] Running 6/6 ✔ postgres Pulled 2.5s ✔ ui Pulled 2.5s ✔ worker Pulled 2.6s ✔ api Pulled 2.5s ✔ valkey Pulled 2.5s ✔ worker-beat Pulled 2.5s [+] Running 0/1 ⠋ Container prowler-dockercompose-ui-1 Recreate 0.0s Error response from daemon: No such image: prowlercloud/prowler-ui:latest

@DesNotMe
Copy link
Author

I got this error as well when signing up.
image

@vicferpoy
Copy link
Member

Hey @DesNotMe ,

I see you are trying to pull prowlercloud/prowler-ui:latest. That makes me think you are not using a stable version. Please choose Prowler v5.1, which is the latest stable version and try again. If you don't mind, purge your docker environment deleting all the images from Prowler before doing trying to redeploy just in case.

@DesNotMe
Copy link
Author

hey @vicferpoy appreciate the reply. Please bear with me, I am new to this. I am using M2 Pro. Prowler v5.1, do you mean image or what?

@DesNotMe
Copy link
Author

Additionally, I am using an arm based laptop I assume, apparently the image only supports amd64. Another question I want to ask is, apparently I was able to have successful compose with this particular platform, even though linux/x86_64/v8 is intel/amd architecture, why is that so?

Image

@DesNotMe
Copy link
Author

@vicferpoy appreciate if you could reply ! thank you !

@DesNotMe
Copy link
Author

DesNotMe commented Jan 20, 2025

currently getting this error when pulling v5.1 image:

mervyn.lee.int@IT-MAC prowler-dockercompose % docker pull prowlercloud/prowler-ui:5.1.0 Error response from daemon: no matching manifest for linux/arm64 in the manifest list entries: no match for platform in manifest: not found

This is my docker-compose.yml:

`services:
api:
#platform: linux/x86_64/v8
platform: linux/arm64
hostname: "prowler-api"
image: prowlercloud/prowler-ui:5.1.0
env_file:
- path: .env
required: false
ports:
- "${DJANGO_PORT:-8080}:${DJANGO_PORT:-8080}"
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_healthy
entrypoint:
- "/home/prowler/docker-entrypoint.sh"
- "prod"

ui:
#platform: linux/x86_64/v8
platform: linux/arm64
image: prowlercloud/prowler-ui:5.1.0
env_file:
- path: .env
required: false
ports:
- ${UI_PORT:-3000}:${UI_PORT:-3000}

postgres:
#platform: linux/x86_64/v8
platform: linux/arm64
image: postgres:16.3-alpine3.20
hostname: "postgres-db"
volumes:
- ./_data/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_ADMIN_USER}
- POSTGRES_PASSWORD=${POSTGRES_ADMIN_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
env_file:
- path: .env
required: false
ports:
- "${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}"
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_ADMIN_USER} -d ${POSTGRES_DB}'"]
interval: 5s
timeout: 5s
retries: 5

valkey:
#platform: linux/x86_64/v8
platform: linux/arm64
image: valkey/valkey:7-alpine3.19
hostname: "valkey"
volumes:
- ./_data/valkey:/data
env_file:
- path: .env
required: false
ports:
- "${VALKEY_PORT:-6379}:6379"
healthcheck:
test: ["CMD-SHELL", "sh -c 'valkey-cli ping'"]
interval: 10s
timeout: 5s
retries: 3

worker:
#platform: linux/x86_64/v8
platform: linux/arm64
image: prowlercloud/prowler-ui:5.1.0
env_file:
- path: .env
required: false
depends_on:
valkey:
condition: service_healthy
postgres:
condition: service_healthy
entrypoint:
- "/home/prowler/docker-entrypoint.sh"
- "worker"

worker-beat:
#platform: linux/x86_64/v8
platform: linux/arm64
image: prowlercloud/prowler-ui:5.1.0
env_file:
- path: ./.env
required: false
depends_on:
valkey:
condition: service_healthy
postgres:
condition: service_healthy
entrypoint:
- "../docker-entrypoint.sh"
- "beat"
`

@vicferpoy
Copy link
Member

No. If you already have the 2 files, you just need to:

  1. Run export DOCKER_DEFAULT_PLATFORM=linux/amd64
  2. Run docker compose up -d

Then, the Prowler App will be running in the background, but you will be able to check the services status with docker ps.

As I said here, you just need to export that environment variable and run the command. You can download the Prowler v5.1 stable version from here if you do not know how to rollback the changes you made: https://github.com/prowler-cloud/prowler/releases/tag/5.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/api status/waiting-for-revision Waiting for maintainer's revision
Projects
None yet
Development

No branches or pull requests

3 participants