From c9f7ab638918026aa1c51c4c9f0ec52553f76492 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 21 Mar 2021 14:23:05 -0700 Subject: [PATCH 1/3] Adds documentation on how to update an instance --- README.md | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 10f77c04..e6a75375 100644 --- a/README.md +++ b/README.md @@ -213,17 +213,6 @@ Congrats! You did it, go to your domain and enjoy the fruits of your labors. ``` - Go to the site settings (`/settings/site-settings` on your domain) and configure your instance name, description, code of conduct, and toggle whether registration is open on your instance - -## Book data -The application is set up to share book and author data between instances, and get book data from arbitrary outside sources. Right now, the only connector is to OpenLibrary, but other connectors could be written. - -There are three concepts in the book data model: -- `Book`, an abstract, high-level concept that could mean either a `Work` or an `Edition`. No data is saved as a `Book`, it serves as shared model for `Work` and `Edition` -- `Work`, the theoretical umbrella concept of a book that encompasses every edition of the book, and -- `Edition`, a concrete, actually published version of a book - -Whenever a user interacts with a book, they are interacting with a specific edition. Every work has a default edition, but the user can select other editions. Reviews aggregated for all editions of a work when you view an edition's page. - ### Backups BookWyrm's db service dumps a backup copy of its database to its `/backups` directory daily at midnight UTC. @@ -238,6 +227,15 @@ You can copy backups from the backups volume to your host machine with `docker c - Run `docker-compose ps` to confirm the db service's full name (it's probably `bookwyrm_db_1`. - Run `docker cp :/backups ` +### Updating your instance + +When there are changes available in the production branch, you can install and get them running on your instance using the command `./bw-dev update`. This does a number of things: +- `git pull` gets the updated code from the git repository. If there are conflicts, you may need to run `git pull` separately and resolve the conflicts before trying the `./bw-dev update` script again. +- `docker-compose build` rebuilds the images, which ensures that the correct packages are installed. This step takes a long time and is only needed when the dependencies (including pip `requirements.txt` packages) have changed, so you can comment it out if you want a quicker update path and don't mind un-commenting it as needed. +- `docker-compose exec web python manage.py migrate` runs the database migrations in Django +- `docker-compose exec web python manage.py collectstatic --no-input` loads any updated static files (such as the JavaScript and CSS) +- `docker-compose restart` reloads the docker containers + ### Port Conflicts BookWyrm has multiple services that run on their default ports. @@ -317,3 +315,14 @@ To set up your server: - restart nginx If everything worked correctly, your BookWyrm instance should now be externally accessible. + + +## Book data +The application is set up to share book and author data between instances, and get book data from arbitrary outside sources. Right now, the only connector is to OpenLibrary, but other connectors could be written. + +There are three concepts in the book data model: +- `Book`, an abstract, high-level concept that could mean either a `Work` or an `Edition`. No data is saved as a `Book`, it serves as shared model for `Work` and `Edition` +- `Work`, the theoretical umbrella concept of a book that encompasses every edition of the book, and +- `Edition`, a concrete, actually published version of a book + +Whenever a user interacts with a book, they are interacting with a specific edition. Every work has a default edition, but the user can select other editions. Reviews aggregated for all editions of a work when you view an edition's page. From 97697ce5d5cdf8c98352312c22bf25f949c0f160 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 21 Mar 2021 14:23:26 -0700 Subject: [PATCH 2/3] Adds build step to `update` command --- bw-dev | 1 + 1 file changed, 1 insertion(+) diff --git a/bw-dev b/bw-dev index 5b36ce73..f9e9dda5 100755 --- a/bw-dev +++ b/bw-dev @@ -75,6 +75,7 @@ case "$CMD" in ;; update) git pull + docker-compose build docker-compose exec web python manage.py migrate docker-compose exec web python manage.py collectstatic --no-input docker-compose restart From eca1a872945aeda998d186bba6d6d8941d4da7ce Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 21 Mar 2021 14:23:36 -0700 Subject: [PATCH 3/3] Remove development requirements for prod installs --- requirements.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index d9a8b529..c655416d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,10 +13,3 @@ redis==3.4.1 requests==2.22.0 responses==0.10.14 django-rename-app==0.1.2 - -# Dev -black==20.8b1 -coverage==5.1 -pytest-django==4.1.0 -pytest==6.1.2 -pytest-cov==2.10.1