diff --git a/.env.example b/.env.example index e0e98c10..7a67045c 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ # 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! DEBUG=true @@ -25,7 +25,7 @@ POSTGRES_HOST=db CELERY_BROKER=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_HOST_USER=mail@your.domain.here EMAIL_HOST_PASSWORD=emailpassword123 diff --git a/bw-dev b/bw-dev new file mode 100755 index 00000000..22ca9412 --- /dev/null +++ b/bw-dev @@ -0,0 +1,101 @@ +#!/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 rename_app fedireads bookwyrm + 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 diff --git a/fr-dev b/fr-dev deleted file mode 100755 index 415c84ad..00000000 --- a/fr-dev +++ /dev/null @@ -1,89 +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 rename_app fedireads bookwyrm - 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 diff --git a/fr-dev b/fr-dev new file mode 120000 index 00000000..9947871e --- /dev/null +++ b/fr-dev @@ -0,0 +1 @@ +bw-dev \ No newline at end of file