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.
- Host: GitHub
- URL: https://github.com/cyse7125-su24-team10/db-cve-processor
- Owner: cyse7125-su24-team10
- Created: 2024-06-13T15:58:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-11T18:57:39.000Z (10 months ago)
- Last Synced: 2025-01-30T21:35:29.366Z (5 months ago)
- Topics: flyway-migrations, initcontainer, kubernetes, postgresql
- Language: Dockerfile
- Homepage:
- Size: 290 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
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].