* docs(README): add migration and fixtures commands * docs(README): add env variables info
Prowler SaaS and Prowler Open Source are as dynamic and adaptable as the environment they’re meant to protect. Trusted by the leaders in security.
Learn more at prowler.com
Description
Prowler is an Open Source security tool to perform AWS, Azure, Google Cloud and Kubernetes security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness, and also remediations! We have Prowler CLI (Command Line Interface) that we call Prowler Open Source and a service on top of it that we call Prowler SaaS.
This repository contains the REST API and Task Runner components for Prowler, which facilitate a complete backend that interacts with the Prowler SDK and is used by the Prowler UI.
Production deployment
Install all dependencies with Poetry
poetry install
poetry shell
Run the Django server with Gunicorn
cd src/backend
gunicorn -c backend/guniconf.py backend.wsgi:application
By default, the Gunicorn server will try to use as many workers as your machine can handle. You can manually change that in the
src/backend/backend/guniconf.pyfile.
💻 Development guide
Local deployment
This method requires installing a Python virtual environment and keep dependencies updated.
Clone the repository
# HTTPS
git clone https://github.com/prowler-cloud/api.git
# SSH
git clone git@github.com:prowler-cloud/api.git
Install the Python dependencies
You must have Poetry installed
poetry install
poetry shell
Run the Django development server
cd backend
python manage.py runserver
You can access the server in http://localhost:8000.
All changes in the code will be automatically reloaded in the server.
Docker deployment
This method requires docker and docker compose.
Clone the repository
# HTTPS
git clone https://github.com/prowler-cloud/api.git
# SSH
git clone git@github.com:prowler-cloud/api.git
Build the base image
docker compose --profile dev build
Run the development service
docker compose --profile dev up
You can access the server in http://localhost:8080.
All changes in the code will be automatically reloaded in the server.
NOTE: notice how the port is different. When developing using docker, the port will be
8080to prevent conflicts.
Modify environment variables
Under the root path of the project, you can find a file called .env.example. This file shows all the environment variables that the project uses. You can create a new file called .env and set the values for the variables.
All these variables will have a default value for the devel environment, but credentials or database connectors will be required for the production one.
Keep in mind if you export the .env file to use it with local deployment that you will have to do it within the context of the Poetry interpreter, not before. Otherwise, variables will not be loaded properly.
Apply migrations
For migrations, you need to force the admin database router. Assuming you have the correct environment variables and Python virtual environment, run:
python manage.py migrate --database admin
Apply fixtures
As for migrations, with the same requirements, run:
# For dev tenants
python manage.py loaddata api/fixtures/dev_tenants.json --database admin

