Self-hosting

DefectDojo on a VPS: centralize your vulnerabilities

Trivy in CI, Semgrep on pull requests, a weekly ZAP scan, a yearly penetration test: each tool produces its own report, in its own format, and nobody knows any more which flaw has already been fixed. OWASP DefectDojo gathers all these results into a single list, removes duplicates, closes what has disappeared and gives each finding a remediation deadline. This guide installs it on a VPS with Docker Compose, publishes it over HTTPS behind nginx and wires it into your pipeline.

Deploy on a VPS Cloud →
7 min read3 steps
Contents· What DefectDojo does1/11
  1. 01What DefectDojo does
  2. 02What DefectDojo gives you
  3. 03Scattered scanner reports or DefectDojo on your VPS
  4. 04Prepare the server
  5. 05Install DefectDojo with Docker Compose
  6. 06Set the admin password yourself
  7. 07Publish DefectDojo over HTTPS behind nginx
  8. 08Import reports from CI
  9. 09Triage, set deadlines, accept a risk
  10. 10Backup and upgrades
  11. 11DefectDojo in one click on ServOrbit

What DefectDojo does

DefectDojo is an OWASP flagship project, released under the BSD-3-Clause license and written in Python with Django. It is not a scanner: it does not look for flaws itself. It receives the reports of your scanners — more than 200 formats recognized — and turns them into findings organized in a simple hierarchy: product type, product, engagement, test.

Its value lies in what it does with those findings: it recognizes the same flaw seen twice, closes the ones that disappeared at the next scan, attaches a severity, an owner and a deadline, and keeps a record of every decision — including risk acceptance.

What DefectDojo gives you

  • One list — results from Trivy, Semgrep, Gitleaks, ZAP, Burp or Nessus in the same place, in the same format.
  • Deduplication — a flaw found by two tools, or on every build, appears only once.
  • Reimport — a new report closes fixed findings and adds new ones, without losing history.
  • Deadlines (SLA) — a remediation deadline per severity, with overdue findings highlighted.
  • Recorded decisions — false positive, out of scope or risk accepted until a date, with its justification.
  • A complete API and Jira — import from CI, tickets created and kept in sync, reports for clients and auditors.

Scattered scanner reports or DefectDojo on your VPS

Scroll the table

Reports left in CIWith DefectDojo on your VPS
Where to read resultsOne log per tool and per buildA single list per product
DuplicatesEvery build repeats the same flawsDeduplicated automatically
Fixed flawChecked by handClosed at the next reimport
Remediation deadlineNot trackedSLA per severity, overdue items visible
Evidence for an auditTo be reconstructedDated history of every finding

Prepare the server

Plan an Ubuntu 24.04 VPS with at least 2 GB of RAM and 2 vCPUs: all the containers together use about 700 MB at rest. Move to 4 GB if you import reports on every build across several products, since the Celery worker handles imports and deduplication. Allow 20 GB of disk.

You also need Docker with the Compose plugin, and a domain name (or subdomain) pointing to the VPS: your pipelines will upload their reports to that address over HTTPS.

Install DefectDojo with Docker Compose

  1. Prepare the folder and the .env file

    The file holds the domain, the database password, the admin password and the application's two keys.

    mkdir -p /opt/defectdojo && cd /opt/defectdojo
    cat > .env <<EOF
    DOMAIN=defectdojo.example.com
    DB_PASSWORD=$(openssl rand -hex 16)
    ADMIN_PASSWORD=$(openssl rand -hex 12)
    SECRET_KEY=$(openssl rand -hex 24)
    AES_KEY=$(openssl rand -hex 16)
    EOF
    chmod 600 .env
  2. Write the docker-compose.yml file

    Seven services: PostgreSQL, Valkey (task queue and cache), the initializer, the application (uWSGI), the Celery worker and scheduler, and DefectDojo's official nginx. The images come from Docker Hub. The port is published on the loopback only: only the VPS's nginx will face the Internet.

    x-dd-env: &dd-env
      DD_DATABASE_URL: postgresql://defectdojo:${DB_PASSWORD}@postgres:5432/defectdojo
      DD_CELERY_BROKER_URL: redis://valkey:6379/0
      DD_CACHE_URL: redis://valkey:6379/1
      DD_SECRET_KEY: ${SECRET_KEY}
      DD_CREDENTIAL_AES_256_KEY: ${AES_KEY}
      DD_ALLOWED_HOSTS: "*"
      DD_SITE_URL: https://${DOMAIN}
      DD_CSRF_TRUSTED_ORIGINS: https://${DOMAIN}
      DD_SECURE_PROXY_SSL_HEADER: "True"
    
    services:
      postgres:
        image: postgres:18.6-alpine
        restart: unless-stopped
        environment:
          POSTGRES_DB: defectdojo
          POSTGRES_USER: defectdojo
          POSTGRES_PASSWORD: ${DB_PASSWORD}
        volumes:
          - postgres:/var/lib/postgresql/data
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -q -U defectdojo"]
          interval: 10s
          retries: 30
    
      valkey:
        image: valkey/valkey:9.1.2-alpine
        restart: unless-stopped
        volumes:
          - valkey:/data
    
      initializer:
        image: defectdojo/defectdojo-django:3.5.202
        restart: "no"
        depends_on:
          postgres:
            condition: service_healthy
        entrypoint: ["/wait-for-it.sh", "postgres:5432", "--", "/entrypoint-initializer.sh"]
        environment:
          <<: *dd-env
          DD_INITIALIZE: "true"
          DD_ADMIN_USER: admin
          DD_ADMIN_MAIL: [email protected]
          DD_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    
      uwsgi:
        image: defectdojo/defectdojo-django:3.5.202
        restart: unless-stopped
        depends_on:
          initializer:
            condition: service_completed_successfully
        entrypoint: ["/wait-for-it.sh", "postgres:5432", "--", "/entrypoint-uwsgi.sh"]
        environment: *dd-env
        volumes:
          - media:/app/media
    
      celerybeat:
        image: defectdojo/defectdojo-django:3.5.202
        restart: unless-stopped
        depends_on:
          initializer:
            condition: service_completed_successfully
        entrypoint: ["/wait-for-it.sh", "postgres:5432", "--", "/entrypoint-celery-beat.sh"]
        environment: *dd-env
    
      celeryworker:
        image: defectdojo/defectdojo-django:3.5.202
        restart: unless-stopped
        depends_on:
          initializer:
            condition: service_completed_successfully
        entrypoint: ["/wait-for-it.sh", "postgres:5432", "--", "/entrypoint-celery-worker.sh"]
        environment: *dd-env
        volumes:
          - media:/app/media
    
      nginx:
        image: defectdojo/defectdojo-nginx:3.5.202
        restart: unless-stopped
        depends_on: [uwsgi]
        ports:
          - "127.0.0.1:8080:8080"
        volumes:
          - media:/usr/share/nginx/html/media
    
    volumes:
      postgres: {}
      valkey: {}
      media: {}
  3. Start the stack

    The initializer applies the migrations, loads the reference data and creates the admin account with ADMIN_PASSWORD, then stops. The other services wait for it to finish: allow a few minutes on first start.

    docker compose up -d
    docker compose logs -f initializer
    curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/login

    The last command answers 200 once the interface is ready.

Set the admin password yourself

Without DD_ADMIN_PASSWORD, DefectDojo draws a random password and writes it only to the log of the initializer, which any user of the docker group can read back. Put it in the .env file and change it at first sign-in if other people have access to the server. Remember DD_CSRF_TRUSTED_ORIGINS too: behind an HTTPS proxy, Django rejects the login form without it (CSRF error 403).

Publish DefectDojo over HTTPS behind nginx

The VPS's nginx receives the domain and forwards to the local port. Raise client_max_body_size: a Nessus or ZAP report quickly exceeds the default 1 MB limit, and the import would fail with a 413 error.

server {
  listen 443 ssl;
  server_name defectdojo.example.com;
  # Let's Encrypt certificates (certbot --nginx)
  client_max_body_size 100m;
  location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_read_timeout 300s;
  }
}

Get the certificate with certbot --nginx -d defectdojo.example.com, then open https://defectdojo.example.com and sign in as admin.

Import reports from CI

In your profile menu, open API v2 Key and copy the token; preferably create a dedicated service account, since the token acts with its owner's rights. Store it in your CI secrets.

Then use the reimport-scan endpoint rather than import-scan: it updates the same test on every build instead of creating a new one, and close_old_findings closes what has disappeared. Example for GitHub Actions:

- name: Send the Trivy report to DefectDojo
  run: |
    trivy image --format json -o trivy.json "$IMAGE"
    curl -fsS -X POST "https://$DD_HOST/api/v2/reimport-scan/" \
      -H "Authorization: Token $DD_API_KEY" \
      -F scan_type="Trivy Scan" -F [email protected] \
      -F product_type_name="Applications" -F product_name="my-app" \
      -F engagement_name="ci-main" -F auto_create_context=true \
      -F close_old_findings=true -F minimum_severity=Low

The same call works from GitLab CI or Jenkins; only scan_type changes from one tool to another (Semgrep JSON Report, Gitleaks Scan, ZAP Scan…).

Triage, set deadlines, accept a risk

Under Configuration → SLA Configuration, set a deadline per severity, for example 7 days for a critical flaw and 30 for a high one: overdue findings stand out on the dashboard. Each finding can then be marked false positive, out of scope or covered by a dated risk acceptance, with its justification. Connect Jira under Configuration → JIRA to create one ticket per finding or per group of findings and keep statuses in sync.

Backup and upgrades

All the useful state lives in PostgreSQL, plus the attachments in the media volume. Back up the database every night:

cd /opt/defectdojo
docker compose exec -T postgres pg_dump -U defectdojo defectdojo | gzip > /root/defectdojo-$(date +%F).sql.gz

To upgrade, change the version number of the three defectdojo images in the Compose file, then run docker compose pull && docker compose up -d: the initializer replays the migrations before the application restarts. Read the release notes before skipping several versions at once.

DefectDojo in one click on ServOrbit

On a ServOrbit VPS, DefectDojo installs from the Marketplace: official images, PostgreSQL and Valkey, an admin account created with a generated password shown in your client area, and an nginx reverse proxy over HTTPS on your domain or on the VPS's free subdomain. Pair it with Dependency-Track for your dependencies and SonarQube for code quality: DefectDojo can import their results.

Share this articleservorbit.com/ma-en/blog/self-host-defectdojo-vps-devsecops

Your vulnerabilities tracked, on your VPS

Prices shown excluding VAT, with their renewal price.