ssh geonat@bkp-<region>-sinp
ssh geonat@bkp-<region>-sinp
--dry-run
si tout est OK) : rsync -e "ssh -p <port-ssh-web-srv>" -av --exclude .cache/ --exclude venv/ --exclude venv.save/ geonat@web-<region>-sinp:/home/geonat/www/ /home/geonat/www/ --dry-run
--dry-run
si tout est OK) : rsync -av -e "ssh -p <port-ssh-db-srv>" --exclude "raw/*" geonat@db-<region>-sinp:/home/geonat/data/ /home/geonat/data --dry-run
ln -s www/atlas atlas ln -s www/geonature geonature ln -s www/taxhub taxhub ln -s www/usershub usershub
git clone https://github.com/PnX-SI/GeoNature.git geonature
cd geonature
config/settings.ini
avec : scp geonat@web-<region>-sinp:~/geonature/config/settings.ini ./config/
vi config/settings.ini
config/geonature_config.toml
avec : scp geonat@web-<region>-sinp:~/geonature/config/geonature_config.toml ./config/
vi config/geonature_config.toml
cd install/
./01_install_backend.sh
CTRL+C
source ../backend/venv/bin/activate
pip install sentry_sdk
deactivate
frontend/src/custom/components/
scp -r geonat@web-<region>-sinp:~/geonature/frontend/src/custom/components/ frontend/src/custom/
git restore *.sample
frontend/src/custom/images/
scp -r geonat@web-<region>-sinp:~/geonature/frontend/src/custom/images frontend/src/custom/
scp -r geonat@web-<region>-sinp:~/geonature/frontend/src/favicon.ico frontend/src/
frontend/src/assets/i18n/fr.json
:scp geonat@web-<region>-sinp:~/geonature/frontend/src/assets/i18n/fr.json ./frontend/src/assets/i18n/
scp geonat@web-<region>-sinp:~/geonature/environ ./
vi ./environ
frontend/src/external_assets/
et dans external_modules/
source backend/venv/bin/activate pip list | grep modules pip install -e /home/geonat/www/modules/<module> pip list | grep modules
cd install/
./04_install_fontend.sh
cd frontend/
nvm use
cd frontend/
npm install
cd frontend/
npm run build
vi /etc/logrotate.d/geonature
vi ~/geonature/config/geonature_config.toml
SQLALCHEMY_DATABASE_URI = "postgresql://geonatadmin:<mot-de-passe-geonatadmin-sur-bkp-srv>@127.0.0.1:5432/geonature2db" URL_APPLICATION = "https://gnpp.silene.eu" API_ENDPOINT = "https://gnpp.silene.eu/api" API_TAXHUB = "https://thpp.silene.eu/api" # Remplacer par une clé alétoire complexe SECRET_KEY = "<utiliser-uuid-pour-générer-une-clé>" appName = "<nom-du-site> - Pré-Prod" # Set Sentry DSN SENTRY_DSN = "<nouveau-sentry-DSN-généré-dans-app-monitor>" [USERSHUB] URL_USERSHUB = "https://uhpp.<sinp-domaine>" [ACCOUNT_MANAGEMENT] VALIDATOR_EMAIL = [ "adminsys@<sinp-domaine>", ] [FRONTEND] # Durée de vie du cache des stats de la page d'accueil # 86 400 = 1 jour STAT_BLOC_TTL = 86400 [PERMISSION_MANAGEMENT] VALIDATOR_EMAIL = [ "adminsys@<sinp-domaine>", ]
vi ~/geonature/config/settings.ini
#MODE=dev #Voir s'il faut utiliser git pour l'installation et donc le mode "dev"... my_url=https://gnpp.silene.eu/ db_host=127.0.0.1 user_pg_pass=<mot-de-passe-geonatadmin-sur-bkp-srv>
cd ~/geonature/frontend nvm install cd ~/geonature/backend rm -fR venv cd ~/geonature/install ./01_install_backend.sh
cd ~/geonature/install ./04_install_frontend.sh
An unhandled exception occurred: Cannot find module '@angular-builders/custom-webpack/package.json
:cd ~/geonature/frontend/ nvm use npm install npm run build
mkdir /var/log/geonature/ mv /var/log/usershub.log /var/log/geonature/ chown -R geonat: /var/log/geonature/
vi /etc/logrotate.d/geonature
/var/log/geonature/geonature.log { su geonat geonat daily rotate 8 size 100M create compress postrotate systemctl reload geonature || true endscript }
systemctl edit geonature
[Unit] Description=GeoNature - PreProd After=docker.service StartLimitIntervalSec=60min StartLimitBurst=25 [Service] Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/geonature/geonature.log
environ
: vi ~/geonature/environ
GUNICORN_HOST=0.0.0.0 GUNICORN_NUM_WORKERS=9 GUNICORN_TIMEOUT=300
vi ~/atlas/atlas/configuration/config.py
database_connection = "postgresql://geonatatlas:<mot-de-passe-utilisateur-geonatatlas>@127.0.0.1:5432/gnatlas" NOM_APPLICATION = "Silene Nature - Pré-Prod" SECRET_KEY = '<utiliser-uuid-pour-générer-une-clé>'
vi ~/www/atlas/atlas/configuration/settings.ini
db_host=0.0.0.0 user_pg_pass=<mot-de-passe-utilisateur-geonatatlas> owner_atlas_pass=<mot-de-passe-utilisateur-geonatadmin> db_source_host=127.0.0.1 atlas_source_pass=<mot-de-passe-utilisateur-geonatadmin>
cd ~/atlas/atlas/static/ nvm install cd ~/atlas/ rm -fR venv ./install_app.sh
mkdir /var/log/geonature-atlas/ mv /var/log/usershub.log /var/log/geonature-atlas/ chown -R geonat: /var/log/geonature-atlas/
vi /etc/logrotate.d/geonature-atlas
/var/log/geonature-atlas/geonature-atlas.log { su geonat geonat daily rotate 8 size 100M create compress postrotate systemctl reload geonature-atlas || true endscript }
systemctl edit geonature-atlas
[Unit] Description=Atlas - PreProd After=docker.service StartLimitIntervalSec=60min StartLimitBurst=25 [Service] Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/geonature-atlas/geonature-atlas.log
environ
: vi ~/atlas/environ
GUNICORN_HOST=0.0.0.0 GUNICORN_NUM_WORKERS=4 GUNICORN_TIMEOUT=90
vi ~/usershub/config/config.py
SQLALCHEMY_DATABASE_URI = "postgresql://geonatadmin:<mot-de-passe-geonatadmin-sur-bkp-srv>@127.0.0.1:5432/geonature2db" URL_APPLICATION ='https://uhpp.silene.eu' SECRET_KEY = '<utiliser-uuid-pour-générer-une-clé>'
vi ~/usershub/config/settings.ini
db_host=0.0.0.0 user_pg_pass=<mot-de-passe-utilisateur-geonatadmin> url_application=https://uhpp.silene.eu
cd ~/usershub/app/static/ nvm install cd ~/usershub/ rm -fR venv ./install_app.sh
mkdir /var/log/usershub/ mv /var/log/usershub.log /var/log/usershub/ chown -R geonat: /var/log/usershub/
vi /etc/logrotate.d/usershub
/var/log/usershub/usershub.log { su geonat geonat daily rotate 8 size 100M create compress postrotate systemctl reload usershub || true endscript }
systemctl edit usershub.service
[Unit] Description=UsersHub - PreProd After=docker.service StartLimitIntervalSec=60min StartLimitBurst=25 [Service] Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/usershub/usershub.log
environ
: vi ~/usershub/environ
GUNICORN_HOST=0.0.0.0
vi ~/taxhub/apptax/config.py
DEBUG=True SQLALCHEMY_DATABASE_URI = "postgresql://geonatadmin:<mot-de-passe-geonatadmin-sur-bkp-srv>@127.0.0.1:5432/geonature2db" SECRET_KEY = '<utiliser-uuid-pour-générer-une-clé>'
vi ~/taxhub/settings.ini
db_host=0.0.0.0 user_pg_pass=<mot-de-passe-utilisateur-geonatadmin>
cd ~/taxhub/static/ nvm install cd ~/taxhub/ rm -fR venv ./install_app.sh
mkdir /var/log/taxhub/ mv /var/log/usershub.log /var/log/taxhub/ chown -R geonat: /var/log/taxhub/
vi /etc/logrotate.d/taxhub
/var/log/taxhub/taxhub.log { su geonat geonat daily rotate 8 size 100M create compress postrotate systemctl reload taxhub || true endscript }
systemctl edit taxhub
[Unit] Description=TaxHub - PreProd After=docker.service StartLimitIntervalSec=60min StartLimitBurst=25 [Service] Restart=on-failure RestartSec=2min StandardOutput=append:/var/log/taxhub/taxhub.log
environ
: vi ~/taxhub/environ
GUNICORN_HOST=0.0.0.0
sudo usermod -aG docker geonat
id
docker run hello-world
Got permission denied while trying to connect to the Docker daemon socket
apparait, redémarrer la machine pour activer la prise en compte de Docker.mkdir -p ~/docker/preprod
cp .env.sample .env
docker compose up -d
docker exec -it preprod-postgres bash
psql -U ${POSTGRES_USER} ${POSTGRES_DB}
/etc/apt/sources.list.d/
apt install postgresql-client-15
ssh admin@bkp-<region>-sinp ; sudo -i
borg mount /home/backups/db-srv /tmp/repo
preprod-postgres-restore
avec : cp -r /tmp/repo/db-srv-<date-et-heure>/root/.borgmatic/postgresql_databases/172.18.5.1/geonature2db /home/geonat/docker/preprod/postgres/restore/<date>_geonature2db.custom
cp -r /tmp/repo/db-srv-<date-et-heure>/root/.borgmatic/postgresql_databases/172.18.5.1/gnatlas /home/geonat/docker/preprod/postgres/restore/<date>_gnatlas.custom
chown geonat: /home/geonat/docker/preprod/postgres/restore/*.custom
cd ; borg umount /tmp/repo
cd ~/docker/preprod/
docker compose run --rm preprod-postgres-restore /restore/restore.sh -d "2023-06-14_geonature2db.custom"
docker compose run --rm preprod-postgres-restore /restore/restore.sh -d "2023-06-23_gnatlas.custom"
CTRL+C
. Les tables et les VMs sont malgré tout généré dans la base. Il suffit donc de rafraichir l'ensemble des VMs pour finaliser la restauration.gnatlas_refresh_all.sql
: docker compose run --rm preprod-postgres-restore psql -U geonatadmin -e -d gnatlas -f /restore/gnatlas_refresh_all.sql
systemctl status geonature systemctl status usershub systemctl status taxhub systemctl status geonature-atlas
ssh geonat@bkp-<region>-sinp
git clone --recursive https://github.com/cbn-alpin/sinp-aura-data.git data
cd ~/data/
sudo apt install pipx
pipx ensurepath
source ~/.bashrc
pipx --version
pipx install pipenv
pipenv --version
import-parser
avec : cd ~/data/import-parser/; pipenv install
gn2pg
avec : cd ~/data/gn2pg/; pipenv install
ls -al ~/.gn2pg
puis si c'est un dossier rm -fr ~/.gn2pg
ln -s ~/data/gn2pg/config ~/.gn2pg
db-srv