# Miscellaneous Procedures

There are certain things you may want to do with your Akkoma install after the fact - for example, if you originally set up your instance to pull configuration from the config file, and you later wish to instead pull it from the database. This page is to guide you through such procedures.

##### Running Commands

Note that for any **mix** command you run, you will want to run it as the **akkoma** user, and you will want to add "**MIX\_ENV=prod**" to the beginning.

If you don't tell it anything, it will assume that you want to affect a **dev** environment, including pulling all of the config for the dev environment. This is not what we want - largely because it will **not use your config** (anything in prod.secrets.exs). You will **always** want to add MIX\_ENV=prod to the beginning of a mix command.

If you installed Elixir and Erlang with asdf, you will need to go into a shell as the Akkoma user, navigate to the install directory, and run the command that way:

```bash
sudo su -l akkoma -s $SHELL
cd /opt/akkoma
MIX_ENV=prod mix <the mix command here>
```

If you installed Elixir and Erlang through your distro, you still need to navigate to the install directory, but you can use sudo instead:

```bash
cd /opt/akkoma/
sudo -Hu akkoma MIX_ENV=prod mix your_command_here
```

For these procedures, we will go into a shell as the Akkoma user. This works for all config, regardless of if you used asdf or not.

#### Migrating from Text Config to Database Config

If you chose not to use database config during install and changed your mind, follow this procedure to migrate to using the in-database config instead.

Before you can do anything, you'll need to enable the setting to configure Akkoma from the database:

```bash
echo 'config :pleroma, configurable_from_database: true' >> /opt/akkoma/config/prod.secret.exs
systemctl restart akkoma
```

Wait for Akkoma to compile (you can watch with **journalctl -feu akkoma**), then enter the Akkoma user shell:

```bash
sudo su -l akkoma -s $SHELL
cd /opt/akkoma
```

and run this command to migrate your config to the database:

```bash
MIX_ENV=prod mix pleroma.config migrate_to_db
```

Finally, exit the Akkoma shell and restart.

```bash
exit
systemctl restart akkoma
```

Once Akkoma's back up, you should be able to edit your config in the Admin frontend now.

#### Migrating From Database Config to Text Config

If you chose to use database config during install and changed your mind, follow this procedure to migrate from using the in-database config back to text config instead.

Enter the Akkoma user shell:

```bash
sudo su -l akkoma -s $SHELL
cd /opt/akkoma
```

Then, you're going to run this command to pull all the config currently in the database and write it to a file:

```bash
MIX_ENV=prod mix pleroma.config migrate_from_db
```

It should write what config you have in the database to a new config file - **config/prod.exported\_from\_db.secret.exs**. You will want to take all of the config from this file and merge it into what's in your prod.secret.exs.

Once you've completed that, remove the following line from your config:

```
config :pleroma, configurable_from_database: true
```

and then exit the shell and restart Akkoma.

```bash
exit
sudo systemctl restart akkoma
```