Docker tasks#
Note
The commands assume Compose V2, which uses docker compose
. For Compose V1, use docker-compose
(with hyphen).
Initialize 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
Create a superuser, if applicable:
docker compose run --rm web python manage.py createsuperuser
Migrate the database:
docker compose run --rm web python manage.py migrate
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);