Explain how to use the new dynamic config (#50)

* Explain how to use the new dynamic config introduced in #25

* fix typo
This commit is contained in:
peterrus 2022-03-23 15:49:18 +01:00 committed by GitHub
parent 09fa1e81e3
commit 883a3cb1fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 61 deletions

View file

@ -66,8 +66,10 @@ services:
- ./uploads:/var/lib/pleroma/uploads
- ./static:/var/lib/pleroma/static
- ./config.exs:/etc/pleroma/config.exs:ro
# optional, see 'Config Override' section in README.md
# - ./config-override.exs:/var/lib/pleroma/config.exs:ro
environment:
DOMAIN: exmaple.com
DOMAIN: example.com
INSTANCE_NAME: Pleroma
ADMIN_EMAIL: admin@example.com
NOTIFY_EMAIL: notify@example.com
@ -93,45 +95,7 @@ docker exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS cit
docker-compose down
```
Configure Pleroma. Copy the following to `config/secret.exs`:
```exs
use Mix.Config
config :pleroma, Pleroma.Web.Endpoint,
http: [ ip: {0, 0, 0, 0}, ],
url: [host: "pleroma.domain.tld", scheme: "https", port: 443],
secret_key_base: "<use 'openssl rand -base64 48' to generate a key>"
config :pleroma, :instance,
name: "Pleroma",
email: "admin@email.tld",
limit: 5000,
registrations_open: true
config :pleroma, :media_proxy,
enabled: false,
redirect_on_failure: true,
base_url: "https://cache.domain.tld"
# Configure your database
config :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
username: "pleroma",
password: "pleroma",
database: "pleroma",
hostname: "postgres",
pool_size: 10
```
You need to change at least:
- `host`
- `secret_key_base`
- `email`
Make sure your PostgreSQL parameters are ok.
Optionally configure Pleroma, see [Config Override](#config-override).
You can now build the image. 2 way of doing it:
```sh
@ -142,33 +106,13 @@ docker build -t pleroma .
I prefer the latter because it's more verbose but this will ignore any build-time variables you have set in `docker-compose.yml`.
Setup the database:
```sh
docker-compose run --rm web mix ecto.migrate
```
Get your web push keys and copy them to `secret.exs`:
```
docker-compose run --rm web mix web_push.gen.keypair
```
You will need to build the image again, to pick up your updated `secret.exs` file:
```
docker-compose build
# or
docker build -t pleroma .
```
You can now launch your instance:
```sh
docker-compose up -d
```
Check if everything went well with:
The initial creation of the database schema will be done automatically. Check if everything went well with:
```sh
docker logs -f pleroma_web
@ -209,6 +153,12 @@ docker build -t pleroma . --build-arg PLEROMA_VER=v2.0.7 # a version
This value can also be set through `docker-compose.yml` as seen in the example file provided in this repository.
## Config Override
By default the provided `docker-compose.yml` file mounts `config.exs` in the Pleroma container, this file is a dynamic configuration that sources some values from the environment variables provided to the container (variables like `ADMIN_EMAIL` etc.).
For those that want to change configuration that is not exposed through environment variables there is the option to mount the `config-override.exs` file which can than be modified to your satisfaction. Values set in this file will override anything set in `config.exs`. The override file provided in this repository disables new registrations on your instance, as an example.
=======
## Other Docker images
Here are other Pleroma Docker images that helped me build mine:

4
config-override.exs Normal file
View file

@ -0,0 +1,4 @@
import config
config :pleroma, :instance,
registrations_open: false