Staging instance, all changes can be removed at any time

Skip to content

Simplify the scheduler's database initialization

Use the new "init-admin" command to initialize the database and fallback to the standard postgresql initialization. The database creation is delegated to the postgresql entrypoint, the extensions and the tables are configured respectively by the init-admin and init commands.

Using this, we can execute the "init-admin" command at each start which can be useful when new super-user migrations are added.

Example of a restart:

swh-scheduler_1                 | Creating extensions...
swh-scheduler_1                 | psql:/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/scheduler/sql/10-superuser-init.sql:1: NOTICE:  extension "uuid-ossp" already exists, skipping
swh-scheduler_1                 | Initializing the database...
swh-scheduler_1                 | DONE database for scheduler exists at version 17
swh-scheduler_1                 | Starting the swh-scheduler API server

Related to swh/infra/sysadm-environment#2736 (closed) Depends on swh-core!311 (closed)

Test Plan

with the diff applied on core + the docker-compose.override.yml well configured to use the core module

docker-compose down -v
docker-compose up swh-scheduler-db
docker-compose down
docker-compose up swh-scheduler

Migrated from D4377 (view on Phabricator)

Merge request reports

Loading