Docker tasks#

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

Create a superuser:

docker-compose run --rm web python createsuperuser

Migrate the database:

docker-compose run --rm web python migrate


If you are using a postgres image, see its “Arbitrary --user Notes” section.

Remember that volume names are, by default, prefixed by the directory name: for example, spoonbill_postgresql-data.

Load data#

For example:

psql -c 'SET ROLE pelican_backend' -c "\copy exchange_rates (valid_on, rates, created, modified) from '/opt/pelican-backend/exchange_rates.csv' delimiter ',' csv header;" 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);