> ## Documentation Index
> Fetch the complete documentation index at: https://docs.regatta.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced Deployment Options

The following section describes a method to combine both manual and scripted approaches, allowing the user to utilize RDT functionality to deploy the Regatta database while making desired changes to the configuration along the way.

## Inventory

The Regatta Deployment Tool works by expanding the `config.json` file into a complete `cluster.config` . The first step in the deployment creates an inventory file, and assigns the different Regatta modules to the nodes described in the `config.json`.

<Note>
  The RDT can be executed with the `--help` flag to view the available sub-commands that can be executed.
</Note>

Start by configuring the `config.json` file as described in the [configuration](/self-hosted-deployment/regatta-deployment-tool/configuration) page. Then, continue with the [cluster setup](/self-hosted-deployment/regatta-deployment-tool/cluster-setup) steps, and when you reach the point of executing`setup_cluster.sh`, run it with the following sub-commands:

```bash theme={null}
./setup_cluster.sh os devices
```

These commnds will execute the deployment steps responsible for configuring the firewall and storage devices only. During the execution, an inventory file will be generated under the `ansible `directory where the script resides:

```bash theme={null}
./ansible/inventory
```

The file will look something like this:

```bash theme={null}
[rdb_nodes]
node-1 cluster_index=1 node_index=1 modules='{"sequencer": 1,"gdd": 2,"dcm":3, "rdb": 10}' ansible_host=10.0.0.11
node-2 cluster_index=1 node_index=2 modules='{"rdb": 11}' ansible_host=10.0.0.12
node-3 cluster_index=1 node_index=3 modules='{"rdb": 12}' ansible_host=10.0.0.13
```

You can now change the distribution of the different modules (though this is optional). In the example below, we will locate a non-RDB module with each of the RDBs:

```bash theme={null}
[rdb_nodes]
node-1 cluster_index=1 node_index=1 modules='{"sequencer": 1,"rdb": 10}' ansible_host=10.0.0.11 
node-2 cluster_index=1 node_index=2 modules='{"gdd": 2, "rdb": 11}' ansible_host=10.0.0.12 
node-3 cluster_index=1 node_index=3 modules='{"dcm":3, "rdb": 12}' ansible_host=10.0.0.13 
```

To install the Regatta client and drivers, you can add `clients` to the nodes modules map:

```bash theme={null}
[rdb_nodes]
node-1 cluster_index=1 node_index=1 modules='{"sequencer": 1,"gdd": 2,"dcm":3, "rdb": 10, 
"clients": 0}' ansible_host=10.0.0.11 
node-2 cluster_index=1 node_index=2 modules='{"rdb": 11}' ansible_host=10.0.0.12
node-3 cluster_index=1 node_index=3 modules='{"rdb": 12}' ansible_host=10.0.0.13
```

<Warning>
  Notice that the `clients `key in the modules map <u>must be defined with a number</u>. This number does not have a special purpose for the deployment process; it is there only to maintain the map object structure.
</Warning>

## Configuration

The second step creates all the Regatta configuration files. During this step, it is possible to edit the `cluster.config` file for any Regatta module and change the module-specific parameters, such as dedicated RAM capacity.

Continue by running:

```bash theme={null}
./setup_cluster.sh distribute rpm config
```

* `distribute` command - Copies the RPM packages from the host where the script is executed to each of the cluster nodes/servers.
* `rpm`command -  Installs the RPM packages on each node/server.
* `config`command - Generates a `cluster.config` file, copies it to each node/server, and appends the module-specific section for each module on the cluster.

### Editing Common Cluster Parameters

At this stage, it is also possible to edit the `common` section of the `cluster.config` file. To do so, edit the `cluster.config` file in the Ansible directory located in the same folder as the deployment script:

```bash theme={null}
./ansible/cluster.config
```

Make any changes to the config and save them to the same file. To update the entire cluster with the changes made to the config file, execute the script with the `update_config` command:

```bash theme={null}
./setup_cluster.sh update_config
```

This RDT will copy the `cluster.config` file to each node/server in the cluster and append the module-specific section for each module.

### Editing Module-Specific Parameters

Once the RDT execution with either the `config` or `update_config` commands is done, you can connect to any of the cluster nodes/servers via SSH to edit the config file. For more information about module-specific parameters, follow the instructions from the manual deployment [configuration file](/self-hosted-deployment/manual-deployment/configuration-file) section and apply the desired changes.

<Note>
  Note that the RDT has opened the ports that appear in the configuration files for all Regatta modules prior to this stage. If you decide to change ports, you will also need to update the firewall before executing the next step.
</Note>

## Start

Lastly, starting the cluster using the RDT can be done by running:

```bash theme={null}
./setup_cluster.sh service
```

This will execute the steps to start the Regatta services across the cluster. At this stage, the cluster is up and ready. It is also possible to stop and start the cluster as individual steps by using the `stop_cluster` and `start_cluster` commands:

```bash theme={null}
./setup_cluster.sh stop_cluster
./setup_cluster.sh start_cluster
```

You can also use the `clean_install` command to run a full deployment including removing any previous installations of Regatta on the cluster:

```bash theme={null}
./setup_cluster.sh clean_install
```

<Note>
  `clean_install` command is useful when switching between Regatta distributions, and can also resolve installation errors during the execution of the RDT.
</Note>
