This project is still young and isn't, at the moment, very stable, so please proceed with caution when running in production. This method of installation is more involved, and therefore is for more experienced admins. Docker install is recommended This install method assumes you already have ssl configured with certificates available
apt install postgresql redis nginx python3-venv python3-pip python3-dev libpq-dev
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. Not all of these changes effect the dockerless install, however the production
branch is still recommended
Instructions for running BookWyrm in production without Docker:
/opt/bookwyrm
: mkdir /opt/bookwyrm && cd /opt/bookwyrm
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 domainPOSTGRES_PASSWORD
| Set a secure password for the databasePOSTGRES_HOST
| Set to localhost
(the machine running your db)POSTGRES_USER
| Set to bookwyrm
(recommended) or something custom (configured later)POSTGRES_DB
| Set to bookwyrm
REDIS_ACTIVITY_PASSWORD
| Set to nothing (fine on a local machine with a firewall)REDIS_ACTIVITY_HOST
| Set to localhost
(the machine running redis)REDIS_BROKER_PASSWORD
| Set to nothing (fine on a local machine with a firewall)REDIS_BROKER_HOST
| Set to localhost
(the machine running redis)EMAIL_HOST_USER
| The "from" address that your app will use when sending emailEMAIL_HOST_PASSWORD
| The password provided by your email servicecp nginx/server_config /etc/nginx/conf.d/server_config
cp nginx/production /etc/nginx/sites-available/bookwyrm.conf
bookwyrm.conf
:your-domain.com
with your domain name everywhere in the file (including the lines that are currently commented out)/app/
with your install directory /opt/bookwyrm/
everywhere in the file (including commented out)server
blocks enabledssl_certificate
and ssl_certificate_key
paths to your fullchain and privkey locationsserver localhost:8000
. You may choose a different port here if you wishln -s /etc/nginx/sites-available/bookwyrm.conf /etc/nginx/sites-enabled/bookwyrm.conf
systemctl reload nginx
mkdir venv
python3 -m venv ./venv
./venv/bin/pip3 install -r requirements.txt
Make the bookwyrm postgresql database. Make sure to change the password to what you set in the .env
config:
sudo -i -u postgres psql
CREATE USER bookwyrm WITH PASSWORD 'securedbypassword123';
CREATE DATABASE bookwyrm TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE bookwyrm OWNER TO bookwyrm;
GRANT ALL PRIVILEGES ON DATABASE bookwyrm TO bookwyrm;
\q
venv/bin/python3 manage.py migrate
venv/bin/python3 manage.py initdb
venv/bin/python3 manage.py collectstatic --no-input
Create and setup your bookwyrm
user
useradd bookwyrm -r
chown -R bookwyrm:bookwyrm /opt/bookwyrm
sudo -u bookwyrm echo I am the $(whoami) user
Generate the admin code with sudo -u bookwyrm venv/bin/python3 manage.py admin_code
, and copy the admin code to use when you create your admin account.
*******************************************
Use this code to create your admin account:
c6c35779-af3a-4091-b330-c026610920d6
*******************************************
#!/bin/bash
# stop if one process fails
set -e
# bookwyrm
/opt/bookwyrm/venv/bin/gunicorn bookwyrm.wsgi:application --bind 0.0.0.0:8000 &
# celery
/opt/bookwyrm/venv/bin/celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority &
/opt/bookwyrm/venv/bin/celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler &
# /opt/bookwyrm/venv/bin/celery -A celerywyrm flower &
- Replace `/opt/bookwyrm` with your install dir
- Change `8000` to your custom port number
- Flower has been disabled here because it is not autoconfigured with the password set in the `.env` file
sudo -u bookwyrm bash /opt/bookwyrm/dockerless-run.sh
# /etc/systemd/system/bookwyrm.service
[Unit]
Description=Bookwyrm Server
After=network.target
After=systemd-user-sessions.service
After=network-online.target
[Service]
User=bookwyrm
Type=simple
Restart=always
ExecStart=/bin/bash /opt/bookwyrm/dockerless-run.sh
WorkingDirectory=/opt/bookwyrm/
[Install]
WantedBy=multi-user.target
Należy skonfigurować zadanie Cron, aby usługa była uruchamiana po ponownym uruchomieniu serwera.
Congrats! You did it!! Configure your instance however you'd like.
See Get Involved for details.