From 93569f7cffa01e0f7c1b2fa8748bf20e7cf8fc49 Mon Sep 17 00:00:00 2001
From: Fabrice Gangler <fabrice.gangler@adullact.org>
Date: Tue, 10 Oct 2023 15:21:13 +0200
Subject: [PATCH] prepare release 2.13.1

---
 CHANGELOG.md                                  |  10 +-
 Documentation/API/CHANGELOG.md                |   3 +-
 .../UPGRADE_from_v2.13.0_to_v2.13.1.md        | 179 ++++++++++++++++++
 config/bootstrap.php                          |   2 +-
 4 files changed, 186 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/For_ops/UPGRADE/UPGRADE_from_v2.13.0_to_v2.13.1.md

diff --git a/CHANGELOG.md b/CHANGELOG.md
index efce863c..260b8140 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,23 +7,21 @@ et le projet suit [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
 ----------
 
-## 2.13.1_DEV     (unreleased)
-
-### Added
+## [2.13.1](https://gitlab.adullact.net/Comptoir/Comptoir-srv/tags/v2.13.1) - 2023-10-10
 
 ### Changed
 
 - [#973](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/973) Gitlab: use "main" branch instead of "master" branch
+- [#980](https://gitlab.adullact.net/Comptoir/Comptoir-srv/-/issues/980) Update SILL URL : use `code.gouv.fr/sill/` instead of `sill.etalab.gouv.fr`
 
 ### Fixed
 
-- [API 1.2.1_FIXME](Documentation/API/CHANGELOG.md)
+- [API 1.2.1](Documentation/API/CHANGELOG.md)
+  - [#980](https://gitlab.adullact.net/Comptoir/Comptoir-srv/-/issues/980) Update SILL URL : use `code.gouv.fr/sill/` instead of `sill.etalab.gouv.fr`
   - [#974](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/974) use production URLs instead of development URLs for the following properties:
     - `api_documentation -> changelog`
     - `api_documentation -> documentation`
 
-### Security
-
 
 ----------
 
diff --git a/Documentation/API/CHANGELOG.md b/Documentation/API/CHANGELOG.md
index a0fbec21..5615f6e1 100644
--- a/Documentation/API/CHANGELOG.md
+++ b/Documentation/API/CHANGELOG.md
@@ -7,10 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 --------------------------------
 
-## v1.2.1_FIXME   (unreleased)
+## v1.2.1 - 2023-10-10
 
 ### Fixed
 
+- [#980](https://gitlab.adullact.net/Comptoir/Comptoir-srv/-/issues/980) Update SILL URL : use `code.gouv.fr/sill/` instead of `sill.etalab.gouv.fr`
 - [#974](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/974) use production URLs instead of development URLs for the following properties:
   - `api_documentation -> changelog`
   - `api_documentation -> documentation`
diff --git a/Documentation/For_ops/UPGRADE/UPGRADE_from_v2.13.0_to_v2.13.1.md b/Documentation/For_ops/UPGRADE/UPGRADE_from_v2.13.0_to_v2.13.1.md
new file mode 100644
index 00000000..0f77bf3d
--- /dev/null
+++ b/Documentation/For_ops/UPGRADE/UPGRADE_from_v2.13.0_to_v2.13.1.md
@@ -0,0 +1,179 @@
+# How to upgrade from v2.13.0 to v2.13.1
+
+## 1) First backup (DB + images files)
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# First backup (DB + images files)
+/home/comptoir/Comptoir-srv/bin/COMPTOIR_export_DB_data_AND_images.sh
+/home/comptoir/Comptoir-srv/bin/COMPTOIR_export_DB_structure_only.sh
+ls -lh /home/comptoir/Comptoir-EXPORT/
+```
+
+## 2) Preloading vendor directory
+
+```bash
+# (1) use the user "comptoir"
+sudo su comptoir
+
+# Preloading vendor
+mkdir /home/comptoir/tmp_migration
+cd /home/comptoir/tmp_migration
+git clone https://gitlab.adullact.net/Comptoir/Comptoir-srv.git
+mv Comptoir-srv/ Comptoir_tmp_update_vendor
+cd Comptoir_tmp_update_vendor/
+git checkout origin/main
+git log --decorate --oneline --graph --all
+composer check-platform-reqs
+composer validate
+composer install
+```
+
+## 3) Activate maintenance site
+
+see:
+[www-maintenance-comptoir](https://gitlab.adullact.net/Adullact-prive/comptoir-prive/www-maintenance-comptoir)
+(private repository)
+
+```bash
+# (1) use your user
+
+# Activate maintenance site
+sudo a2dissite 25-https_comptoir-du-libre.org.conf
+sudo a2ensite 30-503-MAINTENANCE_https_comptoir-du-libre.org.conf
+sudo service apache2 reload
+
+    # on your computer, the following command lines
+    # must retrun an HTTP 500 response
+    curl -v https://comptoir-du-libre.org/
+    curl -v https://comptoir-du-libre.org/notFoundPage
+```
+
+## 4) Backup before migration (DB + images files + main directory)
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# Second backup (DB + images files)
+/home/comptoir/Comptoir-srv/bin/COMPTOIR_export_DB_data_AND_images.sh
+/home/comptoir/Comptoir-srv/bin/COMPTOIR_export_DB_structure_only.sh
+ls -lh /home/comptoir/Comptoir-EXPORT/
+
+# Backup main directory
+cd  /home/comptoir/
+DATE=$(date +"%Y.%m.%d_%Hh%M")
+tar -czvf "Comptoir-srv_BACKUP_${DATE}.tar.gz" Comptoir-srv
+```
+
+## 5) Update source code
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# Update source code
+cd /home/comptoir/Comptoir-srv
+rm -rvf vendor/
+git remote -v
+git remote update -p
+git checkout origin/main
+git log --decorate --oneline --graph --all
+```
+
+## 6) Update vendor directory + clean cache
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# Update vendor directory (see step 2 "Preloading vendor directory")
+cd /home/comptoir/Comptoir-srv
+rm -rvf vendor/
+mv -v ../tmp_migration/Comptoir_tmp_update_vendor/vendor ./
+
+# Clean cache
+cd /home/comptoir/Comptoir-srv
+bin/cake cache clear_all
+```
+
+## 7) Apply migration of the database (new tables, adding fields, ...)
+
+The following changes must be recorded in the [production version tracking](https://gitlab.adullact.net/Adullact-prive/comptoir-prive/Exploitation-Comptoir/-/blob/master/Suivi-versions-PROD.md) file.
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# Apply migration of the database (new tables, adding fields, ...)
+cd /home/comptoir/Comptoir-srv
+bin/cake migrations migrate
+
+# Now you can apply additional changes in SQL with pgsl
+# ---> nothing to do here for this version
+```
+
+
+## 8) Update config files
+
+The following changes must be recorded in the [production version tracking](https://gitlab.adullact.net/Adullact-prive/comptoir-prive/Exploitation-Comptoir/-/blob/master/Suivi-versions-PROD.md) file.
+
+nothing to do here for this version
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# Apply additional changes in config files
+cd /home/comptoir/Comptoir-srv
+vim config/comptoir.php # ---> nothing to do here for this version
+vim config/app.php  # ---> nothing to do here for this version
+```
+
+## 9) Enable the main website
+
+see:
+[www-maintenance-comptoir](https://gitlab.adullact.net/Adullact-prive/comptoir-prive/www-maintenance-comptoir)
+(private repository)
+
+```bash
+# (1) use your user
+
+# Enable the main website
+sudo a2dissite 30-503-MAINTENANCE_https_comptoir-du-libre.org.conf
+sudo a2ensite 25-https_comptoir-du-libre.org.conf
+sudo service apache2 reload
+
+    # on your computer, the first following command line
+    # must return an HTTP 200 response code
+    # and the second return an HTTP 404 response code.
+    curl -v https://comptoir-du-libre.org/
+    curl -v https://comptoir-du-libre.org/notFoundPage
+```
+
+## 10) Backup after upgraded
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+# Backup after upgraded (DB + images files)
+/home/comptoir/Comptoir-srv/bin/COMPTOIR_export_DB_data_AND_images.sh
+/home/comptoir/Comptoir-srv/bin/COMPTOIR_export_DB_structure_only.sh
+ls -lh /home/comptoir/Comptoir-EXPORT/
+```
+
+
+## 11) Clean up
+
+```bash
+# (1) user comptoir
+sudo su comptoir
+
+#  Clean up
+cd /home/comptoir/
+rm -rvf tmp_migration/
+rm -v Comptoir-srv_BACKUP_*.tar.gz
+```
diff --git a/config/bootstrap.php b/config/bootstrap.php
index b63898b4..0907625b 100644
--- a/config/bootstrap.php
+++ b/config/bootstrap.php
@@ -293,7 +293,7 @@ Configure::write(
 Configure::write(
     'VERSION',
     [
-        "footer" => "v2.13.1_DEV"
+        "footer" => "v2.13.1"
     ]
 );
 
-- 
GitLab