From 2753285b7722fdb47f0ebb2180e997cf72f65d1a Mon Sep 17 00:00:00 2001 From: Alex S Date: Sun, 29 Sep 2019 11:17:38 +0300 Subject: config editing through database --- docs/API/admin_api.md | 120 +++++++++++++++++++++++++++++++++++--------------- docs/admin/config.md | 59 +++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 35 deletions(-) create mode 100644 docs/admin/config.md (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index d98a78af0..851c526d6 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -669,7 +669,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret ### Run mix task pleroma.config migrate_to_db -Copy settings on key `:pleroma` to DB. +Copies `pleroma` environment settings to the database. - Params: none - Response: @@ -682,7 +682,7 @@ Copy settings on key `:pleroma` to DB. ### Run mix task pleroma.config migrate_from_db -Copy all settings from DB to `config/prod.exported_from_db.secret.exs` with deletion from DB. +Copies all settings from database to `config/{env}.exported_from_db.secret.exs` with deletion from the table. Where `{env}` is the environment in which `pleroma` is running. - Params: none - Response: @@ -693,9 +693,9 @@ Copy all settings from DB to `config/prod.exported_from_db.secret.exs` with dele ## `GET /api/pleroma/admin/config` -### List config settings +### Get saved config settings -List config settings only works with `:pleroma => :instance => :dynamic_configuration` setting to `true`. +**Only works when `:dynamic_configuration` is `true`.** - Params: none - Response: @@ -704,9 +704,9 @@ List config settings only works with `:pleroma => :instance => :dynamic_configur { configs: [ { - "group": string, - "key": string or string with leading `:` for atoms, - "value": string or {} or [] or {"tuple": []} + "group": ":pleroma", + "key": "Pleroma.Upload", + "value": [] } ] } @@ -716,44 +716,61 @@ List config settings only works with `:pleroma => :instance => :dynamic_configur ### Update config settings -Updating config settings only works with `:pleroma => :instance => :dynamic_configuration` setting to `true`. -Module name can be passed as string, which starts with `Pleroma`, e.g. `"Pleroma.Upload"`. -Atom keys and values can be passed with `:` in the beginning, e.g. `":upload"`. -Tuples can be passed as `{"tuple": ["first_val", Pleroma.Module, []]}`. -`{"tuple": ["some_string", "Pleroma.Some.Module", []]}` will be converted to `{"some_string", Pleroma.Some.Module, []}`. -Keywords can be passed as lists with 2 child tuples, e.g. -`[{"tuple": ["first_val", Pleroma.Module]}, {"tuple": ["second_val", true]}]`. +**Only works when `:dynamic_configuration` is `true`.** + +Some modifications are necessary to save the config settings correctly: -If value contains list of settings `[subkey: val1, subkey2: val2, subkey3: val3]`, it's possible to remove only subkeys instead of all settings passing `subkeys` parameter. E.g.: -{"group": "pleroma", "key": "some_key", "delete": "true", "subkeys": [":subkey", ":subkey3"]}. +- strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules; +``` +"Pleroma.Upload" -> Pleroma.Upload +"Oban" -> Oban +``` +- strings starting with `:` will be converted to atoms; +``` +":pleroma" -> :pleroma +``` +- objects with `tuple` key and array value will be converted to atoms; +``` +{"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []} +``` +- arrays with *tuple objects* and 2 childs in array will be converted to keywords; +``` +[{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"] +``` -Compile time settings (need instance reboot): -- all settings by this keys: +Most of the settings will be applied in `runtime`, this means that you don't need to restart the instance. But some settings are applied in `compile time` and require a reboot of the instance, such as: +- all settings inside these keys: - `:hackney_pools` - `:chat` - `Pleroma.Web.Endpoint` - - `Pleroma.Repo` -- part settings: - - `Pleroma.Captcha` -> `:seconds_valid` - - `Pleroma.Upload` -> `:proxy_remote` - - `:instance` -> `:upload_limit` +- partially settings inside these keys: + - `:seconds_valid` in `Pleroma.Captcha` + - `:proxy_remote` in `Pleroma.Upload` + - `:upload_limit` in `:instance` - Params: - - `configs` => [ - - `group` (string) - - `key` (string or string with leading `:` for atoms) - - `value` (string, [], {} or {"tuple": []}) - - `delete` = true (optional, if parameter must be deleted) - - `subkeys` [(string with leading `:` for atoms)] (optional, works only if `delete=true` parameter is passed, otherwise will be ignored) - ] + - `configs` - array of config objects + - config object params: + - `group` - string (**required**) + - `key` - string (**required**) + - `value` - string, [], {} or {"tuple": []} (**required**) + - `delete` - true (*optional*, if setting must be deleted) + - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored) + +*When a value have several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.* +``` +[subkey: val1, subkey2: val2, subkey3: val3] \\ initial value +{"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion +[subkey2: val2] \\ value after deletion +``` -- Request (example): +- Request: ```json { configs: [ { - "group": "pleroma", + "group": ":pleroma", "key": "Pleroma.Upload", "value": [ {"tuple": [":uploader", "Pleroma.Uploaders.Local"]}, @@ -784,14 +801,47 @@ Compile time settings (need instance reboot): { configs: [ { - "group": string, - "key": string or string with leading `:` for atoms, - "value": string or {} or [] or {"tuple": []} + "group": ":pleroma", + "key": "Pleroma.Upload", + "value": [...] } ] } ``` +## ` GET /api/pleroma/admin/config/descriptions` + +### Get JSON with config descriptions. +Loads json generated from `config/descriptions.exs`. + +- Params: none +- Response: + +```json +[{ + "group": ":pleroma", // string + "key": "ModuleName", // string + "type": "group", // string or list with possible values, + "description": "Upload general settings", // string + "children": [ + { + "key": ":uploader", // string or module name `Pleroma.Upload` + "type": "module", + "description": "Module which will be used for uploads", + "suggestions": ["module1", "module2"] + }, + { + "key": ":filters", + "type": ["list", "module"], + "description": "List of filter modules for uploads", + "suggestions": [ + "module1", "module2", "module3" + ] + } + ] +}] +``` + ## `GET /api/pleroma/admin/moderation_log` ### Get moderation log diff --git a/docs/admin/config.md b/docs/admin/config.md new file mode 100644 index 000000000..f42ec8975 --- /dev/null +++ b/docs/admin/config.md @@ -0,0 +1,59 @@ +# Configuring instance +You can configure your instance from admin interface. You need account with admin rights and little change in config file, which will allow settings dynamic configuration from database. + +```elixir +config :pleroma, :instance, + dynamic_configuration: true +``` + +## How it works +Settings are stored in database and are applied in `runtime` after each change. Most of the settings take effect immediately, except some, which need instance reboot. These settings are needed in `compile time`, that's why settings are duplicated to the file. + +File with duplicated settings is located in `config/{env}.exported_from_db.exs`. For prod env it will be `config/prod.exported_from_db.exs`. + +## How to set it up +You need to migrate your existing settings to the database. You can do this with mix task (all config files will remain untouched): +```bash +mix pleroma.config migrate_to_db +``` +Now you can change settings in admin interface. After each save, settings are duplicated to the `config/{env}.exported_from_db.exs` file. + +**ATTENTION** + +**Be careful while changing the settings. Every inaccurate configuration change can break the federation or the instance load.** + +*Compile time settings, which require instance reboot and can break instance loading:* +- all settings inside these keys: + - `:hackney_pools` + - `:chat` + - `Pleroma.Web.Endpoint` +- partially settings inside these keys: + - `:seconds_valid` in `Pleroma.Captcha` + - `:proxy_remote` in `Pleroma.Upload` + - `:upload_limit` in `:instance` + +## How to remove it + +1. Truncate or delete all values from `config` table +```sql +TRUNCATE TABLE config; +``` +2. Delete `config/{env}.exported_from_db.exs`. + +For `prod` env: +```bash +cd /opt/pleroma +cp config/prod.exported_from_db.exs config/exported_from_db.back +rm -rf config/prod.exported_from_db.exs +``` +*If you don't want to backup settings, you can skip step with `cp` command.* + +3. Set dynamic configuration to `false`. +```elixir +config :pleroma, :instance, + dynamic_configuration: false +``` +4. Restart pleroma instance +```bash +sudo service pleroma restart +``` -- cgit v1.2.3 From 5cacb988b99347b228a30743fbcf310c9479b3f9 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 6 Dec 2019 15:12:56 +0300 Subject: partially settings update --- docs/API/admin_api.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index 851c526d6..dff12db56 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -764,6 +764,41 @@ Most of the settings will be applied in `runtime`, this means that you don't nee [subkey2: val2] \\ value after deletion ``` +*Most of the settings can be partially updated through merge old values with new values, except settings value of which is list or is not keyword.* + +Example of setting without keyword in value: +```elixir +config :tesla, :adapter, Tesla.Adapter.Hackney +``` + +List of settings which have list in value: +```elixir +@full_key_update [ + {:pleroma, :ecto_repos}, + {:quack, :meta}, + {:mime, :types}, + {:cors_plug, [:max_age, :methods, :expose, :headers]}, + {:auto_linker, :opts}, + {:swarm, :node_blacklist} + ] +``` + +*Settings without explicit key must be sended in separate config object params.* +```elixir +config :quack, + level: :debug, + meta: [:all], + ... +``` +```json +{ + configs: [ + {"group": ":quack", "key": ":level", "value": ":debug"}, + {"group": ":quack", "key": ":meta", "value": [":all"]}, + ... + ] +} +``` - Request: ```json -- cgit v1.2.3 From fea734ca703b686701b87c8c4c4969deb05d1f92 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 6 Dec 2019 17:50:53 +0300 Subject: errors on endpoints --- docs/API/admin_api.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index dff12db56..98af8e8f3 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -665,19 +665,6 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - 404 Not Found `"Not found"` - On success: 200 OK `{}` -## `GET /api/pleroma/admin/config/migrate_to_db` - -### Run mix task pleroma.config migrate_to_db - -Copies `pleroma` environment settings to the database. - -- Params: none -- Response: - -```json -{} -``` - ## `GET /api/pleroma/admin/config/migrate_from_db` ### Run mix task pleroma.config migrate_from_db @@ -686,6 +673,8 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` - Params: none - Response: + - On failure: + - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` ```json {} @@ -699,6 +688,9 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` - Params: none - Response: + - On failure: + - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` + - 400 Bad Request `"To use dynamic configuration migrate your settings to database."` ```json { @@ -831,7 +823,8 @@ config :quack, ``` - Response: - + - On failure: + - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` ```json { configs: [ -- cgit v1.2.3 From bb9a43c3ae7c63b21b687d018b9497f3614566bf Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 12 Dec 2019 16:44:24 +0300 Subject: typo fix --- docs/API/admin_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index 98af8e8f3..e0eda0841 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -807,7 +807,7 @@ config :quack, {"tuple": [":proxy_opts", [ {"tuple": [":redirect_on_failure", false]}, {"tuple": [":max_body_length", 1048576]}, - {"tuple": [":http": [ + {"tuple": [":http", [ {"tuple": [":follow_redirect", true]}, {"tuple": [":pool", ":upload"]}, ]]} -- cgit v1.2.3 From 00aff5f78c5df202ffd0dcad231f819c3d11fe18 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 10 Jan 2020 17:54:54 +0300 Subject: syncing new setting to descriptions.exs --- docs/configuration/cheatsheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index cad3af68d..336fd3e11 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -355,7 +355,7 @@ Available caches: * `proxy_url`: an upstream proxy to fetch posts and/or media with, (default: `nil`) * `send_user_agent`: should we include a user agent with HTTP requests? (default: `true`) -* `user_agent`: what user agent should we use? (default: `:default`), must be string or `:default` +* `user_agent`: what user agent should we use? (default: `:default`), must be string or `:default` * `adapter`: array of hackney options -- cgit v1.2.3 From 958d0452e4e52f44301e4d9211fc965c1c184363 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 10 Jan 2020 18:18:09 +0300 Subject: fix for pleroma assets group update --- docs/API/admin_api.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index e0eda0841..cd4916248 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -3,7 +3,7 @@ Authentication is required and the user must be an admin. Configuration options: - + * `[:auth, :enforce_oauth_admin_scope_usage]` — OAuth admin scope requirement toggle. If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token (client app must support admin scopes). If `false` and token doesn't have admin scope(s), `is_admin` user flag grants access to admin-specific actions. @@ -763,15 +763,17 @@ Example of setting without keyword in value: config :tesla, :adapter, Tesla.Adapter.Hackney ``` -List of settings which have list in value: +List of settings which support only full update: ```elixir @full_key_update [ {:pleroma, :ecto_repos}, + {:pleroma, :assets}, {:quack, :meta}, {:mime, :types}, {:cors_plug, [:max_age, :methods, :expose, :headers]}, {:auto_linker, :opts}, - {:swarm, :node_blacklist} + {:swarm, :node_blacklist}, + {:logger, :backends} ] ``` -- cgit v1.2.3 From 7d128ca2083d83486a05d8c4456aa4090006e781 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 10 Jan 2020 19:34:19 +0300 Subject: dynamic_configuration renaming and moving it from instance settings --- docs/API/admin_api.md | 4 ++-- docs/admin/config.md | 10 ++++------ docs/configuration/cheatsheet.md | 9 ++++----- 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index cd4916248..f2a0906b8 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -684,7 +684,7 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` ### Get saved config settings -**Only works when `:dynamic_configuration` is `true`.** +**Only works when configuration from database is enabled.** - Params: none - Response: @@ -708,7 +708,7 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` ### Update config settings -**Only works when `:dynamic_configuration` is `true`.** +**Only works when configuration from database is enabled.** Some modifications are necessary to save the config settings correctly: diff --git a/docs/admin/config.md b/docs/admin/config.md index f42ec8975..41ca8fd58 100644 --- a/docs/admin/config.md +++ b/docs/admin/config.md @@ -1,9 +1,8 @@ # Configuring instance -You can configure your instance from admin interface. You need account with admin rights and little change in config file, which will allow settings dynamic configuration from database. +You can configure your instance from admin interface. You need account with admin rights and little change in config file, which will allow settings configuration from database. ```elixir -config :pleroma, :instance, - dynamic_configuration: true +config :pleroma, configurable_from_database: true ``` ## How it works @@ -48,10 +47,9 @@ rm -rf config/prod.exported_from_db.exs ``` *If you don't want to backup settings, you can skip step with `cp` command.* -3. Set dynamic configuration to `false`. +3. Set configurable_from_database to `false`. ```elixir -config :pleroma, :instance, - dynamic_configuration: false +config :pleroma, configurable_from_database: false ``` 4. Restart pleroma instance ```bash diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 336fd3e11..30d673eba 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -70,11 +70,6 @@ You shouldn't edit the base config directly to avoid breakages and merge conflic * `account_field_value_length`: An account field value maximum length (default: `2048`). * `external_user_synchronization`: Enabling following/followers counters synchronization for external users. -!!! danger - This is a Work In Progress, not usable just yet - -* `dynamic_configuration`: Allow transferring configuration to DB with the subsequent customization from Admin api. - ## Federation ### MRF policies @@ -841,3 +836,7 @@ config :auto_linker, ## Custom Runtime Modules (`:modules`) * `runtime_dir`: A path to custom Elixir modules (such as MRF policies). + + +## :configurable_from_database +Enable/disable configuration from database. -- cgit v1.2.3 From d933fd3d61df2f9c346ab08fb2c95ddc12803858 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 10 Jan 2020 19:49:40 +0300 Subject: more renamings --- docs/API/admin_api.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index f2a0906b8..37cd1910d 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -674,7 +674,7 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` - Params: none - Response: - On failure: - - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` ```json {} @@ -689,8 +689,8 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` - Params: none - Response: - On failure: - - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` - - 400 Bad Request `"To use dynamic configuration migrate your settings to database."` + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` + - 400 Bad Request `"To use configuration from database migrate your settings to database."` ```json { @@ -826,7 +826,7 @@ config :quack, - Response: - On failure: - - 400 Bad Request `"To use this endpoint you need to enable dynamic configuration."` + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` ```json { configs: [ -- cgit v1.2.3 From f01ab6cd29aaae39fef6a95ec8490223fb692499 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 21 Jan 2020 17:49:22 +0300 Subject: some refactor and tests --- docs/administration/CLI_tasks/config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md index e9d44b9a4..fe76b534b 100644 --- a/docs/administration/CLI_tasks/config.md +++ b/docs/administration/CLI_tasks/config.md @@ -18,11 +18,11 @@ mix pleroma.config migrate_to_db ## Transfer config from DB to `config/env.exported_from_db.secret.exs` +To delete transfered settings from database optional flag `-d` can be used. ```sh tab="OTP" - ./bin/pleroma_ctl config migrate_from_db + ./bin/pleroma_ctl config migrate_from_db --env= [-d] ``` ```sh tab="From Source" -mix pleroma.config migrate_from_db +mix pleroma.config migrate_from_db --env= [-d] ``` - -- cgit v1.2.3 From 043cd5aa5458bb5b2ae0b44e475db59c195bec24 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 22 Jan 2020 13:58:02 +0100 Subject: Emoji reactions: Document changes --- docs/API/differences_in_mastoapi_responses.md | 2 +- docs/API/pleroma_api.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/API/differences_in_mastoapi_responses.md b/docs/API/differences_in_mastoapi_responses.md index 50076cf98..3f75a13f7 100644 --- a/docs/API/differences_in_mastoapi_responses.md +++ b/docs/API/differences_in_mastoapi_responses.md @@ -29,7 +29,7 @@ Has these additional fields under the `pleroma` object: - `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain` - `expires_at`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire - `thread_muted`: true if the thread the post belongs to is muted -- `emoji_reactions`: An object with all the emoji reactions with count. Contains no information about the reacting users, for that use the `emoji_reactions_by` endpoint. +- `emoji_reactions`: A list with emoji / reaction count tuples. Contains no information about the reacting users, for that use the `emoji_reactions_by` endpoint. ## Attachments diff --git a/docs/API/pleroma_api.md b/docs/API/pleroma_api.md index 689edbcc2..9ca8a5af0 100644 --- a/docs/API/pleroma_api.md +++ b/docs/API/pleroma_api.md @@ -451,11 +451,11 @@ Emoji reactions work a lot like favourites do. They make it possible to react to * Method: `GET` * Authentication: optional * Params: None -* Response: JSON, a map of emoji to account list mappings. +* Response: JSON, a list of emoji/account list tuples, sorted by emoji insertion date, in ascending order, e.g, the first emoji in the list is the oldest. * Example Response: ```json -{ - "😀" => [{"id" => "xyz.."...}, {"id" => "zyx..."}], - "🗡" => [{"id" => "abc..."}] -} +[ + ["😀", [{"id" => "xyz.."...}, {"id" => "zyx..."}]], + ["☕", [{"id" => "abc..."}]] +] ``` -- cgit v1.2.3 From a9c6f119ac8fb2124241a61b26d97bff207218d8 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 22 Jan 2020 18:08:53 +0300 Subject: docs update --- docs/API/admin_api.md | 20 ++++++++++++++----- docs/admin/config.md | 34 +++++++++++++++++++++++++++------ docs/administration/CLI_tasks/config.md | 6 +++--- 3 files changed, 46 insertions(+), 14 deletions(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index 37cd1910d..534c49eed 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -682,11 +682,12 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs` ## `GET /api/pleroma/admin/config` -### Get saved config settings +### Get list of merged default settings with saved in database. **Only works when configuration from database is enabled.** -- Params: none +- Params: + - `only_db`: true (*optional*, get only saved in database settings) - Response: - On failure: - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` @@ -734,7 +735,6 @@ Most of the settings will be applied in `runtime`, this means that you don't nee - all settings inside these keys: - `:hackney_pools` - `:chat` - - `Pleroma.Web.Endpoint` - partially settings inside these keys: - `:seconds_valid` in `Pleroma.Captcha` - `:proxy_remote` in `Pleroma.Upload` @@ -763,11 +763,10 @@ Example of setting without keyword in value: config :tesla, :adapter, Tesla.Adapter.Hackney ``` -List of settings which support only full update: +List of settings which support only full update by key: ```elixir @full_key_update [ {:pleroma, :ecto_repos}, - {:pleroma, :assets}, {:quack, :meta}, {:mime, :types}, {:cors_plug, [:max_age, :methods, :expose, :headers]}, @@ -777,6 +776,17 @@ List of settings which support only full update: ] ``` +List of settings which support only full update by subkey: +```elixir +@full_subkey_update [ + {:pleroma, :assets, :mascots}, + {:pleroma, :emoji, :groups}, + {:pleroma, :workers, :retries}, + {:pleroma, :mrf_subchain, :match_actor}, + {:pleroma, :mrf_keyword, :replace} + ] +``` + *Settings without explicit key must be sended in separate config object params.* ```elixir config :quack, diff --git a/docs/admin/config.md b/docs/admin/config.md index 41ca8fd58..35e43b6a9 100644 --- a/docs/admin/config.md +++ b/docs/admin/config.md @@ -8,14 +8,24 @@ config :pleroma, configurable_from_database: true ## How it works Settings are stored in database and are applied in `runtime` after each change. Most of the settings take effect immediately, except some, which need instance reboot. These settings are needed in `compile time`, that's why settings are duplicated to the file. -File with duplicated settings is located in `config/{env}.exported_from_db.exs`. For prod env it will be `config/prod.exported_from_db.exs`. +File with duplicated settings is located in `config/{env}.exported_from_db.exs` if pleroma is runned from source. For prod env it will be `config/prod.exported_from_db.exs`. + +For releases: `/etc/pleroma/prod.exported_from_db.secret.exs` or `PLEROMA_CONFIG_PATH/prod.exported_from_db.exs`. ## How to set it up -You need to migrate your existing settings to the database. You can do this with mix task (all config files will remain untouched): -```bash +You need to migrate your existing settings to the database. This task will migrate only added by user settings. +For example you add settings to `prod.secret.exs` file, only these settings will be migrated to database. For release it will be `/etc/pleroma/config.exs` or `PLEROMA_CONFIG_PATH`. +You can do this with mix task (all config files will remain untouched): + +```sh tab="OTP" + ./bin/pleroma_ctl config migrate_to_db +``` + +```sh tab="From Source" mix pleroma.config migrate_to_db ``` -Now you can change settings in admin interface. After each save, settings are duplicated to the `config/{env}.exported_from_db.exs` file. + +Now you can change settings in admin interface. After each save, settings from database are duplicated to the `config/{env}.exported_from_db.exs` file. **ATTENTION** @@ -25,13 +35,25 @@ Now you can change settings in admin interface. After each save, settings are du - all settings inside these keys: - `:hackney_pools` - `:chat` - - `Pleroma.Web.Endpoint` - partially settings inside these keys: - `:seconds_valid` in `Pleroma.Captcha` - `:proxy_remote` in `Pleroma.Upload` - `:upload_limit` in `:instance` -## How to remove it +## How to dump settings from database to file + +*Adding `-d` flag will delete migrated settings from database table.* + +```sh tab="OTP" + ./bin/pleroma_ctl config migrate_from_db [-d] +``` + +```sh tab="From Source" +mix pleroma.config migrate_from_db [-d] +``` + + +## How to completely remove it 1. Truncate or delete all values from `config` table ```sql diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md index fe76b534b..2af51c247 100644 --- a/docs/administration/CLI_tasks/config.md +++ b/docs/administration/CLI_tasks/config.md @@ -18,11 +18,11 @@ mix pleroma.config migrate_to_db ## Transfer config from DB to `config/env.exported_from_db.secret.exs` -To delete transfered settings from database optional flag `-d` can be used. +To delete transfered settings from database optional flag `-d` can be used. is `prod` by default. ```sh tab="OTP" - ./bin/pleroma_ctl config migrate_from_db --env= [-d] + ./bin/pleroma_ctl config migrate_from_db [--env=] [-d] ``` ```sh tab="From Source" -mix pleroma.config migrate_from_db --env= [-d] +mix pleroma.config migrate_from_db [--env=] [-d] ``` -- cgit v1.2.3 From f3e074e949ce603446728b02ea059efe2a05a841 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 22 Jan 2020 18:22:54 +0300 Subject: little fixes --- docs/API/admin_api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index 534c49eed..07aa7ec3f 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -722,11 +722,11 @@ Some modifications are necessary to save the config settings correctly: ``` ":pleroma" -> :pleroma ``` -- objects with `tuple` key and array value will be converted to atoms; +- objects with `tuple` key and array value will be converted to tuples; ``` {"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []} ``` -- arrays with *tuple objects* and 2 childs in array will be converted to keywords; +- arrays with *tuple objects* will be converted to keywords; ``` [{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"] ``` -- cgit v1.2.3 From 85f45c768994ce9e0642cc3fc29b68b1ec9a6684 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 22 Jan 2020 20:11:18 +0100 Subject: Document new EmojiReaction notifications --- docs/API/differences_in_mastoapi_responses.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs') diff --git a/docs/API/differences_in_mastoapi_responses.md b/docs/API/differences_in_mastoapi_responses.md index 3f75a13f7..2236870c7 100644 --- a/docs/API/differences_in_mastoapi_responses.md +++ b/docs/API/differences_in_mastoapi_responses.md @@ -101,6 +101,14 @@ The `type` value is `move`. Has an additional field: - `target`: new account +### EmojiReaction Notification + +The `type` value is `pleroma:emoji_reaction`. Has these fields: + +- `emoji`: The used emoji +- `account`: The account of the user who reacted +- `status`: The status that was reacted on + ## GET `/api/v1/notifications` Accepts additional parameters: -- cgit v1.2.3 From 89eeadc2a892194ee83c1c885845a93e7ec6e397 Mon Sep 17 00:00:00 2001 From: Farhan Khan Date: Wed, 22 Jan 2020 17:33:10 -0500 Subject: Updated OpenBSD installation guide for version OpenBSD 6.6 * initdb command now requires explicit -U and -D flags * acme-client now requires version v02 API endpoint * Added step to add admin user, per other installation guides * Corrected setup_db.psql path --- docs/installation/openbsd_en.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/installation/openbsd_en.md b/docs/installation/openbsd_en.md index 45602bd75..e8c5d844c 100644 --- a/docs/installation/openbsd_en.md +++ b/docs/installation/openbsd_en.md @@ -1,6 +1,6 @@ # Installing on OpenBSD -This guide describes the installation and configuration of pleroma (and the required software to run it) on a single OpenBSD 6.4 server. +This guide describes the installation and configuration of pleroma (and the required software to run it) on a single OpenBSD 6.6 server. For any additional information regarding commands and configuration files mentioned here, check the man pages [online](https://man.openbsd.org/) or directly on your server with the man command. @@ -40,7 +40,12 @@ Enter a shell as the \_pleroma user. As root, run `su _pleroma -;cd`. Then clone #### PostgreSQL Start a shell as the \_postgresql user (as root run `su _postgresql -` then run the `initdb` command to initialize postgresql: -If you wish to not use the default location for postgresql's data (/var/postgresql/data), add the following switch at the end of the command: `-D ` and modify the `datadir` variable in the /etc/rc.d/postgresql script. +You will need to specify pgdata directory to the default (/var/postgresql/data) with the `-D ` and set the user to postgres with the `-U ` flag. This can be done as follows: + +``` +initdb -D /var/postgresql/data -U postgres +``` +If you are not using the default directory, you will have to update the `datadir` variable in the /etc/rc.d/postgresql script. When this is done, enable postgresql so that it starts on boot and start it. As root, run: ``` @@ -81,7 +86,6 @@ server "default" { } types { - include "/usr/share/misc/mime.types" } ``` Do not forget to change ** to your server's address(es). If httpd should only listen on one protocol family, comment one of the two first *listen* options. @@ -103,7 +107,7 @@ Insert the following configuration in /etc/acme-client.conf: authority letsencrypt- { #agreement url "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf" - api url "https://acme-v01.api.letsencrypt.org/directory" + api url "https://acme-v02.api.letsencrypt.org/directory" account key "/etc/acme/letsencrypt-privkey-.pem" } @@ -222,7 +226,7 @@ Then follow the main installation guide: * run `mix deps.get` * run `mix pleroma.instance gen` and enter your instance's information when asked * copy config/generated\_config.exs to config/prod.secret.exs. The default values should be sufficient but you should edit it and check that everything seems OK. - * exit your current shell back to a root one and run `psql -U postgres -f /home/_pleroma/config/setup_db.psql` to setup the database. + * exit your current shell back to a root one and run `psql -U postgres -f /home/_pleroma/pleroma/config/setup_db.psql` to setup the database. * return to a \_pleroma shell into pleroma's installation directory (`su _pleroma -;cd ~/pleroma`) and run `MIX_ENV=prod mix ecto.migrate` As \_pleroma in /home/\_pleroma/pleroma, you can now run `LC_ALL=en_US.UTF-8 MIX_ENV=prod mix phx.server` to start your instance. @@ -230,3 +234,11 @@ In another SSH session/tmux window, check that it is working properly by running ##### Starting pleroma at boot An rc script to automatically start pleroma at boot hasn't been written yet, it can be run in a tmux session (tmux is in base). + + +#### Create administrative user + +If your instance is up and running, you can create your first user with administrative rights with the following command as the \_pleroma user. +``` +LC_ALL=en_US.UTF-8 MIX_ENV=prod mix pleroma.user new --admin +``` -- cgit v1.2.3