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