Skip to content

Commit 4f80066

Browse files
authored
Merge pull request #223 from hughrun/required-envs
Minimum required env values and other fixes
2 parents afc0b67 + 592d50e commit 4f80066

File tree

4 files changed

+64
-8
lines changed

4 files changed

+64
-8
lines changed

content/contributing/install-dev.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ These instructions assume you are developing BookWyrm using Docker. You'll need
1414

1515
1. Get a copy of [the BookWyrm codebase from GitHub](https://github.com/bookwyrm-social/bookwyrm). You can [create a fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of the repository, and then [use `git clone` to download the code](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository) to your computer.
1616
2. Go to the directory which contains the code on your computer, you'll be working from there from here on out.
17-
3. Set up your development environment variables file by copying the example environment file (`.env.example`) into a new file named `.env`. In the command line, you can do this with:
17+
3. Development occurs on the `main` branch, so ensure that is the branch you have checked out: `git checkout main`
18+
4. Set up your development environment variables file by copying the example environment file (`.env.example`) into a new file named `.env`. In the command line, you can do this with:
1819
``` { .sh }
1920
cp .env.example .env
2021
```
@@ -28,11 +29,13 @@ In `.env`:
2829
6. change `NGINX_SETUP` to `reverse_proxy` (this prevents BookWyrm trying to set up https certificates on your development machine)
2930
7. If you need to use a particular port (e.g. if you are tunneling via ngrok), uncomment `PORT` and set it (e.g. `PORT=1333`). If using `localhost` this is optional.
3031

31-
If you try to register your admin account and see a message that `CSRF verification failed`, you should check these settings, as you may have set your domain or port incorrectly.
32+
Check that you have [all the required settings configured](/environment.html#required-environment-settings) before proceeding.
33+
34+
If you try to register your admin account and see a message that `CSRF verification failed` you may have set your domain or port incorrectly.
3235

3336
### Email (optional)
3437

35-
If you want to test sending emails, you will need to [set up appropriate values](/environment.html#email-configuration) in the "Email config" section. You do not need to change anything for [the separate `EMAIL` setting](/environment.html#email).
38+
If you want to test sending emails, you will need to [set up appropriate real values](/environment.html#email-configuration) in the "Email config" section. You do not need to change anything for [the separate `EMAIL` setting](/environment.html#email).
3639

3740
### Build and run
3841

content/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Date: 2021-04-13
66
BookWyrm is a social network for tracking your reading, talking about books, writing reviews, and discovering what to read next. Federation allows BookWyrm users to join small, trusted communities that can connect with one another, and with other ActivityPub services like Mastodon and Pleroma.
77

88
## Features
9-
Since the project is still in its early stages, the features are growing every day, and there is plenty of room for suggestions and ideas. Open an [issue](https://github.com/bookwyrm-social/bookwyrm/issues) to get the conversation going!
9+
The features are growing every month, and there is plenty of room for suggestions and ideas. Open an [issue](https://github.com/bookwyrm-social/bookwyrm/issues) to get the conversation going, or [find a good first issue](https://github.com/bookwyrm-social/bookwyrm/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22) to make your first contribution!
1010

1111
- Posting about books
1212
- Compose reviews, with or without ratings, which are aggregated in the book page
@@ -19,9 +19,10 @@ Since the project is still in its early stages, the features are growing every d
1919
- Track reading activity
2020
- Shelve books on default "to-read," "currently reading," "stopped reading," and "read" shelves
2121
- Create custom shelves
22-
- Store started reading/finished reading dates, as well as progress updates along the way
22+
- Store started/stopped/finished reading dates, as well as progress updates along the way
2323
- Update followers about reading activity (optionally, and with granular privacy controls)
2424
- Create lists of books which can be open to submissions from anyone, curated, or only edited by the creator
25+
- Create groups with other BookWyrm users and collaborate with group-owned lists
2526
- Federation with ActivityPub
2627
- Broadcast and receive user statuses and activity
2728
- Share book data between instances to create a networked database of metadata

content/reference/environment.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,62 @@ Date: 2025-04-28
44
Order: 1
55
---
66

7-
BookWyrm requires certain environment (`ENV`) variables in order to run correctly. These are set from a file named `.env` in the directory you run BookWyrm from. You will find most of these variabled described in the `.env.example` file in the main code repository. You should copy this as the basis of your `.env` file.
7+
BookWyrm servers require certain environment (`ENV`) variables in order to run correctly. These are set from a file named `.env` in the directory you run BookWyrm from. You will find most of these variabled described in the `.env.example` file in the main code repository. You should copy this as the basis of your `.env` file.
88

99
BookWyrm **instance administrators** should carefully check version release notes for any changes or additions to environment variables.
1010

11-
BookWyrm **developers** should prefer to use `site.settings` for configuration rather than `ENV` values if possible.
11+
Wherever possible BookWyrm **developers** should prefer to use `site.settings` when creating new configuration values rather than `ENV` values.
12+
13+
## Required settings
14+
15+
The `env.example` file includes default values for core settings. These are designed to be safe defaults for production, apart from the default passwords. Docker users can run `./bw-dev create_secrets` to create safe and unique secrets for:
16+
17+
* `SECRET_KEY`
18+
* `POSTGRES_PASSWORD`
19+
* `REDIS_ACTIVITY_PASSWORD`
20+
* `REDIS_BROKER_PASSWORD`
21+
* `FLOWER_PASSWORD`
22+
23+
You _must_ assign an appropriate value to all of these settings, in your `.env` file:
24+
25+
* `SECRET_KEY`
26+
* `DOMAIN`
27+
* Flower:
28+
* `FLOWER_USER`
29+
* `FLOWER_PASSWORD`
30+
* `FLOWER_PORT`
31+
* Email (in development these may be blank strings but still need to be set):
32+
* `EMAIL_HOST`
33+
* `EMAIL_PORT`
34+
* `EMAIL_HOST_USER`
35+
* `EMAIL_HOST_PASSWORD`
36+
* `EMAIL_USE_TLS`
37+
* `EMAIL_USE_SSL`
38+
* `EMAIL_SENDER_NAME`
39+
* Postgres:
40+
* `POSTGRES_USER`
41+
* `POSTGRES_DB`
42+
* `POSTGRES_HOST`
43+
* `POSTGRES_PASSWORD`
44+
* Redis:
45+
* `REDIS_BROKER_HOST`
46+
* `REDIS_BROKER_PORT`
47+
* `REDIS_ACTIVITY_HOST`
48+
* `REDIS_ACTIVITY_PORT`
49+
* `REDIS_ACTIVITY_PASSWORD`
50+
* `REDIS_BROKER_PASSWORD`
51+
52+
When running BookWyrm in **development**:
53+
54+
* `NGINX_SETUP` **must** be set to `reverse_proxy`
55+
* `DEBUG` _should_ be set to `true`
56+
* `DOMAIN` may be `localhost`
57+
58+
When running BookWyrm in **production**:
59+
60+
* `DEBUG` **must** be set to `false`
61+
* `DOMAIN` **must not** be `localhost`
62+
* Email settings **must** be real and use a bulk email provider such as mailgun
1263

1364
## Django settings
1465

content/running_bookwyrm/install-prod.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ Instructions for running BookWyrm in production:
3030
- `FLOWER_USER` | Your own username for accessing Flower queue monitor
3131
- `EMAIL_HOST_USER` | The "from" address that your app will use when sending email
3232
- `EMAIL_HOST_PASSWORD` | The password provided by your email service
33-
- Initialize secrets by running `bw-dev create_secrets` or manually update following in `.env`:
33+
- Initialize secrets by running `./bw-dev create_secrets` or manually update following in `.env`:
3434
- `SECRET_KEY` | A difficult to guess, secret string of characters
3535
- `POSTGRES_PASSWORD` | Set a secure password for the database
3636
- `REDIS_ACTIVITY_PASSWORD` | Set a secure password for Redis Activity subsystem
3737
- `REDIS_BROKER_PASSWORD` | Set a secure password for Redis queue broker subsystem
3838
- `FLOWER_PASSWORD` | Your own secure password for accessing Flower queue monitor
3939
- If you are running another web-server on your host machine, you will need to follow the [reverse-proxy instructions](/reverse-proxy.html)
40+
- Check that you have [all the required settings configured](/environment.html#required-environment-settings) before proceeding further
4041
- Setup ssl certificate via letsencrypt by running `./bw-dev init_ssl`
4142
- Initialize the database by running `./bw-dev migrate`
4243
- Run the application with

0 commit comments

Comments
 (0)