Pull initdb into a function; have db commands exec instead of run to ensure container is up

This commit is contained in:
Jim Fingal 2020-11-08 11:50:20 -08:00
parent f1816d2ef5
commit 0176f5bbf8

17
fr-dev
View file

@ -9,30 +9,35 @@ function clean {
}
function rundb {
docker-compose run --rm db $@
docker-compose exec db $@
}
function runweb {
docker-compose run --rm web $@
}
function initdb {
runweb python manage.py migrate
runweb python manage.py initdb
}
case "$1" in
up)
docker-compose up --build
;;
run)
docker-compose run --service-ports web
docker-compose run --rm --service-ports web
;;
initdb)
runweb python manage.py migrate
runweb python manage.py initdb
initdb
;;
resetdb)
clean
docker-compose up --build -d
rundb dropdb -U fedireads fedireads
rundb createdb -U fedireads fedireads
runweb python manage.py migrate
runweb python manage.py initdb
initdb
clean
;;
makemigrations)
runweb python manage.py makemigrations