This will configure this project to properly manage the database, taking over from ubuntu.com:
Add alembic.ini so the alembic tool can manage the database
Run alembic upgrade head in ./entrypoint to ensure the DB is provisioned to the latest state every time
This will match the state of the database with the migration scripts in webapp/alembic/versions, which should be the exact same set of migrations as are in ubuntu.com, hence it shouldn't conflict with the database that ubuntu.com manages
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).
This will configure this project to properly manage the database, taking over from ubuntu.com:
alembic
tool can manage the databasealembic upgrade head
in./entrypoint
to ensure the DB is provisioned to the latest state every timewebapp/alembic/versions
, which should be the exact same set of migrations as are in ubuntu.com, hence it shouldn't conflict with the database that ubuntu.com managesQA
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 onlocalhost:5432
, as per theDATABASE_URL
in.env
), which should succeed without any problems:2. Check the database can be provisioned and populated from scratch
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.