# Quick Start Guide

Schneller Start für den Releasebird Image Service.

## 🚀 Schnellstart (5 Minuten)

### 1. Puppeteer Service starten

```bash
cd backend-image-service
docker-compose up -d
```

**Warten bis Service bereit ist (ca. 30-40 Sekunden):**

```bash
# Health Check
curl http://localhost:3000/health
```

Erwartete Ausgabe:
```json
{
  "status": "healthy",
  "browser": "connected"
}
```

### 2. Image-Service testen

```bash
# Test-Script ausführen
./test-image.sh

# Oder manuell:
curl -X POST http://localhost:3000/render \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<!DOCTYPE html><html><body><h1>Hello World</h1></body></html>",
    "width": 1280,
    "height": 720
  }'
```

### 3. Spring Boot Integration

#### Kopiere die Java-Dateien:

```bash
# Struktur:
your-spring-boot-project/
└── src/main/java/com/releasebird/api/
    ├── controller/
    │   └── ImageController.java
    └── config/
        └── RestTemplateConfig.java
```

#### Konfiguriere `application.properties`:

```properties
image.service.url=http://localhost:3000
```

#### Starte Spring Boot und teste:

```bash
# Spring Boot starten
mvn spring-boot:run

# Testen
curl -X POST http://localhost:8080/ewidget/image/render \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<!DOCTYPE html><html><body><h1>Test via Spring Boot</h1></body></html>",
    "width": 1280,
    "height": 720
  }'
```

## 🎯 Nächste Schritte

1. **Frontend SDK deployen**: Die `build/index.js` enthält bereits die Integration
2. **Monitoring einrichten**: Nutze `/health` Endpoints
3. **Production Deployment**: Siehe [README.md](README.md) für Details

## 📊 Service URLs

| Service | URL | Zweck |
|---------|-----|-------|
| Puppeteer Service | http://localhost:3000 | Image Rendering |
| Puppeteer Health | http://localhost:3000/health | Health Check |
| Spring Boot API | http://localhost:8080 | API Gateway |
| Spring Boot Health | http://localhost:8080/actuator/health | Health Check |

## 🛠️ Entwicklung ohne Docker

### Puppeteer Service lokal:

```bash
cd image-service
npm install
npm start
```

### Spring Boot lokal:

```bash
cd spring-boot
mvn spring-boot:run
```

## ❓ Troubleshooting

### Port 3000 bereits belegt

```bash
# Finde Prozess
lsof -i :3000

# Oder ändere Port in docker-compose.yml:
ports:
  - "3001:3000"  # Host:Container
```

### Browser startet nicht

```bash
# Docker Logs prüfen
docker-compose logs -f

# Container neu starten
docker-compose restart
```

### Out of Memory

```bash
# Mehr Memory in docker-compose.yml:
deploy:
  resources:
    limits:
      memory: 4G  # Erhöht auf 4GB
```

## 📝 Weitere Dokumentation

- [README.md](README.md) - Vollständige Dokumentation
- [Docker Compose Konfiguration](docker-compose.yml)
- [Kubernetes Deployment](kubernetes/)
