forked from mirrors/bookwyrm
Merge pull request #356 from cincodenada/rename-devtools
Rename devtools, make it work with non-default database names
This commit is contained in:
commit
80be079132
3 changed files with 103 additions and 90 deletions
|
@ -1,5 +1,5 @@
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY=7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr
|
SECRET_KEY="7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr"
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG=true
|
DEBUG=true
|
||||||
|
@ -25,7 +25,7 @@ POSTGRES_HOST=db
|
||||||
CELERY_BROKER=redis://redis:6379/0
|
CELERY_BROKER=redis://redis:6379/0
|
||||||
CELERY_RESULT_BACKEND=redis://redis:6379/0
|
CELERY_RESULT_BACKEND=redis://redis:6379/0
|
||||||
|
|
||||||
EMAIL_HOST='smtp.mailgun.org'
|
EMAIL_HOST="smtp.mailgun.org"
|
||||||
EMAIL_PORT=587
|
EMAIL_PORT=587
|
||||||
EMAIL_HOST_USER=mail@your.domain.here
|
EMAIL_HOST_USER=mail@your.domain.here
|
||||||
EMAIL_HOST_PASSWORD=emailpassword123
|
EMAIL_HOST_PASSWORD=emailpassword123
|
||||||
|
|
100
bw-dev
Executable file
100
bw-dev
Executable file
|
@ -0,0 +1,100 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# exit on errors
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# import our ENV variables
|
||||||
|
# catch exits and give a friendly error message
|
||||||
|
function showerr {
|
||||||
|
echo "Failed to load configuration! You may need to update your .env and quote values with special characters in them."
|
||||||
|
}
|
||||||
|
trap showerr EXIT
|
||||||
|
source .env
|
||||||
|
trap - EXIT
|
||||||
|
|
||||||
|
# show commands as they're executed
|
||||||
|
set -x
|
||||||
|
|
||||||
|
function clean {
|
||||||
|
docker-compose stop
|
||||||
|
docker-compose rm -f
|
||||||
|
}
|
||||||
|
|
||||||
|
function runweb {
|
||||||
|
docker-compose run --rm web "$@"
|
||||||
|
clean
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
run)
|
||||||
|
docker-compose run --rm --service-ports web
|
||||||
|
;;
|
||||||
|
initdb)
|
||||||
|
initdb
|
||||||
|
;;
|
||||||
|
resetdb)
|
||||||
|
clean
|
||||||
|
docker-compose up --build -d
|
||||||
|
execdb dropdb -U ${POSTGRES_USER} ${POSTGRES_DB}
|
||||||
|
execdb createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
|
||||||
|
initdb
|
||||||
|
clean
|
||||||
|
;;
|
||||||
|
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 ${POSTGRES_USER} ${POSTGRES_DB}
|
||||||
|
;;
|
||||||
|
restart_celery)
|
||||||
|
docker-compose restart celery_worker
|
||||||
|
;;
|
||||||
|
test)
|
||||||
|
shift 1
|
||||||
|
execweb coverage run --source='.' --omit="*/test*,celerywyrm*,bookwyrm/migrations/*" manage.py test "$@"
|
||||||
|
;;
|
||||||
|
pytest)
|
||||||
|
shift 1
|
||||||
|
execweb pytest "$@"
|
||||||
|
;;
|
||||||
|
test_report)
|
||||||
|
execweb coverage report
|
||||||
|
;;
|
||||||
|
collectstatic)
|
||||||
|
execweb python manage.py collectstatic --no-input
|
||||||
|
;;
|
||||||
|
build)
|
||||||
|
docker-compose build
|
||||||
|
;;
|
||||||
|
clean)
|
||||||
|
clean
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unrecognised command. Try: build, clean, up, initdb, resetdb, makemigrations, migrate, bash, shell, dbshell, restart_celery, test, pytest, test_report"
|
||||||
|
;;
|
||||||
|
esac
|
88
fr-dev
88
fr-dev
|
@ -1,88 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
function clean {
|
|
||||||
docker-compose stop
|
|
||||||
docker-compose rm -f
|
|
||||||
}
|
|
||||||
|
|
||||||
function runweb {
|
|
||||||
docker-compose run --rm web "$@"
|
|
||||||
clean
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
;;
|
|
||||||
run)
|
|
||||||
docker-compose run --rm --service-ports web
|
|
||||||
;;
|
|
||||||
initdb)
|
|
||||||
initdb
|
|
||||||
;;
|
|
||||||
resetdb)
|
|
||||||
clean
|
|
||||||
docker-compose up --build -d
|
|
||||||
execdb dropdb -U fedireads fedireads
|
|
||||||
execdb createdb -U fedireads fedireads
|
|
||||||
initdb
|
|
||||||
clean
|
|
||||||
;;
|
|
||||||
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
|
|
||||||
;;
|
|
||||||
test)
|
|
||||||
shift 1
|
|
||||||
execweb coverage run --source='.' --omit="*/test*,celerywyrm*,bookwyrm/migrations/*" manage.py test "$@"
|
|
||||||
;;
|
|
||||||
pytest)
|
|
||||||
shift 1
|
|
||||||
execweb pytest "$@"
|
|
||||||
;;
|
|
||||||
test_report)
|
|
||||||
execweb coverage report
|
|
||||||
;;
|
|
||||||
collectstatic)
|
|
||||||
execweb python manage.py collectstatic --no-input
|
|
||||||
;;
|
|
||||||
build)
|
|
||||||
docker-compose build
|
|
||||||
;;
|
|
||||||
clean)
|
|
||||||
clean
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognised command. Try: build, clean, up, initdb, resetdb, makemigrations, migrate, bash, shell, dbshell, restart_celery, test, pytest, test_report"
|
|
||||||
;;
|
|
||||||
esac
|
|
1
fr-dev
Symbolic link
1
fr-dev
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
bw-dev
|
Loading…
Reference in a new issue