# Configuring infrastructure

## Cassandra installation

After processing the above information, the installer will then install Cassandra. Cassandra is the storage engine for JanusGraph DB. You will see output like the example below during this step.

There might be an error message at several lines in `.java` files. Ignore this error - since Cassandra takes a little while to start, an error occurs due to this delay. The installer will wait and then proceed with the installation.

Example output:

{% code overflow="wrap" expandable="true" %}

```shellscript
Synchronizing state of cassandra.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable cassandra
Created symlink /etc/systemd/system/default.target.wants/cassandra.service → /etc/systemd/system/cassandra.service.
0
error: No nodes present in the cluster. Has this node finished starting up?
-- StackTrace --
java.lang.RuntimeException: No nodes present in the cluster. Has this node finished starting up?

...

Waiting for cassandra
1
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  73.52 KiB  256     100.0%            5a7c7a99-aeaf-4576-9863-f226a7867ef0  rack1

Cassandra alive
Cassandra is ready to use. Continue...
```

{% endcode %}

Once Cassandra is ready, the installer continues with OpenSearch, Redis, and RabbitMQ.

## Message broker (RabbitMQ), cache (Redis), and OpenSearch

### RabbitMQ

OpenIAM uses RabbitMQ as the message broker and is the primary transport service used by the OpenIAM application. Services are loosely coupled, and they communicate with each other through the message broker. Cross-service communication is encrypted.

The next question raised by the installer is to define a password for RabbitMQ. As seen in the above questions, a default password value is provided for simplicity. For production use, please use a strong password.

The installer prompts:

```shellscript
Set OpenIAM password for RabbitMQ message broker, default: passwd00
```

{% hint style="info" %}
Make sure to use a strong password for the production environment.
{% endhint %}

#### Redis

Redis is an in-memory distributed cache which is used by OpenIAM to improve system performance. A variety of objects are temporarily stored in Redis including:

* End user web session.
* Database object cache.
* High level application cache.

As with other components, access to the cache is secured and the next question asks for a password which should be used for Redis.

```shellscript
Set OpenIAM password for Redis., default: passwd00
```

If you want to use Redis with TLS, select `y`; otherwise, select `n` as the default parameter and proceed with the next steps.

```shellscript
Do you want to enable TLS for Redis? (y/n): n
```

#### OpenSearch

OpenSearch is used by OpenIAM to enable fast searching of frequently used data. As with the components above, access to OpenSearch is secured through its own set of credentials. You will be prompted for this information as shown below.

{% code overflow="wrap" %}

```shellscript
OpenIAM Username to access OpenSearch: elastic
OpenIAM password for elastic user to access OpenSearch: ilm5LjYPAeFWbfLE40dthmEOunN4Cnlz
```

{% endcode %}

{% hint style="info" %}
The information requested above is critical for the installation process. Mistakes in these steps can disrupt the installation process. To minimize such issues, you will be asked to review the above answers. If you agree with the information, select `Y`. If you need to fix some information, select `N` and the installer will walk you through this process again.
{% endhint %}

After entering these values, validate the information before proceeding.

## SMTP Credentials <a href="#smtpcredentials" id="smtpcredentials"></a>

E-mail notifications can be enabled for a broad range of operations in OpenIAM. Configuring a valid SMTP service is a prerequisite to being able to send e-mail notifications. The next two questions ask the user to provide the SMTP credentials for the account which will be used to send e-mails from the application. These questions are optional at this time, and you have the option to configure these later if needed.

{% code overflow="wrap" %}

```shellscript
Set SMTP username. You can change it later., default: none
Set SMTP password. You can change it later., default: none
```

{% endcode %}

## Initializing the database schema

The installer prompts for the values used to initialize the database schemas and users.

| Question                                                                                       | Explanation                                                                       |
| ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| Use default value if new installation. If upgrade, specify current version, default: `0.0.0.0` | If upgrading, specify the current version. For new installs, the default is fine. |
| OpenIAM core database name, default: `openiam`                                                 | Primary OpenIAM schema name.                                                      |
| Activiti database name, default: `activiti`                                                    | Workflow schema name.                                                             |
| Database type, default: `MySQL`                                                                | Choose `mysql`, `postgres`, `oracle`, or `mssql`.                                 |
| Groovy DB name, host, port (defaults `groovy`, `localhost`, `3306`)                            | Groovy database connection details.                                               |
| Do you want to initialize OpenIAM schema and users? \[y/n]                                     | If `Y`, the installer will create schemas and users.                              |
| Enter username for super user (e.g., root), default: `root`                                    | Super user for DB operations.                                                     |
| Enter password for super user                                                                  | Password for the super user account.                                              |
| Do you use AWS RDS MariaDB? \[y/n]                                                             | If `yes`, ensure `log_bin_trust_function_creators = 1`.                           |

After answering, the installer shows a summary for validation:

{% code overflow="wrap" expandable="true" %}

```shellscript
Please validate information below
---------------------------------
FLYWAY_BASELINE_VERSION=2.3.0.0
FLYWAY_OPENIAM_DATABASE_NAME=openiam
FLYWAY_ACTIVITI_DATABASE_NAME=activiti
FLYWAY_OPENIAM_HOST=localhost
FLYWAY_OPENIAM_PORT=3306
FLYWAY_ACTIVITI_HOST=localhost
FLYWAY_ACTIVITI_PORT=3306
FLYWAY_GROOVY_HOST=localhost
FLYWAY_GROOVY_PORT=3306
FLYWAY_DATABASE_TYPE=mysql
Database will be initialized=Y
Root (Db admin) user name=root
Root (Db admin) user password=passwd00
Please validate your input above, if you are OK with that enter 'y'. To repeat an information collecting procedure enter 'n' :y
```

{% endcode %}

If you confirm with `Y`, Flyway generates the database schema.

## Installing the reverse proxy and monitoring stack

The installer asks:

```shellscript
Do you want to install OpenIAM reverse proxy module? [y/n]:
```

In most cases, select `y`.

You may also be asked:

```shellscript
Do you want to update httpd to 2.4.57 ? [y/n]:
```

Enter `y` to update `httpd` and proceed.

For monitoring, the installer prompts:

```shellscript
Do you want to install Prometheus+Grafana stack for monitoring? [y/n]:y
```

In the final part of the initialization script, `nginx` will be installed and its health check will wait for all OpenIAM services to come up.

### Next step

Continue to [Start services and validate installation](/installing-openiam/start-services-and-validate.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-beta.openiam.com/installing-openiam/configuring-infrastructure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
