117 lines
2.9 KiB
Markdown
117 lines
2.9 KiB
Markdown
# Deployment Guide
|
|
|
|
This guide covers deploying Crypto Trader in various environments.
|
|
|
|
## Table of Contents
|
|
|
|
1. [AppImage Deployment](appimage.md) - Building and distributing AppImage
|
|
2. [Bluefin Linux](bluefin.md) - Bluefin Linux specific instructions
|
|
3. [PostgreSQL Setup](postgresql.md) - PostgreSQL configuration
|
|
4. [Updates](updates.md) - Update mechanism and versioning
|
|
|
|
## Deployment Options
|
|
|
|
### AppImage (Recommended)
|
|
|
|
- Single executable file
|
|
- No installation required
|
|
- Portable across Linux distributions
|
|
- Includes all dependencies
|
|
|
|
### From Source
|
|
|
|
- Full control over installation
|
|
- Customizable configuration
|
|
- Development and production use
|
|
|
|
## System Requirements
|
|
|
|
- **OS**: Linux (Bluefin recommended), macOS, Windows
|
|
- **Python**: 3.11+ (for source installation)
|
|
- **Node.js**: 18+ (for frontend)
|
|
- **Memory**: 4GB minimum, 8GB recommended
|
|
- **Storage**: 1GB+ for application and data
|
|
- **Network**: Internet connection required
|
|
- **Redis**: Version 5.0+ (for state management)
|
|
- **PostgreSQL**: Version 14+ (for database)
|
|
|
|
## Quick Deployment
|
|
|
|
### AppImage
|
|
|
|
1. Download AppImage
|
|
2. Make executable: `chmod +x crypto_trader-*.AppImage`
|
|
3. Run: `./crypto_trader-*.AppImage`
|
|
|
|
### From Source
|
|
|
|
1. Clone repository
|
|
2. Install dependencies: `pip install -r requirements.txt`
|
|
3. Install frontend dependencies: `cd frontend && npm install`
|
|
4. Start Redis (see Redis section below for options)
|
|
5. Start Celery worker: `celery -A src.worker.app worker --loglevel=info &`
|
|
6. Start backend: `uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000 &`
|
|
7. Start frontend: `cd frontend && npm run dev`
|
|
|
|
Or use the helper script:
|
|
```bash
|
|
./scripts/start_all.sh
|
|
```
|
|
|
|
## Required Services
|
|
|
|
### Redis
|
|
|
|
Redis is required for distributed state management and Celery background tasks (e.g., ML model training).
|
|
|
|
```bash
|
|
# Install (Ubuntu/Debian)
|
|
sudo apt-get install redis-server
|
|
```
|
|
|
|
**Starting Redis**:
|
|
|
|
```bash
|
|
# Option 1: Using system service (requires sudo)
|
|
sudo service redis-server start
|
|
|
|
# Option 2: Direct daemon mode (for containers/restricted environments)
|
|
redis-server --daemonize yes
|
|
|
|
# Verify
|
|
redis-cli ping # Should return PONG
|
|
```
|
|
|
|
> **Note**: In containerized environments (Toolbox, Distrobox, etc.) where `sudo` is not available, use the direct daemon mode option.
|
|
|
|
### Celery Worker
|
|
|
|
Celery handles background tasks like ML training:
|
|
|
|
```bash
|
|
# Start worker
|
|
celery -A src.worker.app worker --loglevel=info
|
|
|
|
# Start with specific queues
|
|
celery -A src.worker.app worker -Q ml_training,celery --loglevel=info
|
|
```
|
|
|
|
## Post-Deployment
|
|
|
|
After deployment:
|
|
|
|
1. Configure exchanges
|
|
2. Set up risk management
|
|
3. Verify Redis connection: `python scripts/verify_redis.py`
|
|
4. Test with paper trading
|
|
5. Review configuration
|
|
6. Start with small positions
|
|
|
|
## Production Considerations
|
|
|
|
- Use a process manager (systemd, supervisor) for services
|
|
- Configure Redis persistence (AOF or RDB)
|
|
- Set up monitoring and alerting
|
|
- Enable HTTPS for the API
|
|
- Configure proper firewall rules
|