From 97b80cc89c1d9059dd87558f70616849b41d2fc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20PAILHAREY?= <rpailharey@grandlyon.com>
Date: Wed, 8 Feb 2023 08:52:40 +0000
Subject: [PATCH] docs: updated handle assets

---
 .vscode/settings.json                         |  1 +
 docs/ecolyo-agent/technical/api_routes.md     |  2 +-
 docs/ecolyo-agent/technical/backup.md         |  2 +-
 docs/ecolyo-agent/technical/deploy.md         |  2 -
 .../ecolyo-agent/technical/getting_started.md |  6 +--
 docs/ecolyo-agent/technical/handle_assets.md  | 37 +++++++++++++++----
 6 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index 4280153..3ed2d48 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -43,6 +43,7 @@
     "nginx",
     "noreply",
     "numerique",
+    "Openshift",
     "Scaleway",
     "timestep",
     "usageevent"
diff --git a/docs/ecolyo-agent/technical/api_routes.md b/docs/ecolyo-agent/technical/api_routes.md
index f37b0e2..1079ce8 100644
--- a/docs/ecolyo-agent/technical/api_routes.md
+++ b/docs/ecolyo-agent/technical/api_routes.md
@@ -3,4 +3,4 @@
 :warning: WIP :warning:
 
 The different routes exposed by the backend are described by Swagger documentation.
-Once the api deployed, the documentation is accessible at https://HOSTNAME/swagger/index.html
\ No newline at end of file
+Once the api deployed, the documentation is accessible at https://HOSTNAME/swagger/index.html
diff --git a/docs/ecolyo-agent/technical/backup.md b/docs/ecolyo-agent/technical/backup.md
index beb421c..4114bd8 100644
--- a/docs/ecolyo-agent/technical/backup.md
+++ b/docs/ecolyo-agent/technical/backup.md
@@ -8,7 +8,7 @@ It is running a crontab that execute the backup.sh script every day at midnight.
 
 The dump of the database are stored in folders name like this : "ecolyo-agent-YEAR-MONTH-DAY-HOUR-MINUTE-SECOND". Only the 14 last days are stored.
 
-The location of the backup folder on the server is specified in the volumes of the "database-backup" service, in the docker-compose file. 
+The location of the backup folder on the server is specified in the volumes of the "database-backup" service, in the docker-compose file.
 
 ## Backup manually
 
diff --git a/docs/ecolyo-agent/technical/deploy.md b/docs/ecolyo-agent/technical/deploy.md
index 3b92c7c..d121e00 100644
--- a/docs/ecolyo-agent/technical/deploy.md
+++ b/docs/ecolyo-agent/technical/deploy.md
@@ -1,5 +1,3 @@
 # Deploy Ecolyo-Agent application
 
 This app is deployed on an Openshift cluster provided by Synaaps, all instructions for authentification and deployment are given [here](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-server/-/blob/dev/k8s/README.md)
-
-
diff --git a/docs/ecolyo-agent/technical/getting_started.md b/docs/ecolyo-agent/technical/getting_started.md
index 909b44c..a9b5400 100644
--- a/docs/ecolyo-agent/technical/getting_started.md
+++ b/docs/ecolyo-agent/technical/getting_started.md
@@ -43,7 +43,7 @@ To stop it properly use
 yarn local-down
 ```
 
-This app runs in https, such as the backend, to access it go on https://localhost/
+This app runs in https, such as the backend, to access it go on <https://localhost/>
 Also make sure you have HTTPS env variable set to true.
 Do not use the app with the port 3000, you won't be able to login.
 
@@ -76,9 +76,9 @@ You should obtain the following messages:
 
 > --- Server is starting ---  
 > Token signing key set  
-> Mock OAuth2 server Listening on: http://localhost:8090  
+> Mock OAuth2 server Listening on: <http://localhost:8090>  
 
-Once the application is started, you can access it here: [localhost](https://localhost)
+Once the application is started, you can access it at <https://localhost>
 
 ## Alpha usage
 
diff --git a/docs/ecolyo-agent/technical/handle_assets.md b/docs/ecolyo-agent/technical/handle_assets.md
index 42e343d..f17b310 100644
--- a/docs/ecolyo-agent/technical/handle_assets.md
+++ b/docs/ecolyo-agent/technical/handle_assets.md
@@ -1,15 +1,38 @@
-# Handle assets
+# Handle email assets
 
 This section will allow you to import the assets used in the newsletter from Ecolyo
 
 ## Import assets
 
-In the rec or prod server, in the folder `scripts`, there is the following script, named [`import-convert-assets.sh`](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-client/-/blob/dev/scripts/import-convert-assets.sh).
+When email or ecogesture assets changes in Ecolyo project, you need to update them in the backoffice's server.
 
-To import assets for the ecogesture images, run it
+### Convert the assets
 
-```sh
-sudo sh import-convert-assets.sh
-```
+This step is needed to convert some svg files and all ecogestures.
 
-Check that a "image-lib" folder has been created, that it contains a "ecogesture" folder and some PNG images and that the owner of the "image-lib" folder is the user id 1000.
+- Go to the backoffice server [pipelines page](https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-server/-/pipelines/new).
+- Run a new pipeline for **master** branch.
+
+!!! note "Optional"
+
+    You can specify from which Ecolyo branch you would like to get assets by overwriting _ECOLYO_ASSETS_BRANCH_ variable with a branch name (ex: 123-new-feature).
+
+- Launch manually the job **import-convert-assets**
+
+Once the job is finished, an artifact containing the required assets is created on GitLab.
+
+### Import the assets on OpenShift
+
+- Connect to the Openshift console
+- Select the correct project (REC or PROD)
+- Connect to the terminal of ecolyo-agent-server
+- Go to the volume folder `cd /app/mnt`
+- Import assets generated previously
+
+`curl --header "PRIVATE-TOKEN:<BACKOFFICE-API-TOKEN>" https://forge.grandlyon.com/api/v4/projects/621/jobs/artifacts/master/download?job=import-convert-assets --output image-lib.zip`
+
+>This command fetches the latest artifact for the **import-convert-assets** job
+
+- Extract and overwrite current assets `unzip -o image-lib.zip`
+
+If everything is successful you can go to <https://ecolyo-agent-rec.apps.com/assets/> or <https://ecolyo-agent.apps.com/assets/> to check your updated images.
-- 
GitLab