Docker tasks

Update applications

Change to the application’s directory, replacing APP:

cd /data/deploy/APP

Pull new images and start new containers:

docker compose pull
docker compose up -d

Migrate the database, for example:

docker compose run --rm web python manage.py migrate

One-time setup

Create a superuser, if applicable:

docker compose run --rm web python manage.py createsuperuser

Load data

For example:

psql -U pelican_backend -h localhost -c "\copy exchange_rates (valid_on, rates, created, modified) from 'exchange_rates.csv';" pelican_backend

Check that the ID sequence is correct:

SELECT MAX(id) FROM exchange_rates;
SELECT nextval('exchange_rates_id_seq');

The second value should be higher than the first. If not:

SELECT setval('exchange_rates_id_seq', COALESCE((SELECT MAX(id) + 1 FROM exchange_rates), 1), false);