Access:
ssh -p 2223 user@ms.e-bash.ru# Backend control
./backend.sh start # Start
./backend.sh stop # Stop
./backend.sh restart # Restart
./backend.sh logs # View logs
./backend.sh status # Check status
# Frontend is served as static files via Nginx
# To rebuild: cd frontend && npm run build
sudo systemctl status postgresql
sudo systemctl status clickhouse-server
sudo systemctl status redis
sudo systemctl status nginx
superadmin@mybeacon.comsuperadmin123PostgreSQL:
sudo -u postgres psql -d mybeacon
ClickHouse:
clickhouse-client --database mybeacon
Redis:
redis-cli
~/mybeacon-backend/
├── backend/ # Python FastAPI backend
│ ├── app/ # Source code
│ │ ├── api/ # API endpoints
│ │ ├── models/ # SQLAlchemy models
│ │ ├── core/ # Core settings, security, database
│ │ └── main.py # App entry point
│ ├── alembic/ # Database migrations
│ ├── pyproject.toml # Python dependencies
│ └── .env # Config (SECRET_KEY, DATABASE_URL)
├── frontend/ # Vue 3 frontend
│ ├── src/ # Source code
│ │ ├── api/ # API clients
│ │ ├── views/ # Page components
│ │ ├── router/ # Vue Router
│ │ └── i18n/ # Translations (RU/EN)
│ ├── dist/ # Production build (served by nginx)
│ └── package.json # Node dependencies
├── backend.sh # Backend control script
└── scripts/ # Deployment scripts
└── deploy.sh # Deploy from local machine
Clone the repo:
git clone https://h2.e-bash.ru/root/mybeacon-backend.git
cd mybeacon-backend
Work on your changes locally
Deploy to dev container:
./scripts/deploy.sh
# or
./scripts/deploy.sh --backend-only # Only restart backend
./scripts/deploy.sh --skip-build # Skip frontend build
cd backend
# Install dependencies
poetry install
# Run migrations
poetry run alembic upgrade head
poetry run alembic revision --autogenerate -m "description"
# Run dev server (with auto-reload)
poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
# Format code
poetry run black app/
poetry run ruff app/
cd frontend
# Install dependencies
npm install
# Run dev server (with HMR)
./start.sh dev
# Build and deploy to nginx (RECOMMENDED)
./start.sh deploy
# Build only (without deploy)
./start.sh build
IMPORTANT: Frontend is served by nginx from /var/www/mybeacon/frontend.
After building, you MUST deploy to nginx:
./start.sh deploy # Build + copy to nginx
POST /api/v1/auth/login - Login (get JWT tokens)POST /api/v1/auth/refresh - Refresh access tokenGET /api/v1/auth/me - Current user infoGET/POST /api/v1/superadmin/devices - Manage all devicesGET/POST /api/v1/superadmin/organizations - Manage organizationsGET/POST /api/v1/superadmin/users - Manage usersGET/POST /api/v1/superadmin/settings/auto-registration - Toggle device registrationPOST /api/v1/registration - Register new deviceGET /api/v1/config?device_id=MAC - Get device configPOST /api/v1/ble - Upload BLE eventsPOST /api/v1/wifi - Upload WiFi events./backend.sh logs # Check logs
sudo -u postgres psql -d mybeacon # Check DB connection
pkill -f uvicorn # Kill zombie processes
cd frontend
npm run build # Rebuild frontend
# Nginx serves static files from dist/
sudo netstat -tlnp | grep -E '8000|5432|8123|6379|80'
./backend.sh logs # Backend logs
sudo tail -f /var/log/nginx/error.log # Nginx logs
Nginx is configured as reverse proxy:
/ → Frontend static files from frontend/dist//api/ → Backend at localhost:8000/docs → Swagger UI/redoc → ReDocConfig: /etc/nginx/sites-enabled/mybeacon
# On local machine
git add .
git commit -m "Your message"
git push origin master
# Deploy
./scripts/deploy.sh
# Or manually on server
ssh -p 2223 user@ms.e-bash.ru
cd ~/mybeacon-backend
git pull
./backend.sh restart