An open API service indexing awesome lists of open source software.

https://github.com/cyse7125-su24-team10/db-cve-processor

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.
https://github.com/cyse7125-su24-team10/db-cve-processor

flyway-migrations initcontainer kubernetes postgresql

Last synced: 3 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

# 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:
```bash
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.
```bash
docker build -t cve-migration .
```

2. **Run the Docker Container**: Execute the Docker container with the necessary environment variables. You can use an `.env` file to manage these variables conveniently.

```bash
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].