12 - Ubuntu Server Installation
Overview
Architecture Diagram
┌──────────────────────────────────────────────────────────────────────────────┐
│ Ubuntu Server Architecture │
└──────────────────────────────────────────────────────────────────────────────┘
Internet
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ Nginx (Reverse Proxy) │
│ Port 80/443 │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ - SSL termination (Let's Encrypt) │ │
│ │ - HTTP → HTTPS redirect │ │
│ │ - WebSocket upgrade support │ │
│ │ - Static file serving │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────┐
│ OpenAlgo (Gunicorn + WebSocket) │
│ │
│ Flask App ─────────── localhost:5000 │
│ WebSocket Thread ──── localhost:8765 │
│ │
│ systemd: openalgo │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ File System │
│ │
│ /opt/openalgo/ │
│ ├── .venv/ # Virtual environment │
│ ├── db/ # SQLite databases │
│ ├── log/ # Application logs │
│ ├── strategies/ # User strategies │
│ ├── .env # Configuration │
│ └── app.py # Main application │
└─────────────────────────────────────────────────────────────────────────────┘Prerequisites
Installation Steps
1. Clone Repository
2. Setup Python Environment
3. Configure Environment
4. Build Frontend
5. Create Systemd Service
6. Set Permissions
7. Configure Nginx
8. Enable Service
9. Setup SSL (Let's Encrypt)
Service Management
Firewall Configuration
Update Procedure
Troubleshooting
Issue
Solution
Key Files Reference
File
Purpose
Last updated