Skip to content

Builds Docker image for running Flyway-based PostgreSQL migrations as an init container in Kubernetes, ensuring proper schema setup and updates for CVE data management.

Notifications You must be signed in to change notification settings

cyse7125-su24-team10/db-cve-processor

Repository files navigation

db-cve-processor

Overview

This project uses Flyway to manage PostgreSQL database migrations for handling Common Vulnerabilities and Exposures (CVE) data and builds docker image.

Project Structure

  • /migrations: Contains SQL scripts for database schema and updates.
  • Dockerfile: Defines the Docker image for running Flyway migrations.
  • flyway.conf: Configuration file for database connection and migration settings.

Database Schema

  • Schema: cve
  • Table: CVE
    • id: Unique CVE identifier
    • datatype: Data type
    • dataversion: Data version
    • cve_metadata: JSONB column for CVE metadata
    • containers: JSONB column for container info
  • Two GIN indexes are created on the JSONB columns for better query performance.

Setup and Configuration

Environment Variables

Set the following variables:

  • DB_HOST: PostgreSQL host
  • DB_PORT: Database port
  • DB_NAME: Database name
  • DB_USER: Database user
  • DB_PASSWORD: User password
  • DB_SCHEMA: Schema name (cve)

Flyway Configuration

The flyway.conf file includes database connection details and migration script locations.

Running Migrations

  1. Build the Docker Image:
    docker build -t cve-migration . 
    

Running Migrations

To run the migrations, follow these steps:

  1. Build the Docker Image: Use the provided Dockerfile to create a Docker image for the migration process.
docker build -t cve-migration .
  1. Run the Docker Container: Execute the Docker container with the necessary environment variables. You can use an .env file to manage these variables conveniently.
docker run --env-file .env cve-migration

Make sure your .env file contains all the required environment variables.

Contributing

If you would like to contribute to this project.

License

This project is licensed under the [MIT License].

About

Builds Docker image for running Flyway-based PostgreSQL migrations as an init container in Kubernetes, ensuring proper schema setup and updates for CVE data management.

Topics

Resources

Stars

Watchers

Forks