# v5 Server Pre-Flight Upgrade Check

The Polarity v5 Pre-Flight Check Tool will generate a report to help the Polarity Customer Success team plan your v5 upgrade. The tool will generate a report that includes:

* Analyst Telemetry Check
* Authentication Scheme Check
* Auto-Updates Check
* Config.js TLS Options Check
* Global Proxy Check
* Integrations Check
* Elastic/Splunk RPM Agent Check
* Node Extra CA Certs Check
* Operating System Check
* PostgreSQL SSL mode Check
* Polarity Version Check
* Redis Env Var Check
* SMTP Check
* RPM Requirements Check
* SSL Certificate Check
* <mark style="color:blue;">Polarity User Creation Check</mark>
* <mark style="color:blue;">Polarity CLI Integration Search Tool Check</mark>
* <mark style="color:blue;">Polarity Integration Auto Subscribe Check</mark>
* <mark style="color:blue;">Polarity CSV Loader Check</mark>
* <mark style="color:blue;">Polarity Annotation Manager Check</mark>

{% hint style="info" %}
The <mark style="color:blue;">Polarity Annotation Manager Check</mark>, <mark style="color:blue;">Polarity CSV Loader Check</mark>, <mark style="color:blue;">Polarity Integration Auto Subscribe Check</mark>, <mark style="color:blue;">Polarity User Creation Check</mark>, and <mark style="color:blue;">Polarity CLI Integration Search Tool Check</mark> can take several minutes each to complete depending on the number of files on your system as these checks search for installs of these these various CLI tools.
{% endhint %}

{% hint style="info" %}
When running the Integrations check you may see an error for certain integrations if they are not running properly.  The tool will still record important information in this scenario about the integration despite the error being printed to the terminal.
{% endhint %}

## Usage

### Installation

This CLI tool is built on NodeJS and should be run on your Polarity Server.  Once complete the script will generate an upgrade report called `polarity-upgrade-report.txt`. You will need a NodeJS runtime > v12.&#x20;

To begin, download the tool, and untar it.

```
wget https://dl.polarity.io/C7BFBB1CF5A58C7DBA57CD0941F635BF1895366064713E88DAA7F05A5295B8B1/PROD/server/scripts/polarity-v5-preflight-check-tool-3.2.1.tgz
```

Check the SHA256:

```
sha256sum polarity-v5-preflight-check-tool-3.2.1.tgz
b4726b6be7cf120db48f77d8187630e177727c615fe93832529651f40c9ca427 polarity-v5-preflight-check-tool-3.2.0.tgz
```

Untar the tool and change into the directory:

```
tar -xvzf polarity-v5-preflight-check-tool-3.2.1.tgz
cd polarity-v5-preflight-check-tool
```

To run the CLI tool ensure the `polarity-integration-auto-subscribe.sh` script is executable.

```
chmod a+x polarity-v5-preflight-check-tool.sh
```

You can now run the CLI tool and pass in the required options. Here is an example with the minimum required options.  As tool connects to your Polarity Server over the REST API, you will be prompted for a   a valid **local** Polarity **admin** username and password.  The tool will connect to localhost by default which requires the `--rejectUnauthorized=false` option to be set.

```
sudo ./polarity-v5-preflight-check-tool.sh  --rejectUnauthorized=false
```

{% hint style="info" %}
Ensure the user credentials you provide are for an admin user so that the tool is able to gather the required upgrade information.  The provided credentials must be for a local admin account and not an LDAP or SAML account.
{% endhint %}

This command will generate a report file called `polarity-upgrade-report.txt`.  Please copy this file and provide it to your Polarity Customer Success representative.

### All Options

```
Generate a v5 preflight upgrade report

Options:
  --help                Show help  [boolean]
  --version             Show version number  [boolean]
  --url                 Polarity server url to include schema  [string] [default: "https://localhost"]
  --config              Path to the Polarity Server's config file.  [string] [default: "/app/polarity-server/config/config.js"]
  --env                 Path to the Polarity Server's .env file.  [string] [default: "/app/polarity-server/.env"]
  --polarityPath        Path to the Polarity Server Directory  [string] [default: "/app/polarity-server"]
  --rejectUnauthorized  If provided, the loader will reject unauthorized SSL connections  [boolean] [default: true]
  --proxy               If provided, the connection to the Polarity server will use the provided proxy setting  [string] [default: ""]
  --logging             The logging level for the script.  [string] [choices: "simple", "error", "warn", "info", "debug", "trace"] [default: "simple"]
```

### Troubleshooting

You may see a "self signed certificate" error right after providing your Polarity admin credentials like this:

```
Error running preflight check tool.  {
  detail: 'HTTP Request Error',
  err: {
    stack: 'Error: self signed certificate\n' +
      '    at TLSSocket.onConnectSecure (_tls_wrap.js:1502:34)\n' +
      '    at TLSSocket.emit (events.js:314:20)\n' +
      '    at TLSSocket._finishInit (_tls_wrap.js:937:8)\n' +
      '    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:711:12)',
    message: 'self signed certificate',
    code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
  },
  response: undefined
}
```

This error means the SSL certificate was not trusted (this will happen if you use the default `https://localhost` url to connect locally, or if the SSL certificate on your Polarity Server is self signed).  You can easily work around this issue by providing the `--rejectUnauthorized=false` option:

```
sudo ./polarity-v5-preflight-check-tool.sh  --rejectUnauthorized=false
```


---

# 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.polarity.io/polarity-admin-guide/GGQxi8U7L785oCyu5JjE/guides/v5-server-pre-flight-upgrade-check.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.
