# BookWyrm 0.9.3: reading logs and book reviews. Its statuses are Reviews, Comments and Quotations on a book, sent to # other BookWyrms as such and to everyone else as "pure" Notes and Articles. Its image on the shared Postgres (database # bookwyrm) and Redis (databases 14 and 15, activity and broker), gunicorn and one Celery worker (federation runs in # it), as bookwyrm.test; Python trusts the bundle the pasture gives requests. It has no client API: bwuser, a book and # the statuses are made in its Django shell (bookwyrm_shell), as its own views make them. BOOKWYRM_IMAGE=${BOOKWYRM_IMAGE:-ghcr.io/bookwyrm-social/bookwyrm:v0.9.3} BOOKWYRM_PASSWORD=Bookwyrm-Pasture-Pass-1 . "$here/peers/shared.sh" bookwyrm_env() { echo "-e DEBUG=false -e DOMAIN=bookwyrm.test -e EMAIL=admin@bookwyrm.test -e SECRET_KEY=pasture-bookwyrm-not-a-secret-0123456789 \ -e POSTGRES_HOST=postgres -e POSTGRES_USER=pasture -e POSTGRES_PASSWORD=pasture -e POSTGRES_DB=bookwyrm -e PGPORT=5432 \ -e REDIS_ACTIVITY_HOST=redis -e REDIS_ACTIVITY_PORT=6379 -e REDIS_ACTIVITY_DB_INDEX=14 \ -e REDIS_BROKER_HOST=redis -e REDIS_BROKER_PORT=6379 -e REDIS_BROKER_DB_INDEX=15 \ -e EMAIL_HOST=localhost -e EMAIL_PORT=25 -e EMAIL_HOST_USER=pasture -e EMAIL_HOST_PASSWORD=pasture -e EMAIL_USE_TLS=false -e ENABLE_THUMBNAIL_GENERATION=false -e ENABLE_PREVIEW_IMAGES=false \ -e REQUESTS_CA_BUNDLE=/pasture/ca/bundle.pem -e SSL_CERT_FILE=/pasture/ca/bundle.pem -e STATIC_ROOT=static/ -e MEDIA_ROOT=images/" } bookwyrm_up() { shared_postgres_up shared_redis_up pg_db bookwyrm podman run --rm --network $net $(bookwyrm_env) -v "$ca:/pasture/ca:z,ro" $BOOKWYRM_IMAGE python manage.py migrate --noinput >/dev/null 2>&1 podman run --rm --network $net $(bookwyrm_env) -v "$ca:/pasture/ca:z,ro" $BOOKWYRM_IMAGE python manage.py initdb >/dev/null 2>&1 || true podman run -d --replace --name pasture-bookwyrm --label pasture=1 --network $net $(bookwyrm_env) -v "$ca:/pasture/ca:z,ro" \ $BOOKWYRM_IMAGE gunicorn bookwyrm.wsgi:application --bind 0.0.0.0:8000 >/dev/null podman run -d --replace --name pasture-bookwyrm-celery --label pasture=1 --network $net $(bookwyrm_env) -v "$ca:/pasture/ca:z,ro" \ $BOOKWYRM_IMAGE celery -A celerywyrm worker --pool=threads --concurrency=4 -l info \ -Q high_priority,medium_priority,low_priority,streams,images,suggested_users,email,connectors,lists,inbox,imports,import_triggered,broadcast,misc >/dev/null for _ in $(seq 1 60); do site bookwyrm.test -s -o /dev/null -w '%{http_code}' https://bookwyrm.test:6443/nodeinfo/2.0 2>/dev/null | grep -q 200 && break sleep 2 done bookwyrm_shell " from bookwyrm import models if not models.User.objects.filter(localname='bwuser').exists(): # its signup names a local user localname@domain, which WebFinger looks for models.User.objects.create_user('bwuser@bookwyrm.test', 'bwuser@bookwyrm.test', '$BOOKWYRM_PASSWORD', localname='bwuser', local=True) if not models.Edition.objects.filter(title='The Pasture Book').exists(): work = models.Work.objects.create(title='The Pasture Book') models.Edition.objects.create(title='The Pasture Book', parent_work=work) " >/dev/null echo "bookwyrm: https://bookwyrm.test:6443" } # bookwyrm_shell : runs in BookWyrm's Django shell, its output printed bookwyrm_shell() { podman exec pasture-bookwyrm python manage.py shell -v 0 -c "$1" 2>/dev/null; }