> For the complete documentation index, see [llms.txt](https://docs.workflowgen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.workflowgen.com/docker/update-management.md).

# Update Management

## Overview

This section presents how to manage WorkflowGen updates and deploy them safely in your environments.

{% hint style="warning" %}
You can use the WorkflowGen upgrade container to automatically apply files and database operations when upgrading from one version to another. For more information about the upgrade container, see the [Configuration](/docker/workflowgen-upgrade-image/upgrade-configuration.md) page in the WorkflowGen Upgrade Image section.
{% endhint %}

## Prerequisites

* Back up all of the file shares.
* Back up the database.

For more information about business continuity and disaster recovery, see the [Business Continuity and Disaster Recovery](/docker/business-continuity-and-disaster-recovery.md) section.

## Manual update

### Step 1: Execute all required actions

These actions can include moving, deleting, or adding some files in the file shares, updating some configuration in your orchestrator or configuration files, adding secrets, adding or removing services, etc. The actions are detailed in the [WorkflowGen Upgrade Guide](https://docs.advantys.com/docs/upgrade) (select the version to which you want to upgrade).

{% hint style="warning" %}
Only execute the actions that concern the files in the file shares. Any actions pertaining to files or services **in** WorkflowGen's container must be ignored. These will already be done once the new version of the image is in place. For example, don't stop the IIS service, since it's useless with a Docker container.
{% endhint %}

### Step 2: Upgrade the database

See the [Update the WorkflowGen database](https://docs.advantys.com/docs/upgrade/workflowgen-upgrade#upgrade-the-workflowgen-database) section in the [WorkflowGen Upgrade Guide](https://docs.advantys.com/docs/upgrade/) (select the version to which you want to upgrade).

If you're using the WorkflowGen database image, **after upgrading the database**, you need to update the container as well:

```diff
- FROM advantys/workflowgen-sql:9.3.0-ubuntu-18.04
+ FROM advantys/workflowgen-sql:9.3.1-ubuntu-18.04
```

{% hint style="info" %}
In the example above, `9.3.1` is the target WorkflowGen version. Replace it with the version to which you’re upgrading.
{% endhint %}

### Step 3: Custom WorkflowGen image actions

Skip this step if you don't have a custom WorkflowGen image. See the [Custom WorkflowGen Image](/docker/workflowgen-image/custom-workflowgen-image.md) section for more information.

#### Execute any actions on your image's files

If you have a custom WorkflowGen image, you have to perform the actions required for the `web.config` files if you have custom `web.config` files. Carefully read the [Update configuration files](https://docs.advantys.com/docs/upgrade/workflowgen-upgrade#update-configuration-files) section in the [WorkflowGen Upgrade Guide](https://docs.advantys.com/docs/upgrade) to see if you need to change anything in your files.

#### Update the WorkflowGen version in your Dockerfile

Your Dockerfile should be based on the WorkflowGen image (`FROM` instruction). Update the version number of the WorkflowGen image, build your image, and push it to your container registry. For example, if your version of WorkflowGen is 9.3.0 and you want to update to 9.3.1, execute the following change on the `FROM` instruction line:

```diff
- FROM advantys/workflowgen:9.3.0-win-ltsc2019
+ FROM advantys/workflowgen:9.3.1-win-ltsc2019
```

Then, build your custom WorkflowGen image:

```
Set-Location C:\Path\To\Custom\Context
docker image build `
    # ...
    -t mycorporation/workflowgen:9.3.1-win-ltsc2019 `
    # ...
    .
```

Finally, push the image to your container registry:

```
# Docker Hub is the default container registry
docker image push mycorporation/workflowgen:9.3.1-win-ltsc2019
```

### Step 4: Roll the update to your containers

{% hint style="info" %}
In production, you should use an orchestrator and therefore use the mechanism for rolling updates provided by that orchestrator.
{% endhint %}

Since containers are stateless, updating them is as simple as replacing currently running ones with the new version. To do this:

1. Pull the new version of the container.<br>
2. Remove containers with the old version.<br>
3. Run containers with the new version.

For example, if you want to update to WorkflowGen version 9.3.1:

```
# 1. Pull the new version of the container.
# For custom images, use the name of your account instead of "advantys".
docker pull advantys/workflowgen:9.3.1-win-ltsc2019

# 2. Remove the containers with the old version.
# This code loops through all containers whose name contains "wfgen"
docker container ls --format name=wfgen -q `
    | ForEach-Object { docker container rm -f $_ }

# 3. Run containers with the new version
docker container run `
    # ...
    advantys/workflowgen:9.3.1-win-ltsc2019
```

## Updating to a version with Change events

{% hint style="info" %}
Change events are available as of WorkflowGen versions 9.7.0 (v9) and 10.4.0 (v10).
{% endhint %}

### **Updating an existing pre-9.7 installation to 9.7 or later (WorkflowGen v9)**

1. Back up the persistent SQL Server database and deployment configuration.
2. Apply required intermediate database updates. Running the version 9.7 script directly assumes a fully updated version 9.6.1 database.
3. Run `Update\Databases\MsSQLServer\Update_WFG-V9-7-0.sql` once for the shared database.
4. Configure all version 9.7 web and engine service containers with mode set to Off and retention set to `365`. Leave both integrity key environment variables and the Change events key secret unset.
5. Start the matching version 9.7 containers only after the database update succeeds.
6. If you want to activate Change events, follow the [first-time activation instructions](/docker/workflowgen-image/configuration.md#activating-change-events) in the [WorkflowGen Image Configuration](/docker/workflowgen-image/configuration.md) section.

### **Updating an existing installation without Change events to 10.4 or later (WorkflowGen v10)**

1. Back up the persistent database and deployment configuration.
2. Apply all required intermediate database updates.
3. Run the version version 10.4 script for the existing provider:
   * **SQL Server:** `Update\Databases\MsSQLServer\Update_WFG-V10-4-0.sql`
   * **PostgreSQL:** `Update\Databases\PostgreSQL\Update_WFG-V10-4-0.sql`
     * For **PostgreSQL**, first follow the [schema, owner, search path, and object permission requirements](https://docs.workflowgen.com/upgrade/workflowgen-upgrade#for-versions-10.3.1-and-earlier) in the WorkflowGen Upgrade Guide. Do not assume that the WorkflowGen schema is `public`.
4. Configure all version 10.4 web and engine service containers with mode set to Off and retention set to `365`. Leave both integrity key environment variables and the Change events key secret unset.
5. Start the matching version 10.4 containers only after the database update succeeds.
6. If you want to activate Change events, follow the [first-time activation instructions](/docker/workflowgen-image/configuration.md#activating-change-events) in the [WorkflowGen Image Configuration](/docker/workflowgen-image/configuration.md) section.

Use the next case instead when the source is version 9.7 and the database contains an existing Change Events chain, including when its current mode is set to `OFF`.

### **Updating a 9.7 installation with an existing Change events chain to 10.4 or later (WorkflowGen v10)**

1. Preserve the exact existing integrity key and Change events data.
2. If the current mode is set to Standard or Full, switch it to Off. Back up the persistent SQL Server database and deployment configuration.
3. Run `Update\Databases\MsSQLServer\Update_WFG-V10-4-0.sql` once for the shared database.
4. Deploy every version 10.4 web and engine service container with the preserved key and homogeneous version 10.4 binaries.
5. After all containers have been updated, restore the previous mode. If it was Standard or Full, follow the instructions in the [Verifying Change events activation](https://docs.workflowgen.com/tech/operations#verifying-change-events-activation) section in the [WorkflowGen Technical Guide](https://docs.workflowgen.com/tech/). If it was already Off, keep the original key deployed and verify when the feature is next enabled.

{% hint style="warning" %}
Do not generate a replacement key or combine this product upgrade with a database provider migration.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.workflowgen.com/docker/update-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
