fix: убрана кнопка десктоп-диагностики, версия на странице
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
# Деплой Elmer на obdai.ru
|
||||
set -e
|
||||
|
||||
echo "=== Установка пакетов ==="
|
||||
apt update && apt install -y python3-pip python3-venv nginx certbot python3-certbot-nginx
|
||||
|
||||
echo "=== Клонирование репо ==="
|
||||
cd /opt
|
||||
git clone https://gitea.services.ngcloud.ru/Nail/elmer.git || (cd elmer && git pull)
|
||||
cd elmer
|
||||
git checkout fat-client
|
||||
|
||||
echo "=== Виртуальное окружение ==="
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
pip install gunicorn
|
||||
|
||||
echo "=== Конфигурация ==="
|
||||
cp config.yaml config.yaml.bak
|
||||
cat > config.yaml << 'YAML'
|
||||
elm327:
|
||||
port: /dev/rfcomm0
|
||||
baudrate: 38400
|
||||
|
||||
llm:
|
||||
api_key: "sk-ucI5YvOticoOQ9Kuj5K9mQ"
|
||||
model: "gpt-oss-120b"
|
||||
base_url: "https://api.aillm.ru/v1"
|
||||
|
||||
pids:
|
||||
"0105": ["coolant_temp", "°C"]
|
||||
"010C": ["rpm", "об/мин"]
|
||||
"010D": ["speed", "км/ч"]
|
||||
YAML
|
||||
|
||||
echo "=== Systemd сервис ==="
|
||||
cat > /etc/systemd/system/elmer.service << 'UNIT'
|
||||
[Unit]
|
||||
Description=Elmer Flask API
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=naeel
|
||||
WorkingDirectory=/opt/elmer
|
||||
ExecStart=/opt/elmer/venv/bin/gunicorn -w 4 -b 127.0.0.1:8000 web.app:app
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
UNIT
|
||||
|
||||
echo "=== Nginx ==="
|
||||
cat > /etc/nginx/sites-available/elmer << 'NGX'
|
||||
server {
|
||||
listen 80;
|
||||
server_name obdai.ru www.obdai.ru ai.obdai.ru test.obdai.ru;
|
||||
|
||||
location /static/ {
|
||||
alias /opt/elmer/web/static/;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
}
|
||||
NGX
|
||||
|
||||
ln -sf /etc/nginx/sites-available/elmer /etc/nginx/sites-enabled/
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
nginx -t && systemctl reload nginx
|
||||
|
||||
echo "=== SSL ==="
|
||||
certbot --nginx -d obdai.ru -d www.obdai.ru --non-interactive --agree-tos -m tazet@narod.ru || true
|
||||
|
||||
echo "=== Запуск ==="
|
||||
systemctl daemon-reload
|
||||
systemctl enable elmer
|
||||
systemctl restart elmer
|
||||
systemctl restart nginx
|
||||
|
||||
echo "=== ГОТОВО ==="
|
||||
curl -s http://obdai.ru/api/v1/script | head -c 50
|
||||
Reference in New Issue
Block a user