﻿# Update BRIX AI when using Docker Swarm

> [HTML Version](update-cortex-docker-swarm.html)

When a new version of **BRIX AI** is released, download the archive with updated installation files and transfer your configuration settings from the environment variables file. Below are the steps to update BRIX when AI using Docker Swarm.

## Step 1. Save current configuration

Before updating, create a copy of your current `.env` environment variables file:

````
cp ~/elma-cortex/docker-swarm/.env ~/elma-cortex-env-backup.env

## ````
Step 2. Download installation files

Download the archive containing the new version of installation files and extract it. Existing files will be replaced with the new ones.

To do this, run the following commands:

````
cd ~  
curl -fsSO https://dl.elma365.com/extensions/elma-cortex/latest/elma-cortex-onpremises.zip  
unzip -o -d ./elma-cortex elma-cortex-onpremises.zip

````
Using the `-o` flag overwrites existing files without prompting for confirmation.

## Step 3. Transfer configuration

1. Compare the saved backup copy with the new `.env` file to identify settings added in the latest version. Run the following command:

````
diff ~/elma-cortex-env-backup.env ~/elma-cortex/docker-swarm/.env

2. ````
Transfer setting values from your custom configuration by running one of the following commands:

- To replace the new `.env` file with your backup copy and manually add new parameters from the latest version:

````
cp ~/elma-cortex-env-backup.env ~/elma-cortex/docker-swarm/.env

- ````
To edit the new `.env` file directly and transfer modified values from your backup copy:

````
nano ~/elma-cortex/docker-swarm/.env

## ````
Step 4. Apply update

Go to the folder containing the installation files and run the installation script:

````
cd ~/elma-cortex/docker-swarm  
./install.sh

````
The script will download the new Docker images and restart services with the updated version.