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

This commit is contained in:
peterrus
2022-03-17 09:27:37 +01:00
parent 78e6ac4142
commit 3884400d50
2 changed files with 13 additions and 60 deletions

View File

@@ -59,6 +59,8 @@ 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
INSTANCE_NAME: Pleroma
@@ -86,45 +88,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
@@ -135,33 +99,13 @@ docker build -t pleroma .
I prefer the latter because it's more verbose.
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
@@ -200,6 +144,11 @@ docker build -t pleroma . --build-arg PLEROMA_VER=v2.0.7 # a version
`a9203ab3` being the hash of the commit. (They're [here](https://git.pleroma.social/pleroma/pleroma/commits/develop))
## 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