Comme indiquée dans la documentation de GeoNature : La mise à jour de GeoNature consiste à télécharger sa nouvelle version dans un nouveau répertoire, récupérer les fichiers de configuration et de surcouche depuis la version actuelle et de relancer l’installation dans le répertoire de la nouvelle version.
sudo systemctl stop postgresqlsudo systemctl start postgresqlmv ~/www/maintenance/geonature/maintenance.disable ~/www/maintenance/geonature/maintenance.enable
systemctl stop geonature taxhub usershub atlas
nginx_dissite geonature.conf ; nginx_ensite geonature_maintenance.conf ; service nginx reloadnginx_dissite atlas.conf ; nginx_ensite atlas_maintenance.conf ; service nginx reloadsupervisorctl stop geonature2 atlas taxhub usershub2 export GNV=$(curl -s https://api.github.com/repos/PnX-SI/GeoNature/releases/latest | grep tag_name | cut -d\" -f4) echo "${GNV}" * cd ~/dwl/ wget https://github.com/PnX-SI/GeoNature/archive/${GNV}.zip -O geonature_v${GNV}.zip unzip geonature_v${GNV}.zip -d ./mv GeoNature-${GNV} ~/www/geonature_v${GNV}cd ~/www/cd ~/www; rm -f geonature_old; ln -s geonature_v<ancienne-version> geonature_oldcd ~/; rm -f geonature_old; ln -s ~/www/geonature_old geonature_oldcd ~/; rm -f geonature; ln -s ~/www/geonature geonaturecp ~/www/geonature_old/config/settings.ini ~/www/geonature_v${GNV}/config/settings.inicp ~/www/geonature_old/config/geonature_config.toml ~/www/geonature_v${GNV}/config/geonature_config.tomlvi ~/www/geonature_v${GNV}/backend/gunicorn_start.shcd ~/www; rm -f geonature; ln -s geonature_v${GNV} geonature export UHV=$(curl -s https://api.github.com/repos/PnX-SI/UsersHub/releases/latest | grep tag_name | cut -d\" -f4) echo "${UHV}"cd ~/dwl/ wget https://github.com/PnX-SI/UsersHub/archive/${UHV}.zip -O usershub_v${UHV}.zip unzip usershub_v${UHV}.zip -d ~/www/cd ~/www/mv UsersHub-${UHV} usershub_v${UHV}cd ~/www; rm -f usershub_old; ln -s usershub_v<ancienne-version> usershub_oldcd ~/; rm -f usershub; ln -s ~/www/usershub usershubcd ~/; rm -f usershub_old; ln -s ~/www/usershub_old usershub_oldcp ~/www/usershub_old/config/settings.ini ~/www/usershub_v${UHV}/config/settings.inicp ~/www/usershub_old/config/config.py ~/www/usershub_v${UHV}/config/config.pycd ~/www; rm -f usershub; ln -s usershub_v${UHV} usershub export THV=$(curl -s https://api.github.com/repos/PnX-SI/TaxHub/releases/latest | grep tag_name | cut -d\" -f4) echo "${THV}"cd ~/dwl/ wget https://github.com/PnX-SI/TaxHub/archive/${THV}.zip -O taxhub_v${THV}.zip unzip taxhub_v${THV}.zip -d ~/www/cd ~/www/mv TaxHub-${THV} taxhub_v${THV}cd ~/www; rm -f taxhub_old; ln -s taxhub_v<ancienne-version> taxhub_oldcd ~/; rm -f taxhub; ln -s ~/www/taxhub taxhubcd ~/; rm -f taxhub_old; ln -s ~/www/taxhub_old taxhub_oldcp ~/www/taxhub_old/settings.ini ~/www/taxhub_v${THV}/settings.inicp ~/www/taxhub_old/config.py ~/www/taxhub_v${THV}/config.pycp ~/www/taxhub_old/static/app/constants.js ~/www/taxhub_v${THV}/static/app/constants.jscp -aR ~/www/taxhub_old/static/medias/ ~/www/taxhub_v${THV}/static/medias/ ''
* Vérifier l’existence de nouveaux paramètres de config :
* Dans config.py : '' diff ~/www/taxhub_old/config.py.sample ~/www/taxhub_v${THV}/config.py.sample ''
* Dans settings.ini : '' diff ~/www/taxhub_old/settings.ini.sample ~/www/taxhub_v${THV}/settings.ini.sample ''
* Dans constants.js : '' diff ~/www/taxhub_old/static/app/constants.js.sample ~/www/taxhub_v${THV}/static/app/constants.js.sample ''
* Modifier le lien symbolique pour pointer vers la nouvelle version : ''cd ~/www; rm -f taxhub; ln -s taxhub_v${THV} taxhubrsync -av -e "ssh -p <port-ssh-db>" /home/geonat/www/ geonat@db-<region>-sinp:/home/geonat/www/ssh geonat@db-<region>-sinpcd ~/; rm -f geonature_old; ln -s ~/www/geonature_old geonature_oldcd ~/; rm -f geonature; ln -s ~/www/geonature geonaturecd ~/; rm -f usershub; ln -s ~/www/usershub usershubcd ~/; rm -f usershub_old; ln -s ~/www/usershub_old usershub_oldcd ~/; rm -f taxhub; ln -s ~/www/taxhub taxhubcd ~/; rm -f taxhub_old; ln -s ~/www/taxhub_old taxhub_old export GNV=$(curl -s https://api.github.com/repos/PnX-SI/GeoNature/releases/latest | grep tag_name | cut -d\" -f4) export UHV=$(curl -s https://api.github.com/repos/PnX-SI/UsersHub/releases/latest | grep tag_name | cut -d\" -f4) export THV=$(curl -s https://api.github.com/repos/PnX-SI/TaxHub/releases/latest | grep tag_name | cut -d\" -f4) supervisorctl start geonature2 atlas taxhub usershub2nginx_dissite geonature_maintenance.conf ; nginx_ensite geonature.conf ; service nginx reloadnginx_dissite atlas_maintenance.conf ; nginx_ensite atlas.conf ; service nginx reloadLors de la phase de développement de nouvelle fonctionnalités sur GeoNature, il peut être intéressant de pouvoir les tester en ligne. Pour ce faire, il est important que la branche en question se base sur la dernière version installée sur le serveur de GeoNature. Sinon, il risque d'y avoir des problème de compatibilité avec la base de données. ATTENTION : Si la branche nécessite une mise à jour de la base de données, bien vérifier que cette mise à jour est réversible !
Voici la procédure à suivre pour mettre en place un telle branche sur "web-srv" :
export GNB="<branche>" cat VERSION export GNV="2.10.0.dev0-5208519" ~/www/geonature/backend/venv/lib/python3.7/site-packages/utils_flask_sqla. Cela ne devrait plus être nécessaire avec les versions 2.8.2+ car les dépendances sont inclues via pip install -r requirementsecho "Branche: ${GNB} ; GeoNature : ${GNV}"cd ~/dwl/ wget https://github.com/PnX-SI/GeoNature/archive/<branche>.zip -O "geonature_${GNB}_v${GNV}.zip" https://github.com/PnX-SI/GeoNature/archive/<sha1>.zip unzip geonature_${GNB}_v${GNV}.zip -d ~/dwl/mv GeoNature-${GNB} geonature_${GNB}_v${GNV}cd ~/www/environ de paramétrage : '' cp ~/www/geonature/environ ~/www/geonature_${GNB}_v${GNV}/environ ''mv ~/www/geonature_${GNB}_v${GNV}/frontend/src/custom ~/www/geonature_${GNB}_v${GNV}/frontend/src/custom.savemkdir ~/www/geonature_${GNB}_v${GNV}/frontend/src/custom/ ''
* Copier l'ancien dossier : ''cp -r ~/geonature/frontend/src/custom/* ~/www/geonature_${GNB}_v${GNV}/frontend/src/custom/ ''
* Afficher les différences entre les 2 dossiers : ''cd ~/www/geonature_${GNB}_v${GNV}/frontend/src ; diff -qr custom.save/ custom/export avec : cp -r ~/geonature/backend/static/exports/* ~/www/geonature_${GNB}_v${GNV}/backend/static/exports ''
* Copier le favicon avec : ''cp ~/geonature/frontend/src/favicon.ico ~/www/geonature_${GNB}_v${GNV}/frontend/src/favicon.ico ''
* Copier la lib leaflet-draw (corrigée) : ''cp ~/www/geonature_old/frontend/node_modules/leaflet-draw/dist/leaflet.draw.js ~/www/geonature/frontend/node_modules/leaflet-draw/dist/leaflet.draw.jscd ~/www; rm -f geonature; ln -s geonature_${GNB}_v${GNV} geonaturecd ~/www; rm -f geonature_old; ln -s geonature_v${GNV} geonature_oldcd ~/www; rm -f geonature_old; ln -s geonature_${GNB}_v<ancienne-version> geonature_oldfalse le paramètre drop_apps_db du fichier ~/www/geonature_${GNB}_v${GNV}/config/settings.ini si vous l'avez modifié !geonature db statusgeonature db autoupgradersync -av -e "ssh -p <port-ssh-db>" /home/geonat/www/ geonat@db-<region>-sinp:/home/geonat/www/psql -h localhost -U geonatadmin -d geonature2db -f ~/geonature/data/migrations/<mon-fichier-de-mise-a-jour>.sqlmkdir -p /home/${USER}/geonature/var/log/gn_export/ ; touch /home/${USER}/geonature/var/log/gn_export/cron.logfalse le paramètre drop_apps_db du fichier ~/www/geonature_${GNB}_v${GNV}/config/settings.ini si vous l'avez modifié !Toutes étapes suivantes se déroulent sur "web-srv" à l'exception des mises à jour de la base sur "db-srv" :
export UHB="<branche>" cat VERSION export UHV="2.2.2-0580563" echo "Branche: ${UHB} ; UsersHub : ${UHV}"cd ~/dwl/ wget https://github.com/PnX-SI/UsersHub/archive/<branche>.zip -O "usershub_${UHB}_v${UHV}.zip" https://github.com/PnX-SI/UsersHub/archive/<sha1>.zip unzip usershub_${UHB}_v${UHV}.zip -d ~/dwl/mv UsersHub-${UHB} usershub_${UHB}_v${UHV}cd ~/www/cp ~/www/usershub/config/settings.ini ~/www/usershub_${UHB}_v${UHV}/config/settings.inicp ~/www/usershub/config/config.py ~/www/usershub_${UHB}_v${UHV}/config/config.pycd ~/www; rm -f usershub; ln -s usershub_${UHB}_v${UHV} usershubcd ~/www; rm -f usershub_old; ln -s usershub_v${UHV} usershub_oldcd ~/www; rm -f usershub_old; ln -s usershub_${UHB}_v<ancienne-version> usershub_oldgeonature depuis la version 2.9.0, voir cet étape dans la section consacré à GeoNature.Toutes étapes suivantes se déroulent sur "web-srv" à l'exception des mises à jour de la base sur "db-srv" :
export THB="<branche>" cat VERSION export THV="1.9.4-0580563" cd ~/dwl/ wget https://github.com/PnX-SI/TaxHub/archive/<branche>.zip -O "taxhub_${THB}_v${THV}.zip" https://github.com/PnX-SI/TaxHub/archive/<sha1>.zip unzip taxhub_${THB}_v${THV}.zip -d ~/dwl/mv TaxHub-${THB} taxhub_${THB}_v${THV}cd ~/www/cp ~/www/taxhub/settings.ini ~/www/taxhub_${THB}_v${THV}/settings.inicp ~/www/taxhub/apptax/config.py ~/www/taxhub_${THB}_v${THV}/apptax/config.pycp ~/www/taxhub/config.py ~/www/taxhub_${THB}_v${THV}/config.pycp ~/www/taxhub/static/app/constants.js ~/www/taxhub_${THB}_v${THV}/static/app/constants.jscp -aR ~/www/taxhub/static/medias/ ~/www/taxhub_${THB}_v${THV}/static/medias/ ''
* Vérifier les droits des dossiers et fichiers copiés
* Vérifier l’existence de nouveaux paramètres de config :
* Dans config.py : '' diff ~/www/taxhub/apptax/config.py.sample ~/www/taxhub_${THB}_v${THV}/apptax/config.py.sample ''
* Pour TaxHub < 1.9.2 : '' diff ~/www/taxhub/config.py.sample ~/www/taxhub_${THB}_v${THV}/config.py.sample ''
* Dans settings.ini : '' diff ~/www/taxhub/settings.ini.sample ~/www/taxhub_${THB}_v${THV}/settings.ini.sample ''
* Dans constants.js : '' diff ~/www/taxhub/static/app/constants.js.sample ~/www/taxhub_${THB}_v${THV}/static/app/constants.js.sample ''
* Compléter/modifier les paramètres de config en fonction des besoins de la branches dans les fichiers :
* config.py : '' vi ~/www/taxhub_${THB}_v${THV}/config.py ''
* settings.ini : '' vi ~/www/taxhub_${THB}_v${THV}/settings.ini ''
* constants.js : '' vi ~/www/taxhub_${THB}_v${THV}/static/app/constants.js ''
* Modifier les liens symboliques :
* pour la nouvelle version : ''cd ~/www; rm -f taxhub; ln -s taxhub_${THB}_v${THV} taxhubcd ~/www; rm -f taxhub_old; ln -s taxhub_v${THV} taxhub_oldcd ~/www; rm -f taxhub_old; ln -s taxhub_${THB}_v<ancienne-version> taxhub_oldgeonature depuis la version 2.9.0, voir cet étape dans la section consacré à GeoNature.Passage à Systemd :
install/assets/geonature.service dans /etc/systemd/system/ : '' sudo cp ~/www/geonature_${GNB}_v${GNV}/install/assets/geonature.service /etc/systemd/system ''/etc/systemd/system/geonature.service et remplacer les variables ${USER} (votre utilisateur linux courant) et ${BASE_DIR} (chemin absolu du répertoire de GeoNature) par les valeurs appropriéesenviron à la racine de votre dossier GeoNature, et indiquer les variables d’environnement avec les valeurs modifiées : GUNICORN_NUM_WORKERS=9 GUNICORN_TIMEOUT=300
config/settings.ini de GeoNature.sudo systemctl daemon-reloadsudo systemctl start geonaturesudo systemctl enable geonatureSurcoucher le service Systemd de GeoNature :
[Unit] StartLimitIntervalSec=60min StartLimitBurst=25 [Service] ExecStart= ExecStart=/home/geonat/www/geonature/backend/venv/bin/gunicorn geonature:create_app() \ --statsd-host "localhost:8125" \ --statsd-prefix "geonature" \ --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}" \ --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/geonature/geonature.log
Surcoucher le service Systemd de TaxHub :
[Unit] StartLimitIntervalSec=60min StartLimitBurst=25 [Service] ExecStart= ExecStart=/home/geonat/www/taxhub/venv/bin/gunicorn apptax.app:create_app() \ --statsd-host "localhost:8125" \ --statsd-prefix "taxhub" \ --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}" \ --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/taxhub/taxhub.log
Surcoucher le service Systemd de UsersHub :
[Unit] StartLimitIntervalSec=60min StartLimitBurst=25 [Service] ExecStart= ExecStart=/home/geonat/www/usershub/venv/bin/gunicorn app.app:create_app() \ --statsd-host "localhost:8125" \ --statsd-prefix "usershub" \ --name "${GUNICORN_PROC_NAME}" --workers "${GUNICORN_NUM_WORKERS}" \ --bind "${GUNICORN_HOST}:${GUNICORN_PORT}" --timeout="${GUNICORN_TIMEOUT}" Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/usershub/usershub.log
Ajout des options --statsd-* :
exec gunicorn wsgi:app \ --statsd-host=localhost:8125 \ --statsd-prefix=geonature \ --timeout ${gun_timeout} \ --error-log $APP_DIR/var/log/gn_errors.log \ --pid="${app_name}.pid" \ -w "${gun_num_workers}" \ -b "${gun_host}:${gun_port}" \ -n "${app_name}"
proxy_pass http://127.0.0.1:8000/; par proxy_pass http://127.0.0.1:8000/api/; config/geonature_config.toml en :[ALEMBIC] VERSION_LOCATIONS = "/home/geonat/www/usershub/app/migrations/versions/"
id_type par des type_code dans le paramètre AREA_FILTERS. Par exemple, l'id 25 devient "COM". id_type par des type_code dans le paramètre AREA_TYPES. Ex. : AREA_TYPES = ["COM", "DEP", "SINP"][geonature] qui précède 3b2f3de760dc access request.geonature db stamp ad35a3bf85c2geonature db upgrade taxonomie_inpn_data@headmv ~/geonature/frontend/src/custom/custom.scss ~/geonature/frontend/src/assets/custom.css rsync -av ./ geonat@db-paca-sinp:~/data/db-geonature/ --dry-run supprimer –dry-run si tout est okpsql -h localhost -U geonatadmin -d gn2_dev_sinp -f "data/update1.7.3to1.8.0.sql"
Loose attributes and medium now attach to … et "Conflict …" pour lesquels il peut y avoir une action à mener si des attributs (att_nb) ou des media existent (media_nb).psql -h localhost -U geonatadmin -d gn2_dev_sinp -f "data/migrations/2.6.2to2.7.0.sql"
frontend/src/assets/custom.csspsql -h localhost -U geonatadmin -d gn2_dev_sinp -f "data/migrations/2.7.1to2.7.2.sql"
BEGIN; au début du fichier. wget https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/master/data/update1.3.4to1.3.5.sql -O tmp/nomenclature-api-module_update1.3.4to1.3.5.sql wget https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/master/data/update1.3.4to1.3.5.sql -O tmp/nomenclature-api-module_update1.3.5to1.3.6.sql —- AFTER 2.5.6.rc.2.cp ~/geonature_old/backend/venv/lib/python3.7/site-packages/utils_flask_sqla/response.py ~/geonature/backend/venv/lib/python3.7/site-packages/utils_flask_sqla/response.py cd ~/www/geonature/data/migrations ; wget https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/master/data/update1.3.2to1.3.3.sql -O nomenclature-api-module_update1.3.2to1.3.3.sql cd ~/www/geonature/data/migrations ; wget https://raw.githubusercontent.com/PnX-SI/Nomenclature-api-module/master/data/update1.3.3to1.3.4.sql -O nomenclature-api-module_update1.3.3to1.3.4.sql gn_exports.v_synthese_sinp puis supprimer cette vue.gn_exports.v_synthese_sinp en effectuant au préalable des corrections dedans : supprimer le champ id_nomenclature_obs_technique et renommer le champ id_nomenclature_obs_meth ⇒ id_nomenclature_obs_technique, remplacer le label "obsMeth" par "obsTech".geonature install_gn_module /home/geonat/www/geonature/contrib/gn_module_occhab /occhabocchab en suivant la procédure.config/config.py le paramètre URLS_COR, il n'est plus utilisé../install_app.shgeonature via Alembic. Il est donc nécessaire de mettre à jour GeoNature en v2.10.0.dev0.apptax/config.py ainsi :# File import os BASE_DIR = os.path.abspath(os.path.dirname(__file__))
UPLOAD_FOLDER = 'static/medias' par UPLOAD_FOLDER = 'medias' wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v15/sql/2.1_taxref_changes_corrections_pre_detections.sql -O apptax/migrations/data/migrate_taxref_version/2.1_taxref_changes_corrections_pre_detections.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v15/sql/2.2_taxref_changes_corrections_post_detections.sql -O apptax/migrations/data/migrate_taxref_version/2.2_taxref_changes_corrections_post_detections.sql flask taxref_migration apply_changes --script_predetection /home/geonat/www/taxhub/apptax/migrations/data/migrate_taxref_version/2.1_taxref_changes_corrections_pre_detections.sql --script_postdetection /home/geonat/www/taxhub/apptax/migrations/data/migrate_taxref_version/2.2_taxref_changes_corrections_post_detections.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v13/data/sql/2.1_taxref_changes_corrections_pre_detections.sql -O scripts/2.1_taxref_changes_corrections_pre_detections.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v13/data/sql/2.2_taxref_changes_corrections_post_detections.sql -O scripts/2.2_taxref_changes_corrections_post_detections.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v13/data/sql/4.3_restore_local_constraints.sql -O scripts/4.3_restore_local_constraints.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v14/data/sql/2.1_taxref_changes_corrections_pre_detections.sql -O scripts/2.1_taxref_changes_corrections_pre_detections.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v14/data/sql/2.2_taxref_changes_corrections_post_detections.sql -O scripts/2.2_taxref_changes_corrections_post_detections.sql wget https://raw.githubusercontent.com/cbn-alpin/sinp-paca-data/master/taxref/v14/data/sql/4.3_restore_local_constraints.sql -O scripts/4.3_restore_local_constraints.sql geonature via Alembic. Il est donc nécessaire de mettre à jour GeoNature en v2.10.0.dev0.