Commit 04cd3b0b authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Ajout de la colonne V_SYGAL_DOCTORANT_V2.code_apprenant_in_source contenant le...

Ajout de la colonne V_SYGAL_DOCTORANT_V2.code_apprenant_in_source contenant le numéro étudiant (API V3)
parent ef1226c7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
Journal des modifications
=========================

3.0.0
-----
- Passage à PHP 8.0.
- Ajout d'une V3 à l'API ; les V1 et V2 demeurent.
- Ajout de la colonne V_SYGAL_DOCTORANT_V2.code_apprenant_in_source contenant le numéro étudiant (API V3).

2.3.0
-----
- Correction du mapping de l'entité Doctorant.
+9 −7
Original line number Diff line number Diff line
@@ -13,25 +13,27 @@ Docker
- Obtention de l'image de base Unicaen (construite) à jour

```bash
PHP_VERSION=7.4 ;
PHP_VERSION=8.0 \
docker pull registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache
```

- Construction de l'image du web service

```bash
PHP_VERSION=8.0 \
docker build \
--build-arg HTTP_PROXY \
--build-arg HTTPS_PROXY \
--build-arg NO_PROXY \
--build-arg PHP_VERSION \
-t sygal-import-ws-image-php${PHP_VERSION} .
-t sygal-import-ws-image-php${PHP_VERSION} \
.
```

- Lancement du web service

```bash
docker-compose up
docker-compose up sygal-import-ws
```


@@ -47,10 +49,10 @@ Lancement du web service *pour le dévelopement*
Se placer à la racine des sources du ws pour lancer la commande suivante :

```bash
docker-compose up --build
docker-compose up --build sygal-import-ws
```

Vérifier que le container `sygal-import-ws-container` figure bien dans la liste des containers
Vérifier que le container `sygal-import-ws-container-php8.0` figure bien dans la liste des containers
lancés listés par la commande suivante (cf. colonne `NAMES`) :

```bash
@@ -119,9 +121,9 @@ Afin d'obtenir les informations spécifiques à une donnée, il est possible d'a
curl --insecure --header "Accept: application/json" --header "Authorization: Basic xxxx" https://localhost:8443/v2/variable/ETB_LIB_NOM_RESP
```

Pour mettre en forme le JSON retourné et faciliter la lecture, une solution est d'utiliser `python -m json.tool`:
Pour mettre en forme le JSON retourné et faciliter la lecture, une solution est d'utiliser `python`:
```bash
curl --insecure --header "Accept: application/json" --header "Authorization: Basic xxxx" https://localhost:8443/v2/variable | python -m json.tool
curl --insecure --header "Accept: application/json" --header "Authorization: Basic xxxx" https://localhost:8443/v2/variable | python3 -m json.tool
```


+34 −0
Original line number Diff line number Diff line
----------------------------------------------------------
-- Apogée : modification de vues/tables pour l'API V3.
----------------------------------------------------------

--
-- NB : Seules les vues/tables modifiées existent en version "V3" (ex: V_SYGAL_DOCTORANT_V3).
--      Les vues/tables inchangées restent en version "V2".
--

create or replace view V_SYGAL_DOCTORANT_V3 as
    select distinct
        ind.cod_etu as source_code, -- Identifiant unique
        'apogee' as source_id, -- identifiant unique de la source
        ind.cod_etu as id, -- Identifiant du doctorant
        ind.cod_etu as individu_id, -- Identifiant de l'individu
        ind.cod_nne_ind||ind.cod_cle_nne_ind as ine, -- INE du doctorant
        ind.cod_etu as code_apprenant_in_source -- Numero étudiant Apogée <<<<<<<<<<<<< nouvelle colonne
    from these_hdr_sout ths
             join diplome        dip on dip.cod_dip     = ths.cod_dip
             join typ_diplome    tpd on tpd.cod_tpd_etb = dip.cod_tpd_etb
             join individu       ind on ind.cod_ind     = ths.cod_ind --and ind.cod_etu != 21009539 -- Exclusion du compte de test Aaron AAABA
             join pays           pay on pay.cod_pay     = ind.cod_pay_nat
    where ths.cod_ths_trv =  '1' -- Exclusion des travaux
      and dip.cod_tpd_etb in ('39', '40')
      and tpd.eta_ths_hdr_drt = 'T' -- Inscription en these
      and tpd.tem_sante = 'N' -- Exclusion des theses d exercice
      and cod_etu is not null
;



--drop table SYGAL_DOCTORANT_V3;
create table SYGAL_DOCTORANT_V3 as select * from V_SYGAL_DOCTORANT_V3;
alter table SYGAL_DOCTORANT_V3 add source_insert_date date default sysdate;
+25 −0
Original line number Diff line number Diff line
----------------------------------------------------------
-- Physalis : modification de vues/tables pour l'API V3.
----------------------------------------------------------

--
-- NB : Seules les vues/tables modifiées existent en version "V3" (ex: V_SYGAL_DOCTORANT_V3).
--      Les vues/tables inchangées restent en version "V2".
--

CREATE or replace VIEW "API_SCOLARITE"."V_SYGAL_DOCTORANT_V3" ("ID", "SOURCE_CODE", "SOURCE_ID", "INDIVIDU_ID", "INE", "CODE_APPRENANT_IN_SOURCE") AS
select
    i.pers_id  as ID ,
    i.pers_id  as SOURCE_CODE ,
    'physalis' as SOURCE_ID,
    i.pers_id as INDIVIDU_ID ,
    e.ETUD_CODE_INE as ine,
    e.ETUD_NUMERO as CODE_APPRENANT_IN_SOURCE
from RECHERCHE.DOCTORANT d left outer join grhum.INDIVIDU_ULR i on d.no_individu= i.no_individu
                           left outer join grhum.etudiant e on d.ETUD_NUMERO =  e.ETUD_NUMERO;



--drop table "API_SCOLARITE".SYGAL_DOCTORANT_V3;
create table "API_SCOLARITE".SYGAL_DOCTORANT_V3 as select * from "API_SCOLARITE".V_SYGAL_DOCTORANT_V3;
alter table "API_SCOLARITE".SYGAL_DOCTORANT_V3 add source_insert_date date default sysdate;
+69 −0
Original line number Diff line number Diff line
Version 3.0.0
=============

Base de données
---------------

### Apogée
Cf. [3.0.0/apogee.sql](3.0.0/apogee.sql).

### Physalis
Cf. [3.0.0/physalis.sql](3.0.0/physalis.sql).


Serveur d'application
---------------------

- Sur le serveur d'application, vous devez installer PHP 8.0. Voici un exemple, à adapter à votre situation :

```bash
export PHP_VERSION="8.0"
export APACHE_CONF_DIR=/etc/apache2
export PHP_CONF_DIR=/etc/php/${PHP_VERSION}
export OCI8_PACKAGE=oci-3.0.1
pear config-set http_proxy "$http_proxy"

cd /tmp
wget https://packages.sury.org/php/apt.gpg
sudo apt-key add apt.gpg
sudo apt update
sudo apt upgrade

sudo -E apt install -y apache2 ca-certificates curl ghostscript ghostscript-x git ldap-utils libaio1 libcurl4-openssl-dev libfreetype6-dev libicu-dev libjpeg62-turbo-dev libldap2-dev libmcrypt-dev libmemcached-dev libssl-dev libxml2-dev make memcached libmemcached-tools netcat-openbsd php-pear php${PHP_VERSION} php${PHP_VERSION}-bcmath php${PHP_VERSION}-curl php${PHP_VERSION}-dev php${PHP_VERSION}-fpm php${PHP_VERSION}-gd php${PHP_VERSION}-gettext php${PHP_VERSION}-iconv php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-ldap php${PHP_VERSION}-mbstring php${PHP_VERSION}-memcached php${PHP_VERSION}-mysql php${PHP_VERSION}-opcache php${PHP_VERSION}-pgsql php${PHP_VERSION}-soap php${PHP_VERSION}-xml php${PHP_VERSION}-zip php${PHP_VERSION}-cli php${PHP_VERSION}-common php${PHP_VERSION}-opcache php${PHP_VERSION}-readline ssh ssl-cert subversion unzip vim wget zlib1g-dev
sudo pecl install xdebug-3.2.2 && sh -c "echo 'zend_extension=xdebug.so' > /etc/php/${PHP_VERSION}/cli/conf.d/20-xdebug.ini" && sudo sh -c "echo 'zend_extension=xdebug.so' > /etc/php/${PHP_VERSION}/fpm/conf.d/20-xdebug.ini"
sudo update-alternatives --set php /usr/bin/php${PHP_VERSION}
sudo a2enmod proxy_fcgi setenvif
sudo a2disconf php7.4-fpm
sudo a2enconf php8.0-fpm
sudo service php7.4-fpm stop
sudo service php8.0-fpm start
sudo service apache2 restart

sudo pecl uninstall oci8
cd /tmp
wget https://git.unicaen.fr/open-source/docker/sygal-import-ws-image/-/blob/master/resources/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip?ref_type=heads
wget https://git.unicaen.fr/open-source/docker/sygal-import-ws-image/-/blob/master/resources/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip?ref_type=heads
wget https://git.unicaen.fr/open-source/docker/sygal-import-ws-image/-/blob/master/resources/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip?ref_type=heads
sudo unzip -o /tmp/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && sudo unzip -o /tmp/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && sudo unzip -o /tmp/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && 
sudo unzip -o /tmp/instantclient-basiclite-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && sudo unzip -o /tmp/instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/ && sudo unzip -o /tmp/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip -d /usr/local/
sudo ln -sf /usr/local/instantclient_18_5 /usr/local/instantclient && sudo ln -sf /usr/local/instantclient/sqlplus /usr/bin/sqlplus
sudo echo 'instantclient,/usr/local/instantclient' | sudo pecl install ${OCI8_PACKAGE}
sudo sh -c "echo 'extension=oci8.so' > ${PHP_CONF_DIR}/fpm/conf.d/30-php-oci8.ini" && sudo sh -c "echo 'extension=oci8.so' > ${PHP_CONF_DIR}/cli/conf.d/30-php-oci8.ini" && sudo sh -c "echo '/usr/local/instantclient' > /etc/ld.so.conf.d/oracle-instantclient.conf" && sudo ldconfig
sudo service php8.0-fpm reload

cd /var/www/sygal-import-ws
composer install
rm -rf data/cache/*
/usr/bin/php ./public/index.php update-service-tables --verbose
```

- Sur le serveur d'application, placez-vous dans le répertoire du web service (sans doute `/var/www/sygal-import-ws`)
  puis lancez les commandes suivantes pour installer la nouvelle version :
```bash
git fetch && git fetch --tags && git checkout --force 3.0.0 && rm -rf vendor/* && bash install.sh
```

- Lancer la mise à jour des tables hébergeant les données importables (cela prend 1 ou 2 minutes) :
```bash
/usr/bin/php ./public/index.php update-service-tables --verbose
```
Loading