- PR1: Project scaffold, DB models, price loader - PR2: Congressional trade ingestion (House Stock Watcher) - PR3: Security enrichment + deployment infrastructure - 37 passing tests, 87%+ coverage - Docker + Proxmox deployment ready - Complete documentation - Works 100% offline with fixtures
274 lines
5.0 KiB
Markdown
274 lines
5.0 KiB
Markdown
# Proxmox Quick Start ⚡
|
|
|
|
**Got Proxmox? Deploy POTE in 5 minutes!**
|
|
|
|
---
|
|
|
|
## TL;DR (Super Quick)
|
|
|
|
```bash
|
|
# 1. Create Ubuntu 22.04 LXC container (2GB RAM, 2 cores, 8GB disk)
|
|
|
|
# 2. Enter container and run:
|
|
curl -fsSL https://raw.githubusercontent.com/your-repo/pote/main/scripts/proxmox_setup.sh | sudo bash
|
|
|
|
# 3. Switch to app user and test:
|
|
su - poteapp
|
|
cd pote && source venv/bin/activate
|
|
python scripts/ingest_from_fixtures.py
|
|
|
|
# Done! ✅
|
|
```
|
|
|
|
---
|
|
|
|
## Step-by-Step (10 minutes)
|
|
|
|
### 1. Create LXC Container
|
|
|
|
**Via Proxmox Web UI**:
|
|
1. Click "Create CT"
|
|
2. Template: Ubuntu 22.04
|
|
3. Hostname: `pote`
|
|
4. Memory: 2048 MB
|
|
5. CPU cores: 2
|
|
6. Disk: 8 GB
|
|
7. Network: Bridge, DHCP
|
|
8. Create!
|
|
|
|
**Via Command Line** (on Proxmox host):
|
|
```bash
|
|
pct create 100 local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst \
|
|
--hostname pote \
|
|
--memory 2048 \
|
|
--cores 2 \
|
|
--rootfs local-lvm:8 \
|
|
--net0 name=eth0,bridge=vmbr0,ip=dhcp \
|
|
--unprivileged 1
|
|
|
|
pct start 100
|
|
```
|
|
|
|
### 2. Enter Container
|
|
|
|
```bash
|
|
pct enter 100
|
|
# Or SSH: ssh root@container-ip
|
|
```
|
|
|
|
### 3. Run Setup Script
|
|
|
|
```bash
|
|
# Option A: If repo already cloned
|
|
cd /path/to/pote
|
|
sudo bash scripts/proxmox_setup.sh
|
|
|
|
# Option B: Download and run
|
|
curl -fsSL https://your-repo/scripts/proxmox_setup.sh | sudo bash
|
|
```
|
|
|
|
### 4. Test It!
|
|
|
|
```bash
|
|
# Switch to app user
|
|
su - poteapp
|
|
|
|
# Activate venv
|
|
cd pote
|
|
source venv/bin/activate
|
|
|
|
# Test with fixtures (offline)
|
|
python scripts/ingest_from_fixtures.py
|
|
|
|
# Should see:
|
|
# ✓ Officials created: 4
|
|
# ✓ Trades ingested: 5
|
|
```
|
|
|
|
### 5. Setup Cron Jobs
|
|
|
|
```bash
|
|
# As poteapp user
|
|
crontab -e
|
|
|
|
# Add these lines:
|
|
0 6 * * * cd /home/poteapp/pote && /home/poteapp/pote/venv/bin/python scripts/fetch_congressional_trades.py --days 7 >> /home/poteapp/logs/trades.log 2>&1
|
|
15 6 * * * cd /home/poteapp/pote && /home/poteapp/pote/venv/bin/python scripts/enrich_securities.py >> /home/poteapp/logs/enrich.log 2>&1
|
|
```
|
|
|
|
### 6. Done! 🎉
|
|
|
|
Your POTE instance is now running and will:
|
|
- Fetch congressional trades daily at 6 AM
|
|
- Enrich securities daily at 6:15 AM
|
|
- Store everything in PostgreSQL
|
|
|
|
---
|
|
|
|
## What You Get
|
|
|
|
✅ **Full PostgreSQL database**
|
|
✅ **Automated daily updates** (via cron)
|
|
✅ **Isolated environment** (LXC container)
|
|
✅ **Easy backups** (Proxmox snapshots)
|
|
✅ **Low resource usage** (~500MB RAM)
|
|
✅ **Cost**: Just electricity (~$5-10/mo)
|
|
|
|
---
|
|
|
|
## Quick Commands
|
|
|
|
```bash
|
|
# Enter container
|
|
pct enter 100
|
|
|
|
# Check status
|
|
systemctl status postgresql
|
|
|
|
# View logs
|
|
tail -f /home/poteapp/logs/trades.log
|
|
|
|
# Manual ingestion
|
|
su - poteapp
|
|
cd pote && source venv/bin/activate
|
|
python scripts/fetch_congressional_trades.py --days 30
|
|
|
|
# Database backup
|
|
sudo -u postgres pg_dump pote > backup.sql
|
|
|
|
# Check database size
|
|
sudo -u postgres psql -c "SELECT pg_size_pretty(pg_database_size('pote'));"
|
|
```
|
|
|
|
---
|
|
|
|
## Resource Usage
|
|
|
|
**Idle**:
|
|
- RAM: ~500 MB
|
|
- CPU: <1%
|
|
- Disk: ~2 GB
|
|
|
|
**During ingestion**:
|
|
- RAM: ~800 MB
|
|
- CPU: 10-20%
|
|
- Duration: ~30 seconds
|
|
|
|
**After 1 month**:
|
|
- Disk: ~3-4 GB
|
|
- Database: ~500 MB
|
|
|
|
---
|
|
|
|
## Maintenance
|
|
|
|
### Weekly
|
|
```bash
|
|
# Backup database
|
|
pct exec 100 -- sudo -u postgres pg_dump pote > pote_backup_$(date +%Y%m%d).sql
|
|
|
|
# Or via Proxmox snapshots (easier!)
|
|
# Web UI: Container → Snapshots → Take Snapshot
|
|
```
|
|
|
|
### Monthly
|
|
```bash
|
|
# Update system
|
|
pct exec 100 -- apt update && apt upgrade -y
|
|
|
|
# Vacuum database
|
|
pct exec 100 -- sudo -u postgres psql pote -c "VACUUM ANALYZE;"
|
|
|
|
# Clean old logs
|
|
pct exec 100 -- find /home/poteapp/logs -name "*.log" -mtime +30 -delete
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Can't connect to database
|
|
```bash
|
|
pct enter 100
|
|
systemctl status postgresql
|
|
# If stopped: systemctl start postgresql
|
|
```
|
|
|
|
### Out of disk space
|
|
```bash
|
|
# Check usage
|
|
pct exec 100 -- df -h
|
|
|
|
# Resize on Proxmox host
|
|
pct resize 100 rootfs +5G
|
|
```
|
|
|
|
### Cron jobs not running
|
|
```bash
|
|
# Check cron is running
|
|
pct exec 100 -- systemctl status cron
|
|
|
|
# Check crontab
|
|
pct exec 100 -- su - poteapp -c "crontab -l"
|
|
|
|
# Check logs
|
|
pct exec 100 -- tail -f /home/poteapp/logs/trades.log
|
|
```
|
|
|
|
### Python errors
|
|
```bash
|
|
# Reinstall dependencies
|
|
pct enter 100
|
|
su - poteapp
|
|
cd pote
|
|
rm -rf venv
|
|
python3.11 -m venv venv
|
|
source venv/bin/activate
|
|
pip install -e .
|
|
```
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. ✅ Container running
|
|
2. ✅ POTE installed
|
|
3. ✅ Data ingested
|
|
4. ⏭️ Setup Proxmox backups (Web UI → Datacenter → Backup)
|
|
5. ⏭️ Configure static IP (if needed)
|
|
6. ⏭️ Build Phase 2 analytics
|
|
7. ⏭️ Add FastAPI dashboard
|
|
|
|
---
|
|
|
|
## Advanced: Static IP
|
|
|
|
```bash
|
|
# On Proxmox host, edit container config
|
|
nano /etc/pve/lxc/100.conf
|
|
|
|
# Change:
|
|
net0: name=eth0,bridge=vmbr0,ip=192.168.1.50/24,gw=192.168.1.1
|
|
|
|
# Restart
|
|
pct restart 100
|
|
```
|
|
|
|
---
|
|
|
|
## Full Documentation
|
|
|
|
- **Complete guide**: [`docs/08_proxmox_deployment.md`](docs/08_proxmox_deployment.md)
|
|
- **General deployment**: [`docs/07_deployment.md`](docs/07_deployment.md)
|
|
- **Docker option**: [`docker-compose.yml`](docker-compose.yml)
|
|
|
|
---
|
|
|
|
**Your Proxmox = Enterprise infrastructure at hobby prices!** 🚀
|
|
|
|
Cost breakdown:
|
|
- Cloud VPS: $20/mo
|
|
- Your Proxmox: ~$10/mo (power)
|
|
- **Savings: $120/year** ✨
|
|
|