From 06a4a1639315dfc3a7ebe9c309da8eb121c43e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Fri, 8 May 2026 15:23:51 +0900 Subject: [PATCH] Add Raspberry Pi setup guide --- docs/RASPBERRY_PI.md | 73 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 docs/RASPBERRY_PI.md diff --git a/docs/RASPBERRY_PI.md b/docs/RASPBERRY_PI.md new file mode 100644 index 0000000..b483de7 --- /dev/null +++ b/docs/RASPBERRY_PI.md @@ -0,0 +1,73 @@ +# Raspberry Pi 3B setup + +Recommended OS: + +```text +Raspberry Pi OS Lite 32-bit +``` + +## Base packages + +```bash +sudo apt update +sudo apt upgrade -y +sudo apt install -y git curl sqlite3 ufw fail2ban rsync +``` + +## Node.js + +Use Node.js 20 LTS where possible. If the Pi 3B feels too tight on RAM, Node.js 18 LTS can be used for MVP. + +## Clone project + +```bash +git clone https://github.com/viktor138irk/chat.git +cd chat +npm install +``` + +## Backend config + +```bash +cp backend/.env.example backend/.env +nano backend/.env +``` + +Important values: + +```env +APP_HOST=0.0.0.0 +APP_PORT=3000 +DATABASE_PATH=./data/chat.sqlite +PUBLIC_API_URL=https://api.example.ru +PUBLIC_WS_URL=wss://api.example.ru/ws +``` + +## Run backend + +Development: + +```bash +npm run dev:backend +``` + +Production with PM2: + +```bash +sudo npm install -g pm2 +pm2 start backend/src/server.js --name raspi-chat-backend +pm2 save +pm2 startup +``` + +## Network model + +Preferred production model: + +```text +VPS public internet + -> WireGuard + -> Raspberry Pi backend on 10.8.0.2:3000 +``` + +Do not expose Node.js port 3000 directly to the public internet.