From 831188830cdf01bf2fc1a6e28e9aeceb3f1c6bbb Mon Sep 17 00:00:00 2001 From: denis Date: Sat, 25 Apr 2026 17:39:55 +0200 Subject: [PATCH] install final --- etc/1-install-sys.sh | 18 +++++-- etc/2-cargo-reductstore-install.sh | 4 +- etc/5-install_adminer.sh | 6 ++- etc/6-install_django_app.sh | 21 ++++++-- etc/db/configuration.json | 3 +- etc/db/multiwell.json | 2 - etc/db/well.json | 2 - etc/db/wellposition.json | 2 - etc/scanner_service.conf | 46 ++++++++++++++++++ run-workers.sh | 3 +- test_tube_scanner/.env.example | 6 +-- .../home/static/img/zigbee2mqtt.png | Bin 7023 -> 0 bytes .../scanner/templates/scanner/base.html | 4 +- 13 files changed, 92 insertions(+), 25 deletions(-) delete mode 100644 etc/db/wellposition.json create mode 100644 etc/scanner_service.conf delete mode 100644 test_tube_scanner/home/static/img/zigbee2mqtt.png diff --git a/etc/1-install-sys.sh b/etc/1-install-sys.sh index 33cf13e..0de4043 100755 --- a/etc/1-install-sys.sh +++ b/etc/1-install-sys.sh @@ -1,10 +1,20 @@ !/bin/bash -echo "==== System installation for rpi 4/5" +echo "==== System installation for rpi" echo sudo apt update -#sudo apt upgrade +sudo apt upgrade + +ETC="$(pwd)" + +mkdir -p $HOME/exports +mkdir -p$HOME/medias +mkdir -p /mnt/exports + +cp ../test_tube_scanner/.env.example ../test_tube_scanner/.env +echo "==== Copie .env ==> MODIFIER CE FICHIER POUR POUVOIR cONTINUER" +echo # system echo "==== system essential" @@ -15,8 +25,8 @@ sudo apt -y install python3-dev python3-pip python3-venv libpq-dev default-libmy echo "==== supervisor http access login:pass => root:toor" sudo cp supervisor-inet_http.conf /etc/supervisor/conf.d/ -sudo ln -s scanner_service.conf /etc/supervisor/conf.d/ -sudo ln -s reductstore_service.conf /etc/supervisor/conf.d/ +sudo ln -s $ETC/scanner_service.conf /etc/supervisor/conf.d/ +sudo ln -s $ETC/reductstore_service.conf /etc/supervisor/conf.d/ echo "==== restart supervisor " sudo systemctl restart supervisor diff --git a/etc/2-cargo-reductstore-install.sh b/etc/2-cargo-reductstore-install.sh index e7ea792..fe7bd38 100755 --- a/etc/2-cargo-reductstore-install.sh +++ b/etc/2-cargo-reductstore-install.sh @@ -1,8 +1,9 @@ !/bin/bash echo "--- install reductstore" +echo " machine raspberry pi4" +echo " Compilation finished `release` profile [optimized] target(s) in 16m 31s" sudo apt install libprotobuf-dev protobuf-compiler - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env @@ -10,3 +11,4 @@ cargo --version rustc --version cargo install reductstore +mkdir -p $HOME/medias diff --git a/etc/5-install_adminer.sh b/etc/5-install_adminer.sh index bc15002..32b4739 100755 --- a/etc/5-install_adminer.sh +++ b/etc/5-install_adminer.sh @@ -11,7 +11,11 @@ echo "[2/6] Installation de Nginx et PHP-FPM..." sudo apt install -y nginx # Détection de la version de PHP installée (ou installation si absente) -PHP_VERSION=$(ls /etc/php/ | grep -E '^[0-9]+\.[0-9]+$' | sort -V | tail -n 1) +VERSION=$(apt-cache policy php | awk '/Candidate:/ {print $2}') +PHP_VERSION=$(apt-cache show php | awk -F'[: ]+' '/Depends:/ {for(i=1;i<=NF;i++) if($i ~ /^php[0-9]+\.[0-9]+$/) print substr($i,4)}' | head -n1) +echo "Version du paquet php (meta): $version" +echo "Version PHP utilisée: $php_version" + if [ -z "$PHP_VERSION" ]; then echo "Aucune version de PHP détectée. Installation de PHP 8.2 par défaut..." sudo apt install -y php8.2 php8.2-fpm php8.2-mysql diff --git a/etc/6-install_django_app.sh b/etc/6-install_django_app.sh index 63ba71a..ecdf6f4 100755 --- a/etc/6-install_django_app.sh +++ b/etc/6-install_django_app.sh @@ -8,22 +8,35 @@ echo ETC="$(pwd)" APP_DIR=" ../test_tube_scanner" +echo "---- Lancer reductstore ..." +sudo supervisorctl reread +sudo supervisorctl restart reductstore + cd $APP_DIR -echo "migration de la base de données ..." +echo "---- Création des répertoires media ..." +mkdir -p $APP_DIR/media/images $APP_DIR/media/simulation +mkdir -p $APP_DIR/logs +touch $APP_DIR/logs/celery.log $APP_DIR/logs/test_tube.log + +echo "---- Migration de la base de données ..." ./manage.py migrate ./manage.py makemigrations ./manage.py migrate -echo "User / django_celery_beat ..." +echo "---- User / django_celery_beat ..." ./manage.py init_data -echo "Tables ..." +echo "---- Tables ..." ./manage.py loaddata $ETC/db/configuration.json ./manage.py loaddata $ETC/db/well.json ./manage.py loaddata $ETC/db/multiwell.json -./manage.py loaddata $ETC/db/welposition.json +echo "---- start test_tube:*" +echo +sudo supervisorctl reread +sudo supervisorctl update +sudo supervisorctl restart test_tube:* echo echo "=== Installation terminée ===" diff --git a/etc/db/configuration.json b/etc/db/configuration.json index 2727981..e4afd62 100644 --- a/etc/db/configuration.json +++ b/etc/db/configuration.json @@ -1,3 +1,2 @@ -Django BASE_DIR: /home/rpi4/django-test-tube-scanner/test_tube_scanner -Django application data: /home/rpi4/django-test-tube-scanner/test_tube_scanner + [{"model": "scanner.configuration", "pk": 1, "fields": {"name": "Configuration par défaut", "author": 1, "sidebar_width": "25%", "default_grid_columns": 3, "opencv_fourcc_format": "mp4v", "opencv_video_type": "mp4", "grbl_xmax": 350.0, "grbl_ymax": 250.0, "use_rpicam": true, "webcam_device_index": 2, "image_quality": 90, "video_jpeg_quality": 90, "video_frame_rate": 5.0, "video_width_capture": 2028, "video_height_capture": 1520, "calibration_crop_radius": 500, "calibration_default_multiwell": "HG", "calibration_default_feed": 1000, "calibration_default_step": 1.0, "calibration_default_duration": 3.0, "active": true}}] diff --git a/etc/db/multiwell.json b/etc/db/multiwell.json index a767672..6ca1657 100644 --- a/etc/db/multiwell.json +++ b/etc/db/multiwell.json @@ -1,3 +1 @@ -Django BASE_DIR: /home/rpi4/django-test-tube-scanner/test_tube_scanner -Django application data: /home/rpi4/django-test-tube-scanner/test_tube_scanner [{"model": "scanner.multiwell", "pk": 2, "fields": {"label": "Haut gauche", "author": 1, "position": "HG", "default": false, "cols": 6, "rows": 4, "diameter": 16.0, "row_def": "A,B,C,D", "row_order": "D,C,B,A", "order": 2, "duration": 12, "xbase": 156.45, "ybase": 12.75, "dx": 19.3, "dy": 19.3, "feed": 1000, "well_position": true, "active": true}}, {"model": "scanner.multiwell", "pk": 3, "fields": {"label": "Haut droit", "author": 1, "position": "HD", "default": true, "cols": 6, "rows": 4, "diameter": 16.0, "row_def": "A,B,C,D", "row_order": "D,C,B,A", "order": 0, "duration": 3, "xbase": 10.963, "ybase": 15.825, "dx": 19.4, "dy": 19.4, "feed": 1000, "well_position": true, "active": true}}, {"model": "scanner.multiwell", "pk": 4, "fields": {"label": "Bas gauche", "author": 1, "position": "BG", "default": false, "cols": 6, "rows": 4, "diameter": 16.0, "row_def": "A,B,C,D", "row_order": "D,C,B,A", "order": 3, "duration": 12, "xbase": 150.15, "ybase": 112.55, "dx": 19.5, "dy": 19.5, "feed": 1000, "well_position": true, "active": true}}, {"model": "scanner.multiwell", "pk": 5, "fields": {"label": "Bas droit", "author": 1, "position": "BD", "default": false, "cols": 6, "rows": 4, "diameter": 16.0, "row_def": "A,B,C,D", "row_order": "D,C,B,A", "order": 1, "duration": 12, "xbase": 10.15, "ybase": 111.05, "dx": 19.55, "dy": 19.55, "feed": 1000, "well_position": true, "active": true}}] diff --git a/etc/db/well.json b/etc/db/well.json index ca5739c..1c32ba1 100644 --- a/etc/db/well.json +++ b/etc/db/well.json @@ -1,3 +1 @@ -Django BASE_DIR: /home/rpi4/django-test-tube-scanner/test_tube_scanner -Django application data: /home/rpi4/django-test-tube-scanner/test_tube_scanner [{"model": "scanner.well", "pk": 1, "fields": {"author": 1, "name": "A1"}}, {"model": "scanner.well", "pk": 2, "fields": {"author": 1, "name": "A2"}}, {"model": "scanner.well", "pk": 3, "fields": {"author": 1, "name": "A3"}}, {"model": "scanner.well", "pk": 4, "fields": {"author": 1, "name": "A4"}}, {"model": "scanner.well", "pk": 5, "fields": {"author": 1, "name": "A5"}}, {"model": "scanner.well", "pk": 6, "fields": {"author": 1, "name": "A6"}}, {"model": "scanner.well", "pk": 7, "fields": {"author": 1, "name": "B1"}}, {"model": "scanner.well", "pk": 8, "fields": {"author": 1, "name": "B2"}}, {"model": "scanner.well", "pk": 9, "fields": {"author": 1, "name": "B3"}}, {"model": "scanner.well", "pk": 10, "fields": {"author": 1, "name": "B4"}}, {"model": "scanner.well", "pk": 11, "fields": {"author": 1, "name": "B5"}}, {"model": "scanner.well", "pk": 12, "fields": {"author": 1, "name": "B6"}}, {"model": "scanner.well", "pk": 13, "fields": {"author": 1, "name": "C1"}}, {"model": "scanner.well", "pk": 14, "fields": {"author": 1, "name": "C2"}}, {"model": "scanner.well", "pk": 15, "fields": {"author": 1, "name": "C3"}}, {"model": "scanner.well", "pk": 16, "fields": {"author": 1, "name": "C4"}}, {"model": "scanner.well", "pk": 17, "fields": {"author": 1, "name": "C5"}}, {"model": "scanner.well", "pk": 18, "fields": {"author": 1, "name": "C6"}}, {"model": "scanner.well", "pk": 19, "fields": {"author": 1, "name": "D1"}}, {"model": "scanner.well", "pk": 20, "fields": {"author": 1, "name": "D2"}}, {"model": "scanner.well", "pk": 21, "fields": {"author": 1, "name": "D3"}}, {"model": "scanner.well", "pk": 22, "fields": {"author": 1, "name": "D4"}}, {"model": "scanner.well", "pk": 23, "fields": {"author": 1, "name": "D5"}}, {"model": "scanner.well", "pk": 24, "fields": {"author": 1, "name": "D6"}}] diff --git a/etc/db/wellposition.json b/etc/db/wellposition.json deleted file mode 100644 index f358ad4..0000000 --- a/etc/db/wellposition.json +++ /dev/null @@ -1,2 +0,0 @@ -Django BASE_DIR: /home/rpi4/django-test-tube-scanner/test_tube_scanner -Django application data: /home/rpi4/django-test-tube-scanner/test_tube_scanner diff --git a/etc/scanner_service.conf b/etc/scanner_service.conf new file mode 100644 index 0000000..cdae740 --- /dev/null +++ b/etc/scanner_service.conf @@ -0,0 +1,46 @@ +[group:test_tube] +programs=webUI,planification,services + +[program:webUI] +process_name=%(program_name)s +priority=500 +directory=/home/rpi4/PlanarianScanner/test_tube_scanner +command= + /home/rpi4/PlanarianScanner/.venv/bin/daphne + -b 0.0.0.0 + -p 8000 + home.asgi:application +user=rpi4 +group=rpi4 +stopasgroup=true +stopsignal=SIGINT +autostart=true +autorestart=true +redirect_stderr=true + +[program:planification] +process_name=%(program_name)s +priority=800 +directory=/home/rpi4/PlanarianScanner/test_tube_scanner +command=/home/rpi4/PlanarianScanner/.venv/bin/celery -A home beat -l info +user=rpi4 +group=rpi4 +stopasgroup=true +stopsignal=SIGINT +autostart=true +autorestart=true +redirect_stderr=true + +[program:services] +process_name=%(program_name)s +priority=900 +directory=/home/rpi4/PlanarianScanner/test_tube_scanner +command=/home/rpi4/PlanarianScanner/run-workers.sh +user=rpi4 +group=rpi4 +stopasgroup=true +stopsignal=SIGINT +autostart=true +autorestart=true +redirect_stderr=true + diff --git a/run-workers.sh b/run-workers.sh index 44fc14e..beda0d8 100755 --- a/run-workers.sh +++ b/run-workers.sh @@ -1,7 +1,6 @@ #!/bin/bash -APP_DIR="/home/rpi4/django-test-tube-scanner" -#APP_DIR="/home/rpi4/PlanarianScanner" +APP_DIR="/home/rpi4/PlanarianScanner" cd "$APP_DIR/test_tube_scanner" echo "start workers" diff --git a/test_tube_scanner/.env.example b/test_tube_scanner/.env.example index 2f13a48..c1be9c1 100644 --- a/test_tube_scanner/.env.example +++ b/test_tube_scanner/.env.example @@ -35,7 +35,7 @@ EMAIL_HOST_PASSWORD=123456 EMAIL_USE_TLS=True LOGGING_FILE=test_tube.log -SECRET_KEY=django-insecure-0)4_w=pjv1ex7=s=c=ii3g@fx_=8fb=hxk€3bpk1)uj(0ph0t) +SECRET_KEY="django-insecure-0)4_w=pjv1ex7=s=c=ii3g@fx_=8fb=hxk€3bpk1)uj(0ph0t)" USER=rpi4 GROUP=rpi4 @@ -74,10 +74,10 @@ DATABASE_POSTGRES_PORT=5432 #### # database # -DATABASE_ROOT_PASSWORD=change_me +DATABASE_ROOT_PASSWORD=planaire DATABASE_NAME=test_tube DATABASE_USER=test_tube -DATABASE_PASSWORD=change_me +DATABASE_PASSWORD=planaire #### ## reductstore diff --git a/test_tube_scanner/home/static/img/zigbee2mqtt.png b/test_tube_scanner/home/static/img/zigbee2mqtt.png deleted file mode 100644 index 3eccb5040fc0279998608f050ead67dd4a6cbbe9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7023 zcmeHLcTkf{*WW~tCPfrbLlAfGBaH9UtfXzGf=B!)xqD5_9T}?9a;?@HBHe(;6 zdE{J2HRj}m;?973YuPWNQ?@pAlAYRmKQoKkhm0A?QEvVj*(i10dn1T$3-a$;GwZau zT3hoyUrL&_C--xF)IO@&=Z7}%C2u5fa2r{!u6~}buHWNQ1N>&I%>ly_=qt-C+Z zl~(|~MHiHBc(MTBj+>@CoqJ;VL za;@KZp2H{P4;3PrOPCG((wWS>Aratym}P(pTW9G@(7LQmk5;r942 z4vm^n5yUv5L%jV^t{fhOB4J5bJjPwfO0+^dtD+ov%t*4o+rn=UaL)-HEf8?YI9yUv z5;lp5kXd6VkXi0v3;BvvEIL@CELPFvvHD{-*^$5MHG?e~8aX z;4vWgL?})$=Vu5eG(0golxO-RPmLWYBZiKUI#DGV?%4#z@vSR#FjsJSPH=@X zn@H6Bzx$FD4UK03CJckO#r!v6xNiaD#`lcx5j*1kixbBQg`YMV*zW5Xym`TUA@0X! z_>D8z-+%M>Ef@dh6e!fMN&XSPzv%i!*FR$5A1VK;u3vQhBL@DF@~`Upf1^wFuj>>P z2cLqH;LFm!tbncXmDtU1NuYb>oA8NS*T4HHOh(De?P@dTH)LD%ULmy{#g^xszeud4}+`5XbP;+8#MGBYyU2G1`NuoE|&t!$soYHS6*;vkRN%Ufnit zwA9vWj>7r~y{i55W#U0peN$vLblpZ6qHD8#wHC}DLg4Qc z0I089;7=p~LHF`-1KSj5FM>NN+(n^$05mGc|A=bNNhUm~B=GchSL#-pp{%KnG2>BT zwF*x+mq20bhxVAHY&(6W-rnDK?Pg&A)VR435uR9*nR9$!`|*a$_AK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5bQFLaO2xS8~`R3K)s1%Hyld-gv3)dm(&jAH!Ys@R1Cv$ zEoV)67(%Tru5x25?mv^g>tP_Z_GbMOjN~>E}#z5E9kgDT0#T#puMBfUtbQLYlPJ4t4MtkB=n+1HZ0 zusC(m)5URr==lM#s+V=K#)jB3P^qQ>ZsFu=dvy>Q^Ll1(RHx3rIp(;FsvIHdIdo}T ztRWrw8GWCCm|m}GA#qRi+AedtY)CFv)6)>Y95GhBwSLGbwZ{WNZF|!m!BSZIYU{M# z2G{NjV|<^`GodA?+e*1}dQbNRH{pjxE3=OZI^^A#Yu0jyx6Za2Iihf5U^YKFLi}#v zZe+A&D-xp<}TC z-|d1xeq-KJi9&uUZoAQ&c|cN==Zylwo_=q~ejx0R(pCnkhsz5+4MDKX5@{?xkT63R zr6I2LpPaSj$oAU^?rUGY-j^1$RVGR5^UTv`OYn~O7pjXLL|IgGD%Zg=$J%sv zK#Q?Hkd6c>_#*}fOC!}lT8$_arBiMoUg)F+(rQIZQ93Bn;K3veC+h5vinY)b^SyLft#2T2^>$_>fyILgbgSW_XAvHC8>{kyO_|pqJ~Ac+VNTd9Cayl3xIz zS2(kL!xPt{n(KWV_4i)ve}MK2OCc-Vsq@`P{bS^=o|%K_39_>b7cAZ)g;bl;%N!BQ z`VY;c`pS3;(RaePfR!V)YE1|8E`xO=wW>`Sc?IC`NUcg!R^EP4I#R3Ll#{m!w2x>a zd3ubcxzF{=!-9ij)mE&$fZ={WV0}Aj?RYFlw9?LNVwN=9!RI^R>F(opZb8I`{{V75 B86p4x diff --git a/test_tube_scanner/scanner/templates/scanner/base.html b/test_tube_scanner/scanner/templates/scanner/base.html index c577eb6..8a2bfa4 100644 --- a/test_tube_scanner/scanner/templates/scanner/base.html +++ b/test_tube_scanner/scanner/templates/scanner/base.html @@ -77,9 +77,9 @@ {% trans "Base de données Reductstore" %} - +