Skip to content

Commit 2f4c71c

Browse files
authored
Merge pull request #245 from ilkka-ollakka/tweak/update_dockerless_nginx
update dockerless installation nginx steps
2 parents 4e1404e + 9395db0 commit 2f4c71c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

content/running_bookwyrm/install-prod-dockerless.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This install method assumes you already have ssl configured with certificates av
1414
- Get a domain name and set up DNS for your server. You'll need to point the nameservers of your domain on your DNS provider to the server where you'll be hosting BookWyrm. Here are instructions for [DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars)
1515
- Set your server up with appropriate firewalls for running a web application (this instruction set is tested against Ubuntu 20.04). Here are instructions for [DigitalOcean](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04)
1616
- Set up an email service (such as [Mailgun](https://documentation.mailgun.com/en/latest/quickstart.html)) and the appropriate SMTP/DNS settings. Use the service's documentation for configuring your DNS
17-
- Install dependencies. On debian this could look like `apt install postgresql redis nginx python3-venv python3-pip python3-dev libpq-dev gunicorn`
17+
- Install dependencies. On debian this could look like `apt install postgresql redis nginx python3-venv python3-pip python3-dev libpq-dev gunicorn gettext-base`
1818

1919
## Install and configure BookWyrm
2020

@@ -26,7 +26,7 @@ Instructions for running BookWyrm in production without Docker:
2626
`mkdir /opt/bookwyrm && cd /opt/bookwyrm`
2727
- Get the application code, note that this only clones the `production` branch:
2828
`git clone https://github.com/bookwyrm-social/bookwyrm.git --branch production --single-branch ./`
29-
- Create your environment variables file, `cp .env.example .env`, and update the following. Passwords should generally be enclosed in "quotation marks":
29+
- Create your environment variables file, `cp .env.example .env`, and update the following. Passwords should generally be enclosed in "quotation marks". You can use `bw-dev create_secrets` to generate passwords in `.env`-file:
3030
- `SECRET_KEY` | A difficult to guess, secret string of characters.
3131
- `DOMAIN` | Your web domain
3232
- `POSTGRES_PASSWORD` | Set a secure password for the database
@@ -45,17 +45,19 @@ mkdir /var/cache/nginx
4545
chown www-data:www-data /var/cache/nginx
4646
```
4747
- Configure nginx
48-
- Copy the server_config to nginx's conf.d: `cp nginx/server_config /etc/nginx/conf.d/server_config`
49-
- Make a copy of the production template config and set it for use in nginx: `cp nginx/production /etc/nginx/sites-available/bookwyrm.conf`
50-
- Update nginx `bookwyrm.conf`:
51-
- Replace `your-domain.com` with your domain name everywhere in the file (including the lines that are currently commented out)
48+
- Copy the server_config to nginx's conf.d: `cp nginx/locations /etc/nginx/conf.d/locations`
49+
- Update nginx `/etc/nginx/conf.d/locations`:
5250
- Replace `/app` with your install directory `/opt/bookwyrm` everywhere in the file (including commented out)
53-
- Uncomment [lines 23 to 111](https://github.com/bookwyrm-social/bookwyrm/blob/production/nginx/production#L23-L111) to enable
54-
forwarding to HTTPS. You should have two `server` blocks enabled
55-
- Change the `ssl_certificate` and `ssl_certificate_key` paths to your fullchain and privkey locations
56-
- Change [line 4](https://github.com/chdorner/secretbearlibrary/blob/main/bookwyrm/bookwyrm-nginx.conf#L4) so that it says
57-
`server localhost:8000`. You may choose a different port here if you wish
58-
- If you are running another web-server on your host machine, you will need to follow the [reverse-proxy instructions](/reverse-proxy.html)
51+
- Make a copy of the production template config and set it for use in nginx:
52+
- Set env-variables for DOMAIN and MAX_UPLOAD_MiB so envsubst can populate nginx templates. For example `export DOMAIN=your-web-domain MAX_UPLOAD_MiB=100`
53+
- `envsubst '$DOMAIN,$MAX_UPLOAD_MiB' < nginx/server_config > /etc/nginx/conf.d/server_config`
54+
- `envsubst '$DOMAIN,$MAX_UPLOAD_MiB' < nginx/server_name > /etc/nginx/conf.d/server_name`
55+
- `envsubst '$DOMAIN,$MAX_UPLOAD_MiB' < nginx/https.conf > /etc/nginx/sites-available/bookwyrm.conf`
56+
- If you are running another web-server on your host machine, you should use following command to use nginx as reverse-proxy:
57+
`envsubst '$DOMAIN,$MAX_UPLOAD_MiB' < nginx/reverse_proxy.conf > /etc/nginx/sites-available/bookwyrm.conf`
58+
- Update nginx `/etc/nginx/sites-available/bookwyrm.conf`:
59+
- Change the `ssl_certificate` and `ssl_certificate_key` paths to your fullchain and privkey locations if you are not using nginx as reverse-proxy
60+
- Change upstream addresses in lines 4 and 7 to `server localhost:8000` and `server localhost:8888`. You may choose a different port here if you wish
5961
- Enable the nginx config:
6062
`ln -s /etc/nginx/sites-available/bookwyrm.conf /etc/nginx/sites-enabled/bookwyrm.conf`
6163
- Reload nginx: `systemctl reload nginx`

0 commit comments

Comments
 (0)