install final
This commit is contained in:
@@ -147,6 +147,13 @@ ou
|
|||||||
sudo supervisorctl start|stop|restart reductstore
|
sudo supervisorctl start|stop|restart reductstore
|
||||||
sudo supervisorctl start|stop|restart test_tube:*
|
sudo supervisorctl start|stop|restart test_tube:*
|
||||||
|
|
||||||
|
Ajouter scanner.local au fichier hosts des clients web:
|
||||||
|
192.168.1.xxx scanner.local
|
||||||
|
- linux : /etc/hosts"
|
||||||
|
- windows: C:\Windows\System32\drivers\etc\hosts"
|
||||||
|
- mac : /private/etc/hosts"
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
ETC="$(pwd)"
|
||||||
|
|
||||||
# Script d'installation d'Adminer avec Nginx (sans Apache) + détection automatique de PHP
|
# Script d'installation d'Adminer avec Nginx (sans Apache) + détection automatique de PHP
|
||||||
# Mise à jour des paquets
|
# Mise à jour des paquets
|
||||||
echo "[1/6] Mise à jour des paquets..."
|
echo "[1/6] Mise à jour des paquets..."
|
||||||
@@ -30,32 +32,16 @@ ADMINER_VERSION=$(curl -s https://api.github.com/repos/vrana/adminer/releases/la
|
|||||||
sudo mkdir -p /var/www/adminer
|
sudo mkdir -p /var/www/adminer
|
||||||
sudo wget "https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php" -O /var/www/adminer/index.php
|
sudo wget "https://github.com/vrana/adminer/releases/download/v$ADMINER_VERSION/adminer-$ADMINER_VERSION.php" -O /var/www/adminer/index.php
|
||||||
|
|
||||||
|
|
||||||
# Configuration de Nginx pour Adminer
|
# Configuration de Nginx pour Adminer
|
||||||
echo "[4/6] Configuration de Nginx..."
|
echo "[4/6] Configuration de Nginx..."
|
||||||
sudo bash -c "
|
sudo usermod -aG www-data rpi4
|
||||||
cat > /etc/nginx/sites-available/adminer <<'END'
|
sudo ln -s $ETC/nginx_service.conf /etc/nginx/sites-enabled/
|
||||||
server {
|
|
||||||
listen 81;
|
|
||||||
server_name scanner.local;
|
|
||||||
|
|
||||||
root /var/www/adminer;
|
sudo chown -R www-data:www-data /var/www/adminer/
|
||||||
index index.php;
|
sudo chmod -R 755 /var/www/adminer/
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files \$uri \$uri/ =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
include snippets/fastcgi-php.conf;
|
|
||||||
fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;
|
|
||||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
|
||||||
include fastcgi_params;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
END"
|
|
||||||
|
|
||||||
# Activation du site Nginx
|
# Activation du site Nginx
|
||||||
sudo ln -s /etc/nginx/sites-available/adminer /etc/nginx/sites-enabled/
|
|
||||||
sudo nginx -t # Teste la configuration Nginx
|
sudo nginx -t # Teste la configuration Nginx
|
||||||
|
|
||||||
# Redémarrage des services
|
# Redémarrage des services
|
||||||
@@ -77,6 +63,7 @@ echo "Version de PHP utilisée : $PHP_VERSION"
|
|||||||
echo "Ajouter 'scanner.local' au fichier hosts:"
|
echo "Ajouter 'scanner.local' au fichier hosts:"
|
||||||
echo " linux : /etc/hosts"
|
echo " linux : /etc/hosts"
|
||||||
echo " windows: C:\Windows\System32\drivers\etc\hosts"
|
echo " windows: C:\Windows\System32\drivers\etc\hosts"
|
||||||
|
echo " mac: /private/etc/hosts"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Pour accéder à Adminer depuis cette machine:"
|
echo "Pour accéder à Adminer depuis cette machine:"
|
||||||
echo " http://scanner.local:81"
|
echo " http://scanner.local:81"
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# nginx.conf
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name scanner.local;
|
||||||
|
|
||||||
|
keepalive_timeout 5;
|
||||||
|
client_max_body_size 4G;
|
||||||
|
|
||||||
|
# ---- Static
|
||||||
|
location /static/ {
|
||||||
|
alias /home/rpi4/PlanarianScanner/test_tube_scanner/staticfiles/;
|
||||||
|
expires 30d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
location /favicon.ico {
|
||||||
|
alias /home/rpi4/PlanarianScanner/test_tube_scanner/staticfiles/img/logo.png;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---- Media
|
||||||
|
location /media/ {
|
||||||
|
alias /home/rpi4/PlanarianScanner/test_tube_scanner/media/;
|
||||||
|
expires 30d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---- WebSocket
|
||||||
|
location /ws/ {
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_read_timeout 86400; # Temps de timeout long pour les WebSockets
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---- Django HTTP
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:8000; # Port par défaut de Daphne
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /adminer/ {
|
||||||
|
alias /var/www/adminer/;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ redirect_stderr=true
|
|||||||
process_name=%(program_name)s
|
process_name=%(program_name)s
|
||||||
priority=900
|
priority=900
|
||||||
directory=/home/rpi4/PlanarianScanner/test_tube_scanner
|
directory=/home/rpi4/PlanarianScanner/test_tube_scanner
|
||||||
command=/home/rpi4/PlanarianScanner/run-workers.sh
|
command=/home/rpi4/PlanarianScanner/test_tube_scanner/run-workers.sh
|
||||||
user=rpi4
|
user=rpi4
|
||||||
group=rpi4
|
group=rpi4
|
||||||
stopasgroup=true
|
stopasgroup=true
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
APP_DIR="/home/rpi4/PlanarianScanner"
|
|
||||||
cd "$APP_DIR/test_tube_scanner"
|
|
||||||
|
|
||||||
echo "start workers"
|
|
||||||
$APP_DIR/.venv/bin/python manage.py start_workers
|
|
||||||
|
|
||||||
echo "start celery"
|
|
||||||
$APP_DIR/.venv/bin/celery -A home worker -l info
|
|
||||||
@@ -20,7 +20,7 @@ print("Django BASE_DIR:", BASE_DIR)
|
|||||||
|
|
||||||
PACKAGE_DIR = BASE_DIR.parent
|
PACKAGE_DIR = BASE_DIR.parent
|
||||||
APP_DATAS = PACKAGE_DIR / config('APP_DATAS')
|
APP_DATAS = PACKAGE_DIR / config('APP_DATAS')
|
||||||
print("Django application data:", APP_DATAS)
|
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
@@ -215,9 +215,13 @@ LOCALE_PATHS = (
|
|||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
STATIC_ROOT = APP_DATAS / 'staticfiles'
|
STATIC_ROOT = APP_DATAS / 'staticfiles'
|
||||||
|
print("Django application STATIC_ROOT:", STATIC_ROOT)
|
||||||
|
|
||||||
|
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = APP_DATAS / 'media'
|
MEDIA_ROOT = APP_DATAS / 'media'
|
||||||
|
print("Django application MEDIA_ROOT:", MEDIA_ROOT)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
@@ -259,7 +263,7 @@ LOGGING = None if not IS_LOGGING else {
|
|||||||
"encoding" : "utf-8",
|
"encoding" : "utf-8",
|
||||||
},
|
},
|
||||||
'file': {
|
'file': {
|
||||||
'level': 'INFO',
|
'level': 'DEBUG',
|
||||||
'class':'logging.handlers.RotatingFileHandler',
|
'class':'logging.handlers.RotatingFileHandler',
|
||||||
'filename': BASE_DIR / "logs" / LOGGING_FILE,
|
'filename': BASE_DIR / "logs" / LOGGING_FILE,
|
||||||
'maxBytes': 1024*1024*15, # 15MB
|
'maxBytes': 1024*1024*15, # 15MB
|
||||||
@@ -270,9 +274,9 @@ LOGGING = None if not IS_LOGGING else {
|
|||||||
'console': {'class': 'logging.StreamHandler',},
|
'console': {'class': 'logging.StreamHandler',},
|
||||||
},
|
},
|
||||||
'loggers': {
|
'loggers': {
|
||||||
"django": {"handlers": ["null"], "level": "ERROR", "propagate": False,},
|
"django": {"handlers": ["file"], "level": "ERROR", "propagate": False,},
|
||||||
"uvicorn": {"handlers": ["null"], "level": "ERROR", "propagate": False,},
|
"uvicorn": {"handlers": ["file"], "level": "ERROR", "propagate": False,},
|
||||||
"daphne": {"handlers": ["null"], "level": "ERROR", "propagate": False,},
|
"daphne": {"handlers": ["file"], "level": "ERROR", "propagate": False,},
|
||||||
'axes': {"handlers": ['file',],"level": "INFO", "propagate": True, },
|
'axes': {"handlers": ['file',],"level": "INFO", "propagate": True, },
|
||||||
"celery": {"handlers": ["celery_file"], "level": "INFO", "propagate": False,},
|
"celery": {"handlers": ["celery_file"], "level": "INFO", "propagate": False,},
|
||||||
"celery.task": {"handlers": ["celery_file"], "level": "INFO", "propagate": False, },
|
"celery.task": {"handlers": ["celery_file"], "level": "INFO", "propagate": False, },
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends 'dashboard/base.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block main_content %}
|
{% block content %}
|
||||||
<div class="w3-black w3-border w3-div-center" style="margin: 10em; height: 20em">
|
<div class="w3-black w3-border w3-div-center" style="margin: 10em; height: 20em">
|
||||||
{% block main-bar %}
|
{% block main-bar %}
|
||||||
<div class="w3-orange">
|
<div class="w3-orange">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends 'dashboard/base.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block main_content %}
|
{% block content %}
|
||||||
<div class="w3-black w3-border w3-div-center" style="margin: 10em; height: 20em">
|
<div class="w3-black w3-border w3-div-center" style="margin: 10em; height: 20em">
|
||||||
{% block main-bar %}
|
{% block main-bar %}
|
||||||
<div class="w3-orange">
|
<div class="w3-orange">
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ urlpatterns += i18n_patterns(
|
|||||||
path('login/', auth_views.LoginView.as_view(template_name='admin/login.html'), name='login'),
|
path('login/', auth_views.LoginView.as_view(template_name='admin/login.html'), name='login'),
|
||||||
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
|
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
|
||||||
|
|
||||||
path('', RedirectView.as_view(url='/scanner/main/', permanent=True), name='redirect_to_mainboard'),
|
path('', RedirectView.as_view(url='/scanner/calibration/', permanent=True), name='redirect_to_mainboard'),
|
||||||
path('scanner/', include('scanner.urls', namespace='scanner')),
|
path('scanner/', include('scanner.urls', namespace='scanner')),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "start workers"
|
||||||
|
../.venv/bin/python manage.py start_workers
|
||||||
|
|
||||||
|
echo "start celery"
|
||||||
|
../.venv/bin/celery -A home worker -l info
|
||||||
@@ -77,10 +77,10 @@
|
|||||||
<a href="{% url 'scanner:reductstore' %}" class="w3-bar-item w3-btn w3-hover-opacity w3-margin-left">
|
<a href="{% url 'scanner:reductstore' %}" class="w3-bar-item w3-btn w3-hover-opacity w3-margin-left">
|
||||||
<img class="w3-no-padding" src="/static/img/reductstore.png" style="width: 24px"> {% trans "Base de données Reductstore" %}
|
<img class="w3-no-padding" src="/static/img/reductstore.png" style="width: 24px"> {% trans "Base de données Reductstore" %}
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url 'scanner:adminer' %}" class="w3-bar-item w3-btn w3-hover-opacity w3-margin-left">
|
<a href="{% url 'scanner:adminer' %}" class="w3-bar-item w3-btn w3-hover-opacity w3-margin-left" target="_blank">
|
||||||
<img class="w3-no-padding" src="/static/img/adminer.png" style="width: 28px"> {% trans "Base de données mariadb" %}
|
<img class="w3-no-padding" src="/static/img/adminer.png" style="width: 28px"> {% trans "Base de données mariadb" %}
|
||||||
</a>
|
</a>
|
||||||
<!--a href="{% url 'scanner:portainer' %}" class="w3-bar-item w3-btn w3-hover-opacity" w3-margin-left>
|
<!--a href="{% url 'scanner:portainer' %}" class="w3-bar-item w3-btn w3-hover-opacity" w3-margin-left target="_blank">
|
||||||
<img class="w3-no-padding" src="/static/img/portainer.png" style="width: 28px"> {% trans "Portainer" %}
|
<img class="w3-no-padding" src="/static/img/portainer.png" style="width: 28px"> {% trans "Portainer" %}
|
||||||
</a-->
|
</a-->
|
||||||
<a href="{% url 'scanner:supervisor' %}" class="w3-bar-item w3-btn w3-hover-opacity w3-margin-left">
|
<a href="{% url 'scanner:supervisor' %}" class="w3-bar-item w3-btn w3-hover-opacity w3-margin-left">
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ from . import views
|
|||||||
app_name = "scanner"
|
app_name = "scanner"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('scanner/admin/', views.admin_view, name='admin'),
|
path('admin/', views.admin_view, name='admin'),
|
||||||
path('scanner/reductstore/', views.reductstore_view, name='reductstore'),
|
path('reductstore/', views.reductstore_view, name='reductstore'),
|
||||||
path('scanner/adminer/', views.adminer_view, name='adminer'),
|
path('adminer/', views.adminer_view, name='adminer'),
|
||||||
path('scanner/portainer/', views.portainer_view, name='portainer'),
|
path('portainer/', views.portainer_view, name='portainer'),
|
||||||
path('scanner/calibration/', views.calibration_view, name='calibration'),
|
path('calibration/', views.calibration_view, name='calibration'),
|
||||||
path('scanner/supervisor/', views.supervisor_view, name='supervisor'),
|
path('supervisor/', views.supervisor_view, name='supervisor'),
|
||||||
path('scanner/logs/worker', views.supervisor_worker, name='logs_worker'),
|
path('logs/worker', views.supervisor_worker, name='logs_worker'),
|
||||||
path('scanner/logs/scheduler', views.supervisor_scheduler, name='logs_scheduler'),
|
path('logs/scheduler', views.supervisor_scheduler, name='logs_scheduler'),
|
||||||
|
|
||||||
path('main/', views.main_view, name='main'),
|
path('main/', views.main_view, name='main'),
|
||||||
path('scanner/images/', views.images_view, name='images'),
|
path('images/', views.images_view, name='images'),
|
||||||
path('scanner/replay/', views.replay_view, name='replay'),
|
path('replay/', views.replay_view, name='replay'),
|
||||||
path('api/stats/', views.stats_view, name='api_stats'),
|
path('api/stats/', views.stats_view, name='api_stats'),
|
||||||
path('api/video/', views.download_api, name='download_api'),
|
path('api/video/', views.download_api, name='download_api'),
|
||||||
path('api/export/', views.export_api, name='export_api'),
|
path('api/export/', views.export_api, name='export_api'),
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def reductstore_view(request):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def adminer_view(request):
|
def adminer_view(request):
|
||||||
return render(request, "scanner/iframe.html", context=global_context(request, link=f'http://{settings.DOMAIN_SERVER}:81/'))
|
return render(request, "scanner/redirection.html", context=global_context(request, link=f'http://{settings.DOMAIN_SERVER}/adminer/'))
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def portainer_view(request):
|
def portainer_view(request):
|
||||||
|
|||||||
Reference in New Issue
Block a user