diff --git a/docs/docs/configuration/howto_database_config.md b/docs/docs/configuration/howto_database_config.md index 3cab9d2d9..0e0e18a77 100644 --- a/docs/docs/configuration/howto_database_config.md +++ b/docs/docs/configuration/howto_database_config.md @@ -7,73 +7,73 @@ The configuration of Akkoma (and Pleroma) has traditionally been managed with a 1. Run the mix task to migrate to the database. - **Source:** + **Source:** - ``` - $ mix pleroma.config migrate_to_db - ``` + ``` + $ mix pleroma.config migrate_to_db + ``` - or + or - **OTP:** + **OTP:** - *Note: OTP users need Akkoma to be running for `pleroma_ctl` commands to work* + *Note: OTP users need Akkoma to be running for `pleroma_ctl` commands to work* - ``` - $ ./bin/pleroma_ctl config migrate_to_db - ``` + ``` + $ ./bin/pleroma_ctl config migrate_to_db + ``` - ``` - Migrating settings from file: /home/pleroma/config/dev.secret.exs + ``` + Migrating settings from file: /home/pleroma/config/dev.secret.exs - Settings for key instance migrated. - Settings for group :pleroma migrated. - ``` + Settings for key instance migrated. + Settings for group :pleroma migrated. + ``` 2. It is recommended to backup your config file now. - ``` - cp config/dev.secret.exs config/dev.secret.exs.orig - ``` + ``` + cp config/dev.secret.exs config/dev.secret.exs.orig + ``` 3. Edit your Akkoma config to enable database configuration: - ``` - config :pleroma, configurable_from_database: true - ``` + ``` + config :pleroma, configurable_from_database: true + ``` -!!! note - This step is not required +4. !!! note + This step is not required - Now you can edit your config file and strip it down to the only settings which are not possible to control in the database. e.g., the PostgreSQL (Repo) and webserver (Endpoint) settings cannot be controlled in the database because the application needs the settings to start up and access the database. + Now you can edit your config file and strip it down to the only settings which are not possible to control in the database. e.g., the PostgreSQL (Repo) and webserver (Endpoint) settings cannot be controlled in the database because the application needs the settings to start up and access the database. - Any settings in the database will override those in the config file, but you may find it less confusing if the setting is only declared in one place. + Any settings in the database will override those in the config file, but you may find it less confusing if the setting is only declared in one place. - A non-exhaustive list of settings that are only possible in the config file include the following: + A non-exhaustive list of settings that are only possible in the config file include the following: - * config :pleroma, Pleroma.Web.Endpoint - * config :pleroma, Pleroma.Repo - * config :pleroma, configurable\_from\_database - * config :pleroma, :database, rum_enabled - * config :pleroma, :connections_pool + * config :pleroma, Pleroma.Web.Endpoint + * config :pleroma, Pleroma.Repo + * config :pleroma, configurable\_from\_database + * config :pleroma, :database, rum_enabled + * config :pleroma, :connections_pool - Here is an example of a server config stripped down after migration: + Here is an example of a server config stripped down after migration: - ``` - use Mix.Config + ``` + use Mix.Config - config :pleroma, Pleroma.Web.Endpoint, - url: [host: "cool.pleroma.site", scheme: "https", port: 443] + config :pleroma, Pleroma.Web.Endpoint, + url: [host: "cool.pleroma.site", scheme: "https", port: 443] - config :pleroma, Pleroma.Repo, - adapter: Ecto.Adapters.Postgres, - username: "akkoma", - password: "MySecretPassword", - database: "akkoma_prod", - hostname: "localhost" + config :pleroma, Pleroma.Repo, + adapter: Ecto.Adapters.Postgres, + username: "akkoma", + password: "MySecretPassword", + database: "akkoma_prod", + hostname: "localhost" - config :pleroma, configurable_from_database: true - ``` + config :pleroma, configurable_from_database: true + ``` 5. Restart your instance, and you can now access the Settings tab in admin-fe. @@ -81,28 +81,28 @@ The configuration of Akkoma (and Pleroma) has traditionally been managed with a 1. Run the mix task to migrate back from the database. You'll receive some debugging output and a few messages informing you of what happened. - **Source:** + **Source:** - ``` - $ mix pleroma.config migrate_from_db - ``` + ``` + $ mix pleroma.config migrate_from_db + ``` - or + or - **OTP:** + **OTP:** - ``` - $ ./bin/pleroma_ctl config migrate_from_db - ``` + ``` + $ ./bin/pleroma_ctl config migrate_from_db + ``` - ``` - 10:26:30.593 [debug] QUERY OK source="config" db=9.8ms decode=1.2ms queue=26.0ms idle=0.0ms - SELECT c0."id", c0."key", c0."group", c0."value", c0."inserted_at", c0."updated_at" FROM "config" AS c0 [] + ``` + 10:26:30.593 [debug] QUERY OK source="config" db=9.8ms decode=1.2ms queue=26.0ms idle=0.0ms + SELECT c0."id", c0."key", c0."group", c0."value", c0."inserted_at", c0."updated_at" FROM "config" AS c0 [] - 10:26:30.659 [debug] QUERY OK source="config" db=1.1ms idle=80.7ms - SELECT c0."id", c0."key", c0."group", c0."value", c0."inserted_at", c0."updated_at" FROM "config" AS c0 [] - Database configuration settings have been saved to config/dev.exported_from_db.secret.exs - ``` + 10:26:30.659 [debug] QUERY OK source="config" db=1.1ms idle=80.7ms + SELECT c0."id", c0."key", c0."group", c0."value", c0."inserted_at", c0."updated_at" FROM "config" AS c0 [] + Database configuration settings have been saved to config/dev.exported_from_db.secret.exs + ``` 2. Remove `config :pleroma, configurable_from_database: true` from your config. The in-database configuration still exists, but it will not be used. Future migrations will erase the database config before importing your config file again.