From 883a3cb1fa9890edf69900234e2071203c8ad40c Mon Sep 17 00:00:00 2001 From: peterrus Date: Wed, 23 Mar 2022 15:49:18 +0100 Subject: [PATCH] Explain how to use the new dynamic config (#50) * Explain how to use the new dynamic config introduced in #25 * fix typo --- README.md | 72 +++++++-------------------------------------- config-override.exs | 4 +++ 2 files changed, 15 insertions(+), 61 deletions(-) create mode 100644 config-override.exs diff --git a/README.md b/README.md index ba501eb..7b96b0b 100644 --- a/README.md +++ b/README.md @@ -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: "" - -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: diff --git a/config-override.exs b/config-override.exs new file mode 100644 index 0000000..54adc31 --- /dev/null +++ b/config-override.exs @@ -0,0 +1,4 @@ +import config + +config :pleroma, :instance, + registrations_open: false