﻿# Install BRIX AI using Docker Compose

> [HTML Version](cortex-docker-compose.html)

When installing **BRIX AI** using Docker Compose, all components are deployed as containers on a single server. This deployment option is suitable only for test environments, as it does not support microservice scaling. An internet connection is required for installation.

Before you begin, make sure that:

1. [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/) are installed.

2. You have [downloaded the installation files](cortex-download-installer.md).

3. You have [configured environment variables](cortex-environment-variables.md).

Please note:

- MongoDB replication requires an internal authentication key for database nodes. It is [created automatically during installation](#mongodb-key).

- If you use self-signed certificates, [export the root certificate](#caddy) after installation to add it to your list of trusted certificates.

## Install BRIX AI

To install **BRIX AI** using Docker Compose:

1. Run the installation script:

````
chmod +x install.sh  
./install.sh

````
If you use multiple instances of **BRIX AI** and need to specify a [project name](cortex-environment-variables.md#project-name), use the following parameter:

````
./install.sh --project-name my-cortex

2. ````
After running the `install.sh` script, some services may take a few minutes to start up completely. To check if the services are ready, run the following command:

````
docker ps

3. ````
Wait until the message “Application startup complete” appears in the logs.

### Create a key for MongoDB

During the installation of **BRIX AI**, the `install.sh` script automatically generates an authentication key used for replication of the built-in MongoDB service. File access permissions are assigned automatically.

If you need to generate a new key manually, run the following commands:

````
openssl rand -base64 756 > mongo.keyfile  
  
sudo chown 999:999 mongo.keyfile  
sudo chmod 400 mongo.keyfile

### ````
Export the Caddy root certificate

If you selected **Internal** as the [TLS certificate management mode](cortex-tls-settings.md), export the Caddy root certificate to add it to your trusted certificates:

````
docker exec \$(docker ps -q -f name=caddy) cat /data/caddy/pki/authorities/local/root.crt > caddy\_root.crt

## ````
Update BRIX AI

When a new version of **BRIX AI** is released, save your current configuration and perform the update. To learn more, see [Update BRIX AI using Docker Compose](update-cortex-docker-compose.md).

## Uninstall BRIX AI

To uninstall BRIX AI when using Docker Compose:

1. Run the uninstallation script:

````
chmod +x uninstall.sh  
./uninstall.sh

````
If you use multiple instances of **BRIX AI** and need to specify a [project name](cortex-environment-variables.md#project-name), use the following parameter:

````
./uninstall.sh --project-name my-cortex

2. ````
To also delete all data in Docker volumes, run the following command:

````
COMPOSE\_PROJECT\_NAME=elma-cortex docker compose --profile caddy --profile redis --profile mongo --profile rabbit --profile minio --profile qdrant --profile phoenix down –v
````