The Raspberry Pi automatically pulls updates from GitHub every 5 minutes and restarts the trading service when code changes are detected.
-
Clone repository on Raspberry Pi:
ssh recovery@raspberrypi.local cd ~ git clone https://github.com/YOUR_USERNAME/tradeagent.git cd tradeagent
-
Setup Python environment:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -
Configure environment:
cp .env.example .env nano .env # Edit with your API keys -
Enable auto-update:
chmod +x scripts/setup_pi_auto_update.sh ./scripts/setup_pi_auto_update.sh
That's it! The Pi will now:
- Check for GitHub updates every 5 minutes
- Automatically pull new code
- Restart the trading service if files changed
- Update dependencies if
requirements.txtchanged
View auto-update logs:
ssh recovery@raspberrypi.local
tail -f ~/tradeagent/logs/auto_update.logView trading logs:
tail -f ~/tradeagent/logs/trading.logCheck if service is running:
pgrep -f "python.*event_driven_service" && echo "Running" || echo "Stopped"Manually trigger update:
cd ~/tradeagent
./scripts/pi_auto_update.shStop service:
pkill -f "python.*event_driven_service"Start service manually:
cd ~/tradeagent
source venv/bin/activate
nohup python -m src.event_driven_service > logs/service.log 2>&1 &Disable auto-update:
crontab -l | grep -v 'pi_auto_update.sh' | crontab -- Make changes on your development machine
- Test locally:
source venv/bin/activate python -m src.event_driven_service - Commit and push to GitHub:
git add . git commit -m "Your changes" git push
- Wait up to 5 minutes - The Pi will automatically pull and restart
Auto-update not working?
# Check cron is running
crontab -l
# Check cron logs
tail -f ~/tradeagent/logs/cron.log
# Manually test update script
cd ~/tradeagent
./scripts/pi_auto_update.shService crashes?
# View service logs
tail -100 ~/tradeagent/logs/service.log
# View Python errors
tail -100 ~/tradeagent/logs/trading.logGit pull conflicts?
# Reset local changes (CAUTION: This removes local modifications)
cd ~/tradeagent
cp .env .env.backup
git reset --hard origin/main
mv .env.backup .envIf you see errors about missing tables (orchestrator_decisions, news_articles, llm_analysis_log), run:
- Go to https://supabase.com/dashboard
- Open your project
- Click "SQL Editor"
- Run
database/complete_schema.sqlOR - For just the orchestrator table:
database/create_orchestrator_table.sql
Test Supabase connection:
source venv/bin/activate
python -c "
from supabase import create_client
import os
from dotenv import load_dotenv
load_dotenv()
client = create_client(os.getenv('SUPABASE_URL'), os.getenv('SUPABASE_KEY'))
result = client.table('trades').select('*').limit(1).execute()
print('✅ Supabase connected successfully!')
"- Never commit
.envfiles - They contain API keys - .env is excluded from git sync and auto-update
- Backup your .env before major updates
- Use service keys for production, anon keys for development