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

# Manual Upgrade Instructions (Windows or edge cases)

> This page provides instructions for upgrading a FlexDeploy installation. These instructions upgrade Tomcat to the version included in the distribution

This page provides instructions for upgrading a FlexDeploy installation. These instructions upgrade Tomcat to the version included in the distribution zip depending on current version of FlexDeploy.

> [!WARNING]
>
> **Unless you are running on Windows or have been advised by Flexagon Support, consider using the** [**Automated Install/Upgrade**](#) **instead.**

# Requirements

See [FlexDeploy System Requirements](https://docs.flexagon.com/flexdeploy-11-2-documentation/flexdeploy-system-requirements.md) for details on software and hardware requirements.

# Upgrade Instructions

> [!NOTE]
>
> Make sure you have downloaded the latest version of FlexDeploy so it can be accessed during upgrade process.

## Step 1. Stop the Tomcat server

Linux

```
cd $FLEXDEPLOY_HOME/apache-tomcat-flexdeploy/bin
./StopFlexDeploy.sh
```

Windows

```
cd %FLEXDEPLOY_HOME%/apache-tomcat-flexdeploy/bin
StopFlexDeploy.bat
```

***

## Step 2. Download FlexDeploy software

Make sure that you have downloaded the latest version of FlexDeploy and unzip it into a temporary location (for example, **/u01/software**), so it can be accessed during the upgrade process. You can get download links from [http://support.flexagon.com](http://support.flexagon.com). **Do not unzip the FlexDeploy distribution directly into the FLEXDEPLOY\_HOME directory so we can prevent unwanted file(s) or folder(s) from being overwritten**.

Note that following instructions show unzip being done in separate folder than where you have stored downloaded file.

Linux

```
mkdir /u01/software/upgradetempdir
cd /u01/software/upgradetempdir
unzip <download location path>/Tomcat_Complete-8.x.x.x.zip
```

Windows

```
mkdir c:\u01\software\upgradetempdir
cd c:\u01\software\upgradetempdir
unzip <download location path>\Tomcat_Complete-8.x.x.x.zip
```

***

## Step 3. Backup current implementation

Backup the FlexDeploy schemas, Artifact Repository, plugins folder, and apache-tomcat-flexdeploy folder. In case you need to back out this FlexDeploy upgrade, you can use this backup data.

It is highly recommended that a backup of the database be taken using standard tools like RMAN for Oracle. Another option would be to export the **FD, FD\_ADMIN, and FF** schemas using data pump. Follow standard procedures for PostgreSQL for database backup.

### PostgreSQL database backup

```
pg_dumpall -w -U postgres -f fd_db_bkp.bkp -p 5432
```

### Oracle database backup

```
# If this database is exclusively used for just FlexDeploy application, you can rely on your Database backup and recovery processes (RMAN) instead of export data procedure.
# You will need to setup environment variables before running expdp. For example,

export ORACLE_HOME=c:\oracle\product\12.1.0\dbhome_1
export ORACLE_SID=fd01

# export statements above are for example only as values will be different for your installation. 

expdp system directory=DATA_PUMP_DIR dumpfile=fd_bkup.dmp schemas=FD,FF,FD_ADMIN
```

### File System backup

It is recommended that a backup of the *artifact repository*, *plugins*, and *apache-tomcat-flexdeploy* be taken in case a back-out is required. The location of the artifact repository can be identified by looking at value of **-Dflexagon.fd.repository.root** in **setenvoverride.sh**/setenv.sh file. This file will be in **\<FLEXDEPLOY\_HOME>/apache-tomcat-flexdeploy/bin**. Additionally look for **flexagon.fd.application.root** to determine server application directory for plugins backup. Standard file backup procedures can be followed.

See the following example. Make sure to backup apache-tomcat-flexdeploy folder as that is going to be replaced during next steps.

Linux

```
cd <artifact repository location>/
tar -cvzf ../artifacts.tar.gz *

# The plugins folder may not exist yet depending which version of FlexDeploy you are upgrading from
cd <server application directory>
cd plugins
tar -cvzf ../plugins.tar.gz *

# apache-tomcat-flexdeploy (if apache-tomcat-flexdeploy-old exists then use some other folder name)
cd $FLEXDEPLOY_HOME
mv apache-tomcat-flexdeploy apache-tomcat-flexdeploy-old
```

Windows

```
cd <artifact repository location>
tar cvzf ..\artifacts.tar.gz *

# The plugins folder may not exist yet depending which version of FlexDeploy you are upgrading from
cd <server application directory>
cd plugins
tar -cvzf ..\plugins.tar.gz *

# apache-tomcat-flexdeploy (if apache-tomcat-flexdeploy-old exists then use some other folder name)
cd %FLEXDEPLOY_HOME%
move apache-tomcat-flexdeploy apache-tomcat-flexdeploy-old
```

***

## Step 4. Upgrade the FlexDeploy schemas

See details in [Upgrading FlexDeploy Schemas](https://docs.flexagon.com/hidden-fd112/flexdeploy-schema-upgrade.md).

***

## Step 5. Apply new version

**You must have performed backup of apache-tomcat-flexdeploy folder by now as described in Step 3. If you have not done that, please go back to Step 3 for details.**

**Note on additional extension jar files** : If you had placed additional libraries in `apache-tomcat-flexdeploy/lib` folder or in the `apache-tomcat-flexdeploy/libext` folder, then you will need to copy them from backup folder into the new `apache-tomcat-flexdeploy/libext` folder. Note that all extension jars should be kept in **libext** folder. Examples might be JDBC driver (for Oracle drivers there is additional detail in the following step), CyberArk libraries etc. **Note that Tomcat jar files should never be kept in libext folder**.

* Copy shell/bat scripts from root folder of extracted FlexDeploy download zip

* Copy new Tomcat folder from extracted FlexDeploy download zip

* Copy additional jar files from backup taken in step 3

See example below on steps necessary.

Linux

```
cd $FLEXDEPLOY_HOME
cp /u01/software/upgradetempdir/*.sh .
chmod +x *.sh

mkdir apache-tomcat-flexdeploy
cd apache-tomcat-flexdeploy

cp -r /u01/software/upgradetempdir/apache-tomcat-flexdeploy/* .
chmod +x bin/*.sh

# restore the libext from the tomcat backup done in Step 3
# if necessary copy other files that you may have placed in lib
# only run this if you had libext folder in your apache-tomcat-flexdeploy-old folder.
cd libext
cp $FLEXDEPLOY_HOME/apache-tomcat-flexdeploy-old/libext/* .
```

Windows

```
cd %FLEXDEPLOY_HOME%
copy c:\u01\software\upgradetempdir\*.bat .

mkdir apache-tomcat-flexdeploy
cd apache-tomcat-flexdeploy

xcopy c:/u01/software/upgradetempdir/apache-tomcat-flexdeploy /e

# restore the libext from the tomcat backup done in Step 3
cd libext
xcopy %FLEXDEPLOY_HOME%\apache-tomcat-flexdeploy-old\libext /e
```

## Step 6. Manage Tomcat context.xml

Copy the *context.xml* file from the backup folder into **\<FLEXDEPLOY\_HOME>/apache-tomcat-flexdeploy/conf.**

Linux

```
cd $FLEXDEPLOY_HOME/apache-tomcat-flexdeploy-old/conf
cp context.xml $FLEXDEPLOY_HOME/apache-tomcat-flexdeploy/conf
```

Windows

```
cd %FLEXDEPLOY_HOME%\apache-tomcat-flexdeploy-old\conf
copy context.xml %FLEXDEPLOY_HOME%\apache-tomcat-flexdeploy\conf
```

If using Oracle database,

* Download the Oracle JDBC 8 driver from [https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html](https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html). Click on the driver link matching your Oracle database version, and download the driver compatible with JDK8. For example, `ojdbc8-full.tar.gz`.

* Save new driver jars from downloaded jdbc driver to **\<FLEXDEPLOY\_HOME>/apache-tomcat-flexdeploy/libext**. You may have done this already as part of Step 4. Make sure that if you copied the jars for libext of your backup to your new libext, you don’t end up with multiple versions of the Oracle JDBC jars. If migrating from an old version of FlexDeploy, you may want to clean your libext folder and start with a new Oracle Database driver download.

Linux

```
cd /u01/software
mkdir drivers
cd drivers

tar -xf <ojdbc8 download location>/ojdbc8-full.tar.gz

cd $FLEXDEPLOY_HOME/apache-tomcat-flexdeploy/lib
rm ojdbc*.jar
cd ../libext
cp /u01/software/drivers/ojdbc8-full/*.jar .
```

Windows

```
cd c:\u01\software
mkdir drivers
cd drivers

tar xf <ojdbc8 download location>\ojdbc8-full.tar.gz

cd %FLEXDEPLOY_HOME%\apache-tomcat-flexdeploy\lib
del /f ojdbc*.jar
cd ..\libext
copy c:\u01\software\drivers\ojdbc8-full\*.jar .
```

***

## Step 7. Manage Tomcat server.xml

Edit the `&lt;FLEXDEPLOY_HOME>/apache-tomcat-flexdeploy/conf/server.xml` and modify the HTTP/HTTPS ports to match that of the original file which was backed up in step 3. If you had setup keystore details, copy that as well from backup file. DO NOT simply copy over the backup file as there may be other changes.

***

## Step 8. Manage setenvoverride file

> [!NOTE]
>
> Changes should not be made in setenv.bat or setenv.sh

If you were already using **setenvoverride.bat or setenvoverride.sh**, then copy that from backup folder (Step 3), otherwise any changes previously done for setenv.bat or setenv.sh must be added to setenvoverride.bat or setenvoverride.sh. For example, the Artifact directory, application directory, and java\_home changes will need to be transferred over from your old setenv.bat or setenv.sh file.

If your backed up setenv.bat or setenv.sh file has a line that contains JAVA\_HOME, then the new setenvoverride.bat or setenvoverride.sh should look like this:

Linux

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590908932.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=b35e64e2aca5dc14e2d6ee9fc60af2d5)

Windows

![](https://flexagon.atlassian.net/wiki/plugins/servlet/confluence/placeholder/unknown-attachment?locale=en_US\&version=2 "UNKNOWN_ATTACHMENT")

***

## Step 9. Update Plugins

FlexDeploy download zip contains plugin jar files. You just need to copy plugin jars from download zip to plugins folder in your installation (details explained below), and all plugins will be automatically uploaded and activated on server startup.

1. Plugin files to copy are in /u01/software/upgradetempdir/application/plugins in the unzipped Tomcat Complete file.

2. Let's determine where to copy files in your installation now. Locate **flexagon.fd.install.root** folder for your FlexDeploy installation, which is FlexDeploy application directory. This is specified on the Java command line. For example, *-Dflexagon.fd.install.root=/u01/flexdeploy/application*.

   * You can look for this information in setenvoverride.bat or setenvoverride.sh file depending whether using Windows or Unix. 

3. Create **plugins** folder if it does not exist under **flexagon.fd.install.root** folder. Copy files from download zip (#1 above) to this plugins folder.

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590908929.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=33f876f747c4e68179b61691c7f1fd7b)

***

## Step 10. Configure Influx Database

> [!NOTE]
>
> This is a **required step that must be executed** if this is the first time you are upgrading to a FlexDeploy 6.0 or higher version. Once upgraded, this step shouldn’t be executed again.

Download links for the influx database software and client, if not already downloaded.

### Linux:

[https://dl.influxdata.com/influxdb/releases/v2.7.12/influxdb2-2.7.12\_linux\_amd64.tar.gz](https://dl.influxdata.com/influxdb/releases/v2.7.12/influxdb2-2.7.12_linux_amd64.tar.gz)

and

[https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz](https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz)

### Windows

[https://dl.influxdata.com/influxdb/releases/v2.7.12/influxdb2-2.7.12-windows.zip](https://dl.influxdata.com/influxdb/releases/v2.7.12/influxdb2-2.7.12-windows.zip)

and

[https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-windows-amd64.zip](https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-windows-amd64.zip)

Unzip / Untar the influx database software and client to the desired location.

Linux

```
tar xf *.gz  --strip-components 1 -C $FLEXDEPLOY_HOME/influxdb
```

Windows

Unzip the files and place the .exe files directly into the %FLEXDEPLOY\_HOME%/influxdb folder.

Copy config files. See example below on steps necessary.

Linux

```
cd $FLEXDEPLOY_HOME
cd influxdb
mkdir config
cd config
cp /u01/software/upgradetempdir/influxdb/config/* .
```

Windows

```
cd %FLEXDEPLOY_HOME%
cd influxdb
mkdir config
cd config
xcopy c:/u01/software/upgradetempdir/influxdb/config /e
```

Adjust the influx database configuration file. **\<FLEXDEPLOY\_HOME>/influxdb/config/config.yaml**

### Linux

```
cd $FLEXDEPLOY_HOME
mkdir -p application/vsm
cd influxdb/config
vi config.yaml
```

Windows

```
cd %FLEXDEPLOY_HOME%
mkdir application\vsm
cd influxdb\config
edit config.yaml
```

Change the following locations: **You must put absolute path as no environment variables are allowed in this file.**

* bolt-path: from \<FLEXDEPLOY\_HOME>/influxdb/data/influxd.bolt to \<FLEXDEPLOY\_HOME>/application/vsm/data/influxd.bolt

* engine-path: from \<FLEXDEPLOY\_HOME>/influxdb/data/engine to \<FLEXDEPLOY\_HOME>/application/vsm/data/engine

* sqlite-path: \<FLEXDEPLOY\_HOME>/influxdb/data/influxd.sqlite to \<FLEXDEPLOY\_HOME>/application/vsm/data/influxd.sqlit

> [!NOTE]
>
> **If running FlexDeploy 6.0 or higher, do not use startup.sh as this will not start the influx database. User StartFlexDeploy.sh or StartFlexDeploy.bat.**

Now Start FlexDeploy to perform additional steps for InfluxDB.

Linux

```
cd $FLEXDEPLOY_HOME
# this will be automatically updated within a FlexDeploy credential (FD_INFLUXDB_ADMIN_TOKEN) on startup so FlexDeploy can connect with the influx database.  
# This will be used in the next setup step.
export INFLUX_DB_TOKEN=<arbitrary value>  
echo ${INFLUX_DB_TOKEN} > application/vsm/.token
./StartFlexDeploy.sh
```

Windows

```
cd %FLEXDEPLOY_HOME%
# this will be automatically updated within a FlexDeploy credential (FD_INFLUXDB_ADMIN_TOKEN) on startup so FlexDeploy can connect with the influx database.
# This will be used in the next setup step.
set INFLUX_DB_TOKEN=<arbitrary value>  
echo %INFLUX_DB_TOKEN% > application\vsm\.token
StartFlexDeploy.bat
```

Once influx and tomcat servers are up, we need to run setup on the influx database.

> [!NOTE]
>
> **This setup is only executed the first time upgrading to FlexDeploy 6.0 or higher**

Linux

```
cd $FLEXDEPLOY_HOME/influxdb
INFLUX_DB_PASSWORD=<arbitrary value>
rm -rf ~/.influxdbv2
./influx setup --bucket flexbucket --token ${INFLUX_DB_TOKEN} --org flexdeploy --username=flexuser --password=${INFLUX_DB_PASSWORD} --host=http://localhost:8086 --force

# need to adjust the influx database retention policy
./influx bucket list
ID                      Name            Retention       Shard group duration    Organization ID Schema Type
8eec65b90f79c55e        _monitoring     168h0m0s        24h0m0s                 9050d0dddc192df9implicit
4d6413cbaad04850        _tasks          72h0m0s         24h0m0s                 9050d0dddc192df9implicit
a3521682726cd901        flexbucket      infinite        168h0m0s                9050d0dddc192df9implicit

# take the ID value for the flexbucket (Name) so we can update the retention policy to 104 weeks or 2 years
./influx bucket update --id a3521682726cd901 --retention 104w
```

Windows

```
cd %FLEXDEPLOY_HOME%\influxdb
set INFLUX_DB_PASSWORD=<arbitrary value>
rmdir /s <user directory>\.influxdbv2
influx setup --bucket flexbucket --token %INFLUX_DB_TOKEN% --org flexdeploy --username=flexuser --password=%INFLUX_DB_PASSWORD% --host=http://localhost:8086 --force

rem need to adjust the influx database retention policy
influx bucket list
ID                      Name            Retention       Shard group duration    Organization ID Schema Type
8eec65b90f79c55e        _monitoring     168h0m0s        24h0m0s                 9050d0dddc192df9implicit
4d6413cbaad04850        _tasks          72h0m0s         24h0m0s                 9050d0dddc192df9implicit
a3521682726cd901        flexbucket      infinite        168h0m0s                9050d0dddc192df9implicit

rem take the ID value for the flexbucket (Name) so we can update the retention policy to 104 weeks or 2 years
influx bucket update --id a3521682726cd901 --retention 104w
```

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590908443.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=29b480886d95edc1176d3c1afe7acd3c)

### Setup the config file for FlexDeploy to connect to influxdb.

Create the file \<FLEXDEPLOY\_HOME>/influxdb/config/fdinflux.config with the following contents, modifed appropriately for your install.

```
INFLUXDB_URL=http://localhost:8086
INFLUXDB_BUCKET=flexbucket
INFLUXDB_ORG=flexdeploy
```

## Step 11. Verify Ulimit and adjust if needed (Linux only)

Check your open file limits. Influx opens a large number of files to complete its work.

`ulimit -Hn`

will show the open file limit for the current user. Make sure you run it as the user who will be executing FlexDeploy and Influx.

If it is less that 65536, raise it or your influxdb log will likely grow very quickly and potentially run you out of disk space.

`sudo vi /etc/security/limits.conf`

where oracle is the user logged into the box to run FlexDeploy:

`oracle soft nofile 16384`

`oracle hard nofile 65536`

## Step 12. Start tomcat

> [!NOTE]
>
> If running FlexDeploy 6.0 or higher, do not use startup.sh as this will not start the influx database. User StartFlexDeploy.sh or StartFlexDeploy.bat.

If you did not start FlexDeploy yet (as part of Step 10), then start FlexDeploy using StartFlexDeploy.sh or StartFlexDeploy.bat.

Launch FlexDeploy in your browser - http\://\<hostname>:\<port>/flexdeploy
