# Update Strategy

## Evergreen Approach

We recommend an Evergreen approach for SCEPman updates. This is the default approach if SCEPman has been deployed using the production channel. SCEPman uses ZIP-Deployment by pointing directly to the [SCEPman GitHub](https://github.com/scepman) and load the latest version that is released by the development team.

The production channel, along with the other available channels, are mentioned in the following guide:

{% content-ref url="../scepman-configuration/application-artifacts" %}
[application-artifacts](https://docs.scepman.com/scepman-configuration/application-artifacts)
{% endcontent-ref %}

With this approach you always get the newest features and security updates.

{% hint style="info" %}
Keep in mind that **an update only occurs, when the App Service is stopped and started again**. This is the event when the ZIP-Deployment is triggered. While the App Service does not stop and start automatically, it is restarted externally in certain events. One of those events is the [maintenance and patching of the underlying infrastructure](https://learn.microsoft.com/en-us/azure/app-service/routine-maintenance-downtime). Those happen **regularly and keep your service up-to-date**.
{% endhint %}

In a production enterprise environment, if you want to have more control over the update process you can use the Microsoft feature **Deployment Slots**.

## Deployment Slot Configuration

In case you want to have full control over the update process of SCEPman you can use the **Deployment Slots** within the Azure App Service.

{% hint style="success" %}
To get more details about the **Deployment Slots** you can visit the Microsoft docs:\
<https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots>
{% endhint %}

The following steps give you our recommended setup for a pre-release management

{% hint style="info" %}
Please keep in mind that each Deployment Slot is running on the same App Service Plan of your production App and uses the same resources.
{% endhint %}

### Pre-release slot

The idea behind the pre-release slot is to have your production App Service running with artifacts stored on your own Storage account and create a new Deployment Slot pointing to our GitHub artifacts. You can find the steps for setting up your custom artifact location in the following article:

{% content-ref url="../scepman-configuration/application-artifacts" %}
[application-artifacts](https://docs.scepman.com/scepman-configuration/application-artifacts)
{% endcontent-ref %}

Now your production App Service is running with a custom artifacts location and we proceed with the configuration of the new Deployment Slot.

{% hint style="info" %}
Deployment Slot requirements \*\*\*\* (via PS. SCEPman Module):

* SCEPman **2.2** or above
* PowerShell SCEPman-Module **1.5.1.0** or above
  {% endhint %}

The following CMDlet command will create a Deployment Slot and configure all required permissions for you.

```
New-SCEPmanDeploymentSlot -SCEPmanAppServiceName <Your SCEPman App Service Name> -DeploymentSlotName <Name For The Deploymentslot> 6>&1
```

**Example**

![](https://2535731700-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2Fgit-blob-e6d6f6705ddea62ace2056be7939000667f1be20%2F2022-06-13%2017_36_44-DeploymentSlotCommand.png?alt=media)

After the deployment is finished successfully, you can check the deployment slot in your SCEPman App Service -> **Deployment slots**

![](https://2535731700-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2Fgit-blob-dc8370a42c97d7d629bf570e79136d689eb64fa9%2F2022-06-13%2011_53_59-DeploymentSlot.png?alt=media)

Now ensure that your deployment slot points to SCEPman Production channel on GitHub:

Navigate to the **Deployment Slot** -> **Environment variables** and look for the setting **WEBSITE\_RUN\_FROM\_PACKAGE** and past the [production channel artifacts](https://docs.scepman.com/scepman-configuration/application-artifacts#production) to the value.

<figure><img src="https://2535731700-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FhWunHIoJy8uhT2T5S6Mq%2Fimage.png?alt=media&#x26;token=4430a03c-7728-4ed5-9207-e711a279996e" alt=""><figcaption></figcaption></figure>

If you go back to your primary **App Service** and navigate to **Deployment Slots y**ou can see your two slots and can manage the **Traffic %** to root the defined among of request to the new **pre-release** slot.\
Important that this traffic rooting is completely transparent for the application and handled by the App Service. We recommend setting the **Traffic %** to **20**. After that, you can compare the two slots in **Application Insights**. In case we are releasing an updated version to our GitHub, you only must restart the **pre-release** slot and after that, you can compare the two different versions in **Application Insights**. After one week or your choice of time, you can upload the new GitHub artifacts to your custom artifacts location and have updated the SCEPman solution.
