canonical / ubuntu-com-security-api

The API for CVEs and USNs data.
17 stars 9 forks source link

Set up DB management #76

Closed nottrobin closed 2 years ago

nottrobin commented 2 years ago

This will configure this project to properly manage the database, taking over from ubuntu.com:

QA

1. Check provisioning can take over an existing database

First, run the ubuntu.com project with dotrun, or otherwise get its database running and provisioned.

Now, inside the folder for this branch, run dotrun install && dotrun exec alembic upgrade head. This should attempt to provision the existing ubuntu.com database (running on localhost:5432, as per the DATABASE_URL in .env), which should succeed without any problems:

$ dotrun exec alembic upgrade head

[ $ alembic upgrade head ] ( virtualenv `.venv` )

$

2. Check the database can be provisioned and populated from scratch

dotrun clean
dotrun

This should successfully start the site.

Now generate the dummy data: In a new terminal window, run dotrun exec scripts/generate-sample-security-data.py (as it says in the README.md).

Once this is finished, go to http://localhost:8030/security/cves.json or http://localhost:8030/security/notices.json and see all the awesome data.