# Deployment Guide (VPS / Docker)

This guide explains how to deploy the Crypto Algo Platform on a Virtual Private Server (VPS) or Dedicated Server using **Docker** and **Docker Compose**. This is the recommended method for stability.

**See [SHARED_HOSTING.md](SHARED_HOSTING.md) if you are deploying to a shared host (cPanel, etc.) with no root access.**

## Prerequisites
- A Linux server (Ubuntu 20.04/22.04 recommended).
- [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) installed.

## Installation

### 1. Clone the Repository
```bash
git clone https://github.com/yourusername/crypto-algo-platform.git
cd crypto-algo-platform
```

### 2. Configure Environment
Copy the example environment file and configure it:
```bash
cp .env.example .env
nano .env
```
Ensure `DB_HOST` is set to `db` (the name of the database service in docker-compose.yml) if you are using the containerized database.

### 3. Build and Run
Start the application services in the background:
```bash
docker-compose up -d --build
```

### 4. Verify Status
Check if all containers are running:
```bash
docker-compose ps
```
You should see `crypto_market_data`, `crypto_trade_monitor`, `crypto_telegram_bot`, and `crypto_db` as "Up".

### 5. View Logs
To check the logs of a specific service:
```bash
# Market Data Logs
docker-compose logs -f market-data

# Trade Monitor Logs
docker-compose logs -f trade-monitor
```

## Maintenance

### Stopping the App
```bash
docker-compose down
```

### Updating the App
```bash
git pull
docker-compose up -d --build
```
