# Production deployments

## Description

For each **customer**, a <span style="text-decoration: underline;">procedure</span> must be implemented to manage <span style="text-decoration: underline;">deployments</span> made in the customer's **production environments**, which may be the following:

- Production environments
- TEST/PRE environments that customers consider productive
- Soffid Cloud TEST environments that use data from the customer's production environments.

This procedure includes several steps which, in summary, consist of <span style="text-decoration: underline;">agreeing the deployment with the customer</span>, <span style="text-decoration: underline;">notifying them</span>, and <span style="text-decoration: underline;">recording it</span>.

We will also have to carry out the procedure for customers managed by a **partner** who <span style="text-decoration: underline;">delegates the operation</span> to us. For customers managed exclusively by the partner, they will carry out the operations based on their own procedures.

## Prerequisites

Changes must have been <span style="text-decoration: underline;">implemented and validated</span> in a TEST, DES, or local environment.

Changes must have been <span style="text-decoration: underline;">validated with the customer</span>, or the customer must accept the risks of not having validated them.

<span style="text-decoration: underline;">Agree with the customer</span> and/or partner on the **optimal time to carry out the deployment**, taking into account the following restrictions:

- Do not perform a deployment the day before a non-working day, on a Friday, or the day before a public holiday.
- Do not perform a deployment the day before the start of a vacation.

<span style="text-decoration: underline;">Identify the relevant parties</span> to notify of the deployment:

- Soffid project team
- Soffid support team
- Partners (if applicable)
- Customer managers (including helpdesk contacts, if applicable)

<span style="text-decoration: underline;">Prepare a guide and all necessary components</span> to perform a **rollback** in case of unexpected problems.

For tasks where we have modified code in a GitLab project, once it has been validated in the test environments, the code must be <span style="text-decoration: underline;">committed and pushed</span> and <span style="text-decoration: underline;">validated with the release of the last artifact generated</span>, which will be the one we deploy in the production environment.

## Procedure

<span style="text-decoration: underline;">Step 1: Deployment planning</span>

- Agree with the customer (and/or partner) on the optimal time to perform the deployment.
- Add an event to the calendar.
- Add a record change in the customer deployment log file.

<span style="text-decoration: underline;">Step 2: Notification of deployment start</span>

- Send an email using the “Start Notification” template.

<span style="text-decoration: underline;">Step 3: Performing the deployment</span>

- Put the console into maintenance mode (where necessary).
- Configure/publish/deploy all components.
- Redeploy/restart the appropriate components.
- Validate that the system is working correctly (paying particular attention to customers with AM and PAM).
- Validate (if possible) all changes applied.
- Check the monitoring of the machines to ensure that everything is still under control.
- Remove the console from maintenance mode (if necessary).

<span style="text-decoration: underline;">Step 3.2: Notification of delays</span>

- Send an email using the “Delay Notification” template.

<span style="text-decoration: underline;">Step 4: Notification of the end of deployment</span>

- Send an email using the “End Notification” template.

<span style="text-decoration: underline;">Step 5: Close the task</span>

- Update the record changes in the customer deployment log file.
- If there are Zammat tickets involved, include the deployment as a comment.
- If there are emails instead of tickets, notify the completion in the emails.

## Documentation

#### Excel spreadsheets for recording deployments  


As we will most likely need to share this document with customers or partners, there will be one document per customer.

The documents will be created in the folder: **[Drive &gt; Unidades compartidas &gt; Soffid &gt; DEPLOYMENTS](https://drive.google.com/drive/folders/1b5ud4K9XY3V-X4iUIpOUchjtjJuhiUX_?usp=drive_link)**.

The document [**TEMPLATE - Deployment log**](https://docs.google.com/spreadsheets/d/1rudGI4dkmoaiXRv21TvjzOMzL5GRUSIapFn8NVDPmdI/edit?usp=sharing) has been created as a starting point for new customers.

File names must begin with the customer's name: CUSTOMER - Deployment log


#### Email templates

Start notification:

```
Buenos tardes.

Vamos a realizar el despliegue a producción de los siguientes tickets/correos:
* ES-7412280 Tractar els ORGANISMES com si fósin un ORGÀNIC
* ES-7412104 PRODUCTES: No fa enviaments a les notificacions
* ES-7412224 roldanfm al fer baixa li apareix missatge de conservar

Los componentes a desplegar son los siguientes:
* addon-diba 3.2.11
* biblioteques programari 3.2.1
* diputació aplicacions 3.21
* diputació programari 3.2.1

Se requiere reiniciar las consoles y los syncservers.

Se estima una duración de 15 minutos.

Saludos cordiales.
```

Delay notification:

```
Buenas tardes.

La actualización se va a demorar más de lo esperado. Cuando termine el proceso enviaremos correo de notificación.

Saludos cordiales.
```

End notification:

```
Buenas tardes.

La actualización se ha completado satisfactoriamente.

Para cualquier duda o nuevo comportamiento que pueda aparecer, abra un nuevo tiket en el Portal de soporte https://zammad.soffid.com/ o contacte por teléfono al 871 96 29 12.

Saludos cordiales.
```