> ## 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.

# Automated upgrade (recommended)

> The FlexDeploy™ Linux Installer Guide provides system requirements, required downloads and instructions for installing or upgrading FlexDeploy and its

The FlexDeploy™ Linux Installer Guide provides system requirements, required downloads and instructions for installing or upgrading FlexDeploy and its components on Linux and Docker.

# About the automated Install/Migration tool

The ***flexdeployerinstaller.sh*** script is an automated process that reduces efforts for installing or upgrading FlexDeploy. There is a configuration file which will need to be configured for your installation, and then the installer can take over.  There are three basic modes to the installer: 1) prerequisite checking with no installation or upgrade, 2) first time installation of FlexDeploy and 3) upgrading a current installation of FlexDeploy. You choose prereqs mode with the -p argument. Upgrade or install is selected by the presence of the FlexDeploy war in the webapps folder. If you are upgrading Weblogic, use the -w argument.

The apache-tomcat-flexdeploy folder will be cleaned up with each upgrade, so it is important not to place any supporting files in the apache-tomcat-flexdeploy folder. Place them in the FLEXDEPLOY\_HOME folder or another subfolder instead. Example of such files may include the SSO configuration file, Keystore and/or Wallet files.

### Versions / Release Notes

You should always download the latest version before running another install or upgrade, see [https://support.flexagon.com](https://support.flexagon.com/) for the installer download link. See the [Installer Release Notes](https://flexagon.atlassian.net/wiki/spaces/SHAR/pages/10178494469/FlexDeploy+Installer+Release+Notes) for more information and to find the latest release.

### This automated installer will handle

* executing prerequisite checks to ensure the installation/upgrade will be successful

* downloads of FlexDeploy software and influx database software if the server has access to the Internet

* **installation** of FlexDeploy **5.7.0.12+**

* **upgrading from** version **5.1.0.0+**

* **upgrading to** FlexDeploy **5.7.0.12+**

  * **NOTE that upgrading to FlexDeploy 10.0 requires you to first upgrade to 9.0 >= 9.0.0.3.**

* backing up the current FlexDeploy installation, plugins, and optionally artifacts before upgrading

* backing up the database before upgrading (optional)

* creating or migrating the FlexDeploy database schemas

* installation or configuration of the influx database which is used for reporting and dashboard data for FlexDeploy version 6.0 and higher.

### This automated installer will not handle

* downloads of software if the server has no access to the Internet. In this case, the files need to be placed on the FlexDeploy server in locations specified by the installer

* download of security wallets

* upgrading a Kubernetes installation

* install or upgrade on Windows

## Installer arguments

### The following arguments are available to be used:

* ***-p*** run the installer in the prerequisite checking mode. There will be no installation/upgrade performed when using this flag, so it can be run anytime.  If the installer detects any issue(s), those will be reported to the logs and displayed on the screen.  The prerequisites will also be run during the installation or upgrade process and may stop the process, which is why it is recommended to run this mode until there are no issues being reported.  Each issue that is reported will have a possible resolution to the issue to assist you in resolving it.  Some of the checks are: verify file system sizes to make sure all required directories have at least the minimum amount, flexdeployinstaller\_config.txt file properties are set, java is at the right level, etc. Removing this argument will execute the install/upgrade.

* -***v version*** Tells the installer what version to install. You can specify ***versions as 4 numbers separated by periods***, or the word ***latest***. **(Required argument)**

  * See [http://support.flexagon.com](http://support.flexagon.com) or [http://wiki.flexagon.com](http://wiki.flexagon.com) to find details on latest or specific version. Few examples of specific versions are 8.0.0.1, 8.0.0.4 etc.

  * If you are planning to upgrade or install more than one FlexDeploy instances, then make sure to use specific version instead of word latest as meaning of latest will change over time.

* ***-c \<path to>/flexdeployinstaller\_config.txt*** points the installer to the flexdeployinstaller\_config.txt file that contains the user configurations. **(Required argument)**

* ***-s*** there are several passwords in the flexdeployinstaller\_config.txt file and if a password field is left blank, in this scenario, a prompt for the password will happen (nothing will be stored) and the password is not shown on the screen, similar to other Linux password prompts.  The ***-s*** option will show the password on the screen as you type.

* ***-i*** skip the database backup. This can be done if you have an existing database backup.

* ***-a*** skip the artifacts backup. This can be done if you have an existing backup of the artifacts folder or a snapshot of the VM.

* ***-d*** Install as a docker container.

* ***-w*** Specify that you are upgrading from a WebLogic install to a Tomcat install. Not compatible with the ***-d*** option.

# Step by Step Guide to Using the installer

## Step 0: System Requirements

See [FlexDeploy System Requirements](https://flexagon.atlassian.net/wiki/spaces/FD80/pages/10561717689/FlexDeploy+System+Requirements) for details on software and hardware requirements. See [FlexDeploy Architecture](https://flexagon.atlassian.net/wiki/spaces/FD80/pages/10561717839/FlexDeploy+Architecture) for architecture details.

## Step 1: Database Preparation (Installation Only)

### Oracle

Install the Oracle Database binaries and find your jdbc connection string. The automated installer will create FD, FF, and FD\_ADMIN schemas in the USERS tablespace.

### PostgreSQL

Install the PostgreSQL binaries, and create a flexdeploy database. The automated installer will do the rest.

***Either*** from the command line (you will need user that has createdb role, this step is done manually by database admin)

```
createdb flexdeploy
```

**or** if you have sql access to the PostgreSQL database, you can connect to the database and use sql.

```
create database flexdeploy;
```

## Step 2: Get the Installer

You should always download the latest version before running another install or upgrade, see [https://support.flexagon.com](https://support.flexagon.com/) for the installer download link. Download flexdeployinstaller.zip and get it to the FlexDeploy server. You can **wget** it there directly if you have Internet access, or transfer the file from another machine. FLEXDEPLOY\_INSTALLER\_HOME is folder where installer will be used for installer binaries and configuration files.

```
# select folder location where installer will be downloaded and executed from
 export FLEXDEPLOY_INSTALLER_HOME=/u01/fdinstaller
mkdir -p $FLEXDEPLOY_INSTALLER_HOME
cd $FLEXDEPLOY_INSTALLER_HOME
# delete older version of installer folders - for example, flexdeployinstaller_1.0.4 (rm -r flexdeployinstaller_1*)
wget -O flexdeployinstaller.zip <cssinstaller download url>
```

If you don’t have wget, and must use curl, use the -L argument like:

```
curl -L --max-redirs 5 <cssinstaller download url> --output flexdeployinstaller.zip
```

Once downloaded, unzip the flexdeployinstaller.zip download in FLEXDEPLOY\_INSTALLER\_HOME.

```
cd $FLEXDEPLOY_INSTALLER_HOME
unzip flexdeployinstaller.zip
```

## Step 3: Setup the Configuration File

### Step 3.1: Save flexdeployinstaller\_config.txt

This step is extremely important to preserve your configuration file from any potential installer upgrades. This step should only be done once: on a new installation or on a first time upgrade with this new process. Once you have this file, you can use it and modify as necessary.

There is a configuration file (*flexdeployinstaller\_config.txt*) that controls the actions of the installer.  It is the most important file for the installer and needs to be saved for current and any future executions. There is a template file located in installer download, (for example \$FLEXDEPLOY\_INSTALLER\_HOME/flexdeployinstaller\_1.0.5).  This template file must be copied and modified.

```
cd $FLEXDEPLOY_INSTALLER_HOME/flexdeployinstaller_X.X.X
cp flexdeployinstaller_config.txt ../  # this is one option to save but this can be saved to any other location.
```

### Step 3.2: Updating flexdeployinstaller\_config.txt

> [!NOTE]
>
> Spaces are not supported in any directory and/or password values.

> [!NOTE]
>
> This step should only need to be done once, on a new installation or on a first time upgrade with this new process. Unless there is a change to any of the configuration properties.

Once copied, the file needs to be adjusted for your installation requirements (there are many default values in the file and they can stay defaulted).  There are comments in the template file for each property but this guide will cover the properties that need to be updated.

> [!NOTE]
>
> FLEXDEPLOY\_HOME is a key property, make sure the directory location is correct (e.g. the FLEXDEPLOY\_HOME would be the path up to, but not including, the apache-tomcat-flexdeploy directory. /u01/flexdeploy/apache-tomcat-flexdeploy would have a FLEXDEPLOY\_HOME of /u01/flexdeploy.

<table><colgroup><col /><col /><col /></colgroup><tbody><tr><th>**Configuration Property**</th><th>**Required**</th><th>**Description**</th></tr><tr><td>FLEXDEPLOY\_HOME</td><td>Yes</td><td>This is the directory location where FlexDeploy will be installed or is already installed, the default is /u01/flexdeploy.</td></tr><tr><td>FLEXDEPLOY\_JAVA\_HOME</td><td>Yes</td><td>**If you have a symlink for Java, please use that for this value. Otherwise, each time that you upgrade Java, FlexDeploy will not be able to reference it correctly. If you upgrade Java, make sure that the cacerts are updated appropriately.**The JAVA\_HOME that you reference will be stored in the setenvoverride.sh file and used for FlexDeploy.This is the path to the appropriate Java JDK for FlexDeploy. It should be the path up to, but not including bin.Note that for FlexDeploy \< 9.0 this is JDK 8, and for FlexDeploy 9.0+, this is Java 11 or 17.</td></tr><tr><td>WORKING\_DIRECTORY</td><td>NoDefaults to $\{FLEXDEPLOY_HOME\}/application</p></td><td data-local-id="5a28889e-fd5b-4d20-9283-ae1430dd2f68" class="confluenceTd"><p local-id="c1d1b59d-6557-42c9-a1d9-78d3774b9eb1">This will be the directory location that FlexDeploy uses for temporary files to be transferred between the server and its endpoints.&nbsp; The default location is under FLEXDEPLOY_HOME and is named application.</p></td></tr><tr data-local-id="3b2316a0-3222-4bbb-aea3-fd91657d28ce"><td data-local-id="3c0ba918-a6c8-49b2-ae55-b1c5133e1ce0" class="confluenceTd"><p local-id="d8cf4bce-5dc4-46d8-8b8a-fc77e1145734">ARTIFACT_REPOSITORY_DIRECTORY</p></td><td data-local-id="f3d4720b-7059-4675-866f-6a61ad32ec3a" class="confluenceTd"><p local-id="7646fe7c-ff0c-44ba-be5a-073ea1aec747">No</p><p local-id="0ce3845c-2cf9-4695-bae6-9d9c6d3721ea">Defaults to $\{FLEXDEPLOY\_HOME}/artifacts</td><td>this will be the directory location that FlexDeploy uses to store all build artifacts and retrieve deployment artifacts. The default location is under FLEXDEPLOY\_HOME and is named artifacts.</td></tr><tr><td>BACKUP\_DATABASE\_DIRECTORY</td><td>No</td><td>The directory where the database will be backed up to.This value is optional.If Oracle, this directory must already exist within the DBA\_DIRECTORIES table and the DIRECTORY\_PATH for the entry must exist on the file system on the Database Server.If Oracle, and BACKUP\_DATABASE\_DIRECTORY is blank, the DEFAULT data\_pump directory is used if needed.If PostgreSQL, and BACKUP\_DATABASE\_DIRECTORY is provided, the database will be backed up to this local folder using the psql command, which must be available on this local host.If PostgreSQL, and BACKUP\_DATABASE\_DIRECTORY is blank, the database schemas will be backed up by cloning to another schema in the same database.</td></tr><tr><td>INFLUXDB\_PORT</td><td>No</td><td>InfluxDB portDefaults to 8086 if not specified.If running multiple influx servers on a single box, they must use different ports.</td></tr><tr><td>FLEXDEPLOY\_DB\_PASSWORD</td><td>No</td><td>The password for fd\_admin database user.The password will be prompted if not specified.</td></tr><tr><td>SYSTEM\_DB\_USER</td><td>Yes</td><td>Usually set to **system **for Oracle and **postgres **for PostgreSQL.This user will create and update the schema definitions</td></tr><tr><td>SYSTEM\_DB\_PASSWORD</td><td>No</td><td>The superuser / system password for the user SYSTEM\_DB\_USERThis password is required to create and update schema definitionsThe password will be prompted if not specified.</td></tr><tr><td>FLEXDEPLOY\_PORT</td><td>No</td><td>Defaults to 8000 for standard installs, 8004 for Docker installs.If you are deploying SSL this port setting will likely not be helpful other than it sets the port that is shown in the message once FlexDeploy is running.</td></tr><tr><td>MAINTAIN\_EXISTING\_CONTEXT\_FILE</td><td>NoDefaults to 1</td><td>If 0, then the installation process will use the newly downloaded context.xml file and adjust the properties accordingly.If 1, then the installation process will save the existing context.xml and replace it after the upgrade so there are no changes to it.Set to 1 if you have changes to the context.xml file that you wish to maintain such as using a password manager for your database password in context.xml.</td></tr><tr><td>MAINTAIN\_EXISTING\_SERVER\_FILE</td><td>NoDefaults to 1</td><td>If 0, then the installation process will use the newly downloaded server.xml file and adjust the properties accordingly.If 1, then the installation process will save the existing server.xml and replace it after the upgrade so there are no changes to it.If running SSL and upgrading, 1 is likely the easiest option.From very old versions, choosing 0 and then manually modifying the file may be the easiest option.</td></tr><tr><td>DATABASE\_URL</td><td>Yes</td><td>Adjust the appropriate connection string for the FlexDeploy database, Oracle or Postgres.Verify that your DATABASE\_URL line isn’t commented out (# at the beginning of the line) and that all other DATABASE\_URL lines are commented out.Several examples are listed in the config file.</td></tr><tr><td>CONTAINER\_NAME</td><td>NoOnly used for DockerDefaults to flexdeploy</td><td>If installing FlexDeploy through Docker you can set the name of the container that will be created by editing the variable below. Defaults to 'flexdeploy'</td></tr></tbody></table>

## Step 4: Download any Additional Software (conditional)

If your FlexDeploy server does not have Internet access, all software downloads noted below must be completed before you can install or upgrade. The prerequisite checks will validate if Internet access to the needed locations is available.

### Step 4.1: FlexDeploy software (conditional)

If your FlexDeploy server does not have internet access then FlexDeploy software must be downloaded from the [Flexagon Support Site](http://support.flexagon.com/) and the downloaded zip file must be saved to \$FLEXDEPLOY\_INSTALLER\_HOME/downloads/software (don't unzip).

### Step 4.2: Influx database (conditional)

If you are installing/upgrading FlexDeploy to version 6.0+ then keep reading otherwise skip to next step. If your FlexDeploy server does not have Internet access, the [software](https://dl.influxdata.com/influxdb/releases/v2.7.12/influxdb2-2.7.12_linux_amd64.tar.gz) and the [client](https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz) must be downloaded and gzip files must be saved to \$FLEXDEPLOY\_INSTALLER\_HOME/downloads/influxdb (don't extract them).

## Step 5: Check the Prerequisites

### Step 5.1: Execution

Next step is to run prerequisite checks before running install/upgrade. The prerequisite checking process is designed to be run multiple times until all reported issues are resolved. Any issue that is found will be displayed on the screen in the form of the issue and the potential resolution.

Run the installer as the user that you want to own and execute the FlexDeploy process.

```
cd ${FLEXDEPLOY_INSTALLER_HOME}/flexdeployinstaller_X.X.X
./flexdeployinstaller.sh -p -v <FlexDeploy version - example:  7.0.0.3> -c <path to saved config file>/flexdeployinstaller_config.txt
```

> [!WARNING]
>
> 08/26/2022 12:01:20 PM Error occurred
>
> \############################### ISSUE 105 ##########################################################\
> ISSUE: The FLEXDEPLOY\_JAVA\_HOME configuration property is not set. This must be set and\
> must meet the FlexDeploy requirements of at least 1.8 but not greater than 1.8 for FlexDeploy \< 9.0.
>
> For FlexDeploy 9.0, it must be Java 11 or 17.
>
> RESOLUTION: Please update the flexdeployinstaller\_config.txt file for the installation.
>
> \####################################################################################################

### Step 5.2: Resolution

With the list of issues on the screen, and in the logs (FLEXDEPLOY\_HOME/upgrade/logs), each issue must be resolved before continuing. Each issue will provide some level of resolution that can assist in clearing up the given issue.

> [!NOTE]
>
> If there are any issues that are not resolved, the next step will fail as it will call the prerequisites also. The prerequisites need to be run on every execution but could stop the process, thus running the prerequisites independently will ensure a clean install/upgrade.

## Step 6: Complete the Installation/Upgrade

Now that we have everything validated from a prerequisite check, we can start the installer process. As stated earlier, the same process will handle the installation and any upgrade. The installer will use the flexdeployinstaller\_config.txt properties to detect if there is a current installation. Start the installer process by running the below command.

```
cd ${FLEXDEPLOY_INSTALLER_HOME}/flexdeployinstaller_X.X.X
./flexdeployinstaller.sh -v <FlexDeploy version - example:  7.0.0.3> -c <path to saved config file>/flexdeployinstaller_config.txt
```

The process will take a few minutes.

***

# Additional Information

## Continuing an Upgrade after Database Migration Failure

> [!NOTE]
>
> When executing an upgrade with the installer you may run into a failure during the Database Migration scripts. In that case you will need to **contact support and** **manually** resolve the issue that was encountered and continue the specific migration script to completion. The execution logs for the upgrade will contain information on the last successfully run SQL statement as well as the error that occurred during execution. Once the issue is resolved we will find the location of the last successful SQL statement in the migration script and execute the remaining SQL statements one by one.

Below is an example of a log file where an exception occurred while upgrading from v5.7.0.2 to v6.0.0.0. As you can see we ran into an error when creating the FD.USER\_FAVORITE table and the last successful statement was `delete FROM FD.REL_SNAPSHOT_VERSION where REQUEST_ALL_FILES='Y' AND PACKAGE_NAME IS NOT NULL`.

```
10/18/2022 14:47:19 Exception occured while executing /u01/flexdeployinstaller_1.0.1/../temp/software/database/oracle/upgrade/v5.7.0.2-to-v6.0.0.0/migration.sql
10/18/2022 14:47:19 Last successful statement executed: delete FROM FD.REL_SNAPSHOT_VERSION where REQUEST_ALL_FILES='Y' AND PACKAGE_NAME IS NOT NULL
10/18/2022 14:47:19 Script execution failed on statement: CREATE TABLE FD.USER_FAVORITE
```

After fixing the issue we encountered while creating the FD.USER\_FAVORITE table we will find the location of the last successfully executed statement in the migration script. For this specific example we can see that the last successful statement is on line 4. We will then execute the remaining SQL statements (Line 7 and beyond) one by one until all SQL statements have been executed for this migration script.

```
-- 6.0.0.0
insert into FD.FD_FLEXDEPLOY_VERSION values('6.0.0.0',null,current_date,'SYSTEM',current_date,'SYSTEM',1);

delete FROM FD.REL_SNAPSHOT_VERSION where REQUEST_ALL_FILES='Y' AND PACKAGE_NAME IS NOT NULL;

-- user fav - start
CREATE TABLE FD.USER_FAVORITE 
(
...
```

Finally, we can then attempt the upgrade again through the installer by following the [instructions](https://flexagon.atlassian.net/wiki/pages/resumedraft.action?draftId=9996533761).

## Restoring after an issue found during or after an upgrade

Sometimes it is necessary to restore if a support ticket resolution won’t be fast enough for you. In this case, you can restore using the directions [here](https://flexagon.atlassian.net/wiki/spaces/SHAR/pages/10332209187/Backup+and+Restore). The support team is always available for you for assistance with the restore as well.
