bookwyrm/fr-dev
2020-11-08 20:17:52 -08:00

59 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
set -e
set -x
function execdb {
docker-compose exec db $@
}
function execweb {
docker-compose exec web "$@"
}
function initdb {
execweb python manage.py migrate
execweb python manage.py initdb
}
case "$1" in
up)
docker-compose up --build
;;
initdb)
initdb
;;
makemigrations)
execweb python manage.py makemigrations
;;
migrate)
execweb python manage.py migrate
;;
bash)
execweb bash
;;
shell)
execweb python manage.py shell
;;
dbshell)
execdb psql -U fedireads fedireads
;;
restart_celery)
docker-compose restart celery_worker
;;
collectstatic)
execweb python manage.py collectstatic --no-input
;;
build)
docker-compose build
;;
update)
git pull
docker-compose exec web python manage.py migrate
docker-compose exec web python manage.py collectstatic --no-input
docker-compose restart
;;
*)
echo "Unrecognised command. Try: build, up, initdb, makemigrations, migrate, bash, shell, dbshell, restart_celery, update"
;;
esac