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/admin/config.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 docs/admin/config.md (limited to 'docs/admin') 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 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/admin/config.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'docs/admin') 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 -- 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/admin/config.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'docs/admin') 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 -- cgit v1.2.3