config.md (2845B)
1 # Configuring instance 2 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. 3 4 ```elixir 5 config :pleroma, configurable_from_database: true 6 ``` 7 8 ## How it works 9 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. 10 11 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`. 12 13 For releases: `/etc/pleroma/prod.exported_from_db.secret.exs` or `PLEROMA_CONFIG_PATH/prod.exported_from_db.exs`. 14 15 ## How to set it up 16 You need to migrate your existing settings to the database. This task will migrate only added by user settings. 17 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`. 18 You can do this with mix task (all config files will remain untouched): 19 20 ```sh tab="OTP" 21 ./bin/pleroma_ctl config migrate_to_db 22 ``` 23 24 ```sh tab="From Source" 25 mix pleroma.config migrate_to_db 26 ``` 27 28 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. 29 30 <span style="color:red">**ATTENTION**</span> 31 32 **<span style="color:red">Be careful while changing the settings. Every inaccurate configuration change can break the federation or the instance load.</span>** 33 34 *Compile time settings, which require instance reboot and can break instance loading:* 35 - all settings inside these keys: 36 - `:hackney_pools` 37 - `:chat` 38 - partially settings inside these keys: 39 - `:seconds_valid` in `Pleroma.Captcha` 40 - `:proxy_remote` in `Pleroma.Upload` 41 - `:upload_limit` in `:instance` 42 43 ## How to dump settings from database to file 44 45 *Adding `-d` flag will delete migrated settings from database table.* 46 47 ```sh tab="OTP" 48 ./bin/pleroma_ctl config migrate_from_db [-d] 49 ``` 50 51 ```sh tab="From Source" 52 mix pleroma.config migrate_from_db [-d] 53 ``` 54 55 56 ## How to completely remove it 57 58 1. Truncate or delete all values from `config` table 59 ```sql 60 TRUNCATE TABLE config; 61 ``` 62 2. Delete `config/{env}.exported_from_db.exs`. 63 64 For `prod` env: 65 ```bash 66 cd /opt/pleroma 67 cp config/prod.exported_from_db.exs config/exported_from_db.back 68 rm -rf config/prod.exported_from_db.exs 69 ``` 70 *If you don't want to backup settings, you can skip step with `cp` command.* 71 72 3. Set configurable_from_database to `false`. 73 ```elixir 74 config :pleroma, configurable_from_database: false 75 ``` 76 4. Restart pleroma instance 77 ```bash 78 sudo service pleroma restart 79 ```