This project is still young and isn't, at the moment, very stable, so please proceed with caution when running in production.
There are several repos in the BookWyrm org, including documentation, a static landing page, and the actual Bookwyrm code. To run BookWyrm, you want the actual app code which is in bookwyrm-social/bookwyrm.
The production
branch of BookWyrm contains a number of tools not on the main
branch that are suited for running in production, such as docker-compose
changes to update the default commands or configuration of containers, and individual changes to container config to enable things like SSL or regular backups.
Instructions for running BookWyrm in production:
git clone git@github.com:bookwyrm-social/bookwyrm.git
production
branch:
git checkout production
cp .env.example .env
, and update the following:SECRET_KEY
| A difficult to guess, secret string of charactersDOMAIN
| Your web domainEMAIL
| Email address to be used for certbot domain verificationPOSTGRES_PASSWORD
| Set a secure password for the databaseREDIS_ACTIVITY_PASSWORD
| Set a secure password for Redis Activity subsystemREDIS_BROKER_PASSWORD
| Set a secure password for Redis queue broker subsystemFLOWER_USER
| Your own username for accessing Flower queue monitorFLOWER_PASSWORD
| Your own secure password for accessing Flower queue monitorEMAIL_HOST_USER
| The "from" address that your app will use when sending emailEMAIL_HOST_PASSWORD
| The password provided by your email servicecp nginx/production nginx/default.conf
nginx/default.conf
:your-domain.com
with your domain name everywhere in the file (including the lines that are currently commented out)www
subdomain, remove the www.your-domain.com version of the domain from the server_name
in the first server block in nginx/default.conf
and remove the -d www.${DOMAIN}
flag at the end of the certbot
command in docker-compose.yml
../bw-dev migrate
docker-compose up --build
, and make sure all the images build successfullyCTRL-C
docker-compose.yml
, comment out the active certbot command, which installs the certificate, and uncomment the line below, which sets up automatically renewals.nginx/default.conf
, uncomment lines 18 through 111 to enable forwarding to HTTPS. You should have two server
blocks enabledcron
job to keep your certificates up to date (Lets Encrypt certificates expire after 90 days)crontab -e
to edit your cron file in the host machine5 0 * * * cd /path/to/your/bookwyrm && docker-compose run --rm certbot
./bw-dev setup
, and copy the admin code to use when you create your admin account../bw-dev setup
should conclude with your admin code. You can get your code at any time by running ./bw-dev admin_code
from the command line. Here's an example output:*******************************************
Use this code to create your admin account:
c6c35779-af3a-4091-b330-c026610920d6
*******************************************
docker-compose up -d
Congrats! You did it!! Configure your instance however you'd like.
BookWyrm's db service dumps a backup copy of its database to its /backups
directory daily at midnight UTC.
Backups are named backup__%Y-%m-%d.sql
.
The db service has an optional script for periodically pruning the backups directory so that all recent daily backups are kept, but for older backups, only weekly or monthly backups are kept. To enable this script:
postgres-docker/cronfile
docker-compose up --build
You can copy backups from the backups volume to your host machine with docker cp
:
docker-compose ps
to confirm the db service's full name (it's probably bookwyrm_db_1
.docker cp <container_name>:/backups <host machine path>
BookWyrm has multiple services that run on their default ports. This means that, depending on what else you are running on your host machine, you may run into errors when building or running BookWyrm when attempts to bind to those ports fail.
If this occurs, you will need to change your configuration to run services on different ports. This may require one or more changes the following files:
docker-compose.yml
nginx/default.conf
.env
(You create this file yourself during setup)If you are already running a web-server on your machine, you will need to set up a reverse-proxy.
Because BookWyrm is a young project, we're still working towards a stable release schedule, and there are a lot of bugs and breaking changes. There is a GitHub team which can be tagged when there's something important to know about an update, which you can join by sharing your GitHub username. There are a few ways in get in touch: