feat: Rearchitect Foxy Dev Team with FastAPI, React, SQLite, and a new Telegram bot, updating deployment configurations and documentation.
This commit is contained in:
parent
a927534d16
commit
023e399d1d
@ -5,7 +5,7 @@
|
|||||||
# into a single production-ready image.
|
# into a single production-ready image.
|
||||||
#
|
#
|
||||||
# Build: docker build -t foxy-dev-team .
|
# Build: docker build -t foxy-dev-team .
|
||||||
# Run: docker run -p 8000:8000 --env-file backend/.env foxy-dev-team
|
# Run: docker run -p 7000:7000 --env-file backend/.env foxy-dev-team
|
||||||
# ═══════════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
# ─── Stage 1: Frontend Build ──────────────────────────────────────────────────
|
# ─── Stage 1: Frontend Build ──────────────────────────────────────────────────
|
||||||
@ -47,15 +47,15 @@ COPY --from=frontend-build /build/dist ./static
|
|||||||
|
|
||||||
# Healthcheck
|
# Healthcheck
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
CMD curl -f http://localhost:8000/api/health || exit 1
|
CMD curl -f http://localhost:7000/api/health || exit 1
|
||||||
|
|
||||||
# Runtime config
|
# Runtime config
|
||||||
ENV PYTHONUNBUFFERED=1 \
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
PYTHONDONTWRITEBYTECODE=1 \
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
LOG_LEVEL=info
|
LOG_LEVEL=info
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 7000
|
||||||
|
|
||||||
USER foxy
|
USER foxy
|
||||||
|
|
||||||
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7000"]
|
||||||
|
|||||||
18
README.md
18
README.md
@ -167,7 +167,7 @@ cd foxy-dev-team
|
|||||||
cd backend
|
cd backend
|
||||||
cp .env.example .env # ⚠️ Éditer avec vos valeurs !
|
cp .env.example .env # ⚠️ Éditer avec vos valeurs !
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
python -m uvicorn app.main:app --port 8000 --reload
|
python -m uvicorn app.main:app --port 7000 --reload
|
||||||
|
|
||||||
# 3. Frontend (nouveau terminal)
|
# 3. Frontend (nouveau terminal)
|
||||||
cd frontend
|
cd frontend
|
||||||
@ -233,7 +233,7 @@ docker build -t foxy-dev-team .
|
|||||||
# Exécuter
|
# Exécuter
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name foxy-api \
|
--name foxy-api \
|
||||||
-p 8000:8000 \
|
-p 7000:7000 \
|
||||||
--env-file backend/.env \
|
--env-file backend/.env \
|
||||||
foxy-dev-team
|
foxy-dev-team
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ docker build -t foxy-telegram -f Dockerfile.telegram .
|
|||||||
docker run -d \
|
docker run -d \
|
||||||
--name foxy-telegram \
|
--name foxy-telegram \
|
||||||
--env-file backend/.env \
|
--env-file backend/.env \
|
||||||
-e FOXY_API_URL=http://foxy-api:8000 \
|
-e FOXY_API_URL=http://foxy-api:7000 \
|
||||||
--network container:foxy-api \
|
--network container:foxy-api \
|
||||||
foxy-telegram
|
foxy-telegram
|
||||||
```
|
```
|
||||||
@ -251,7 +251,7 @@ docker run -d \
|
|||||||
|
|
||||||
| Service | Image | Port | Description |
|
| Service | Image | Port | Description |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| `foxy-api` | `Dockerfile` | `8000` | Backend + Frontend statique |
|
| `foxy-api` | `Dockerfile` | `7000` | Backend + Frontend statique |
|
||||||
| `foxy-telegram` | `Dockerfile.telegram` | — | Bot Telegram (API-backed) |
|
| `foxy-telegram` | `Dockerfile.telegram` | — | Bot Telegram (API-backed) |
|
||||||
|
|
||||||
Le `Dockerfile` principal utilise un **build multi-stage** :
|
Le `Dockerfile` principal utilise un **build multi-stage** :
|
||||||
@ -357,7 +357,7 @@ foxy-dev-team/
|
|||||||
|
|
||||||
## 📡 API Reference
|
## 📡 API Reference
|
||||||
|
|
||||||
Base URL : `http://localhost:8000`
|
Base URL : `http://localhost:7000`
|
||||||
|
|
||||||
### Health
|
### Health
|
||||||
|
|
||||||
@ -399,9 +399,9 @@ Base URL : `http://localhost:8000`
|
|||||||
|
|
||||||
| Endpoint | Description |
|
| Endpoint | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `ws://host:8000/ws/live` | Temps réel : `agent_status`, `log`, `project_update` |
|
| `ws://host:7000/ws/live` | Temps réel : `agent_status`, `log`, `project_update` |
|
||||||
|
|
||||||
> 📖 Documentation interactive Swagger : `http://localhost:8000/docs`
|
> 📖 Documentation interactive Swagger : `http://localhost:7000/docs`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ Le bot Telegram v3 (`foxy-telegram-bot-v3.py`) interagit exclusivement via l'API
|
|||||||
```bash
|
```bash
|
||||||
export TELEGRAM_BOT_TOKEN="votre_token"
|
export TELEGRAM_BOT_TOKEN="votre_token"
|
||||||
export TELEGRAM_CHAT_ID="votre_chat_id"
|
export TELEGRAM_CHAT_ID="votre_chat_id"
|
||||||
export FOXY_API_URL="http://localhost:8000" # URL de l'API backend
|
export FOXY_API_URL="http://localhost:7000" # URL de l'API backend
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -467,7 +467,7 @@ Cela crée 2 services systemd (user mode) :
|
|||||||
|
|
||||||
| Service | Description | Dépendance |
|
| Service | Description | Dépendance |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `foxy-api` | Backend FastAPI (port 8000) | — |
|
| `foxy-api` | Backend FastAPI (port 7000) | — |
|
||||||
| `foxy-telegram` | Bot Telegram v3 | `foxy-api` |
|
| `foxy-telegram` | Bot Telegram v3 | `foxy-api` |
|
||||||
|
|
||||||
### Commandes de gestion
|
### Commandes de gestion
|
||||||
|
|||||||
@ -19,13 +19,13 @@ services:
|
|||||||
container_name: foxy-api
|
container_name: foxy-api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "${API_PORT:-8000}:8000"
|
- "${API_PORT:-7000}:7000"
|
||||||
env_file:
|
env_file:
|
||||||
- backend/.env
|
- backend/.env
|
||||||
volumes:
|
volumes:
|
||||||
- foxy-data:/app/data
|
- foxy-data:/app/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:7000/api/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@ -46,7 +46,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- backend/.env
|
- backend/.env
|
||||||
environment:
|
environment:
|
||||||
- FOXY_API_URL=http://foxy-api:8000
|
- FOXY_API_URL=http://foxy-api:7000
|
||||||
depends_on:
|
depends_on:
|
||||||
foxy-api:
|
foxy-api:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
@ -112,7 +112,7 @@ GET /api/logs → Audit logs filtrables
|
|||||||
cd backend
|
cd backend
|
||||||
cp .env.example .env # Configurer les variables
|
cp .env.example .env # Configurer les variables
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
python -m uvicorn app.main:app --port 8000
|
python -m uvicorn app.main:app --port 7000
|
||||||
|
|
||||||
# Frontend
|
# Frontend
|
||||||
cd frontend
|
cd frontend
|
||||||
@ -121,6 +121,6 @@ npm run dev
|
|||||||
|
|
||||||
# Telegram Bot
|
# Telegram Bot
|
||||||
cd scripts
|
cd scripts
|
||||||
export TELEGRAM_BOT_TOKEN="..." TELEGRAM_CHAT_ID="..." FOXY_API_URL="http://localhost:8000"
|
export TELEGRAM_BOT_TOKEN="..." TELEGRAM_CHAT_ID="..." FOXY_API_URL="http://localhost:7000"
|
||||||
python3 foxy-telegram-bot-v3.py
|
python3 foxy-telegram-bot-v3.py
|
||||||
```
|
```
|
||||||
|
|||||||
@ -11,11 +11,11 @@ export default defineConfig({
|
|||||||
port: 5173,
|
port: 5173,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:8000',
|
target: 'http://localhost:7000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/ws': {
|
'/ws': {
|
||||||
target: 'ws://localhost:8000',
|
target: 'ws://localhost:7000',
|
||||||
ws: true,
|
ws: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import httpx
|
|||||||
|
|
||||||
TELEGRAM_BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN", "")
|
TELEGRAM_BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN", "")
|
||||||
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID", "")
|
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID", "")
|
||||||
API_BASE_URL = os.environ.get("FOXY_API_URL", "http://localhost:8000")
|
API_BASE_URL = os.environ.get("FOXY_API_URL", "http://localhost:7000")
|
||||||
POLL_TIMEOUT = 30
|
POLL_TIMEOUT = 30
|
||||||
|
|
||||||
# ─── LOGGING ───────────────────────────────────────────────────────────────────
|
# ─── LOGGING ───────────────────────────────────────────────────────────────────
|
||||||
@ -204,7 +204,7 @@ async def cmd_aide(tg: TelegramClient, chat_id: str):
|
|||||||
"<b>/reset</b> ID — Réinitialiser un projet\n"
|
"<b>/reset</b> ID — Réinitialiser un projet\n"
|
||||||
"<b>/aide</b> — Cette aide\n\n"
|
"<b>/aide</b> — Cette aide\n\n"
|
||||||
"━━━━━━━━━━━━━━━━━━━━\n"
|
"━━━━━━━━━━━━━━━━━━━━\n"
|
||||||
f"🌐 Dashboard : <a href='{API_BASE_URL.replace(':8000', ':5173')}'>Ouvrir</a>"
|
f"🌐 Dashboard : <a href='{API_BASE_URL.replace(':7000', ':5173')}'>Ouvrir</a>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ StartLimitBurst=3
|
|||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=$PROJECT_DIR/backend
|
WorkingDirectory=$PROJECT_DIR/backend
|
||||||
EnvironmentFile=$ENV_FILE
|
EnvironmentFile=$ENV_FILE
|
||||||
ExecStart=$(command -v python3) -m uvicorn app.main:app --host 0.0.0.0 --port 8000
|
ExecStart=$(command -v python3) -m uvicorn app.main:app --host 0.0.0.0 --port 7000
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
@ -138,6 +138,6 @@ echo " journalctl --user -u foxy-api -f"
|
|||||||
echo " journalctl --user -u foxy-telegram -f"
|
echo " journalctl --user -u foxy-telegram -f"
|
||||||
echo ""
|
echo ""
|
||||||
log " Dashboard : http://localhost:5173"
|
log " Dashboard : http://localhost:5173"
|
||||||
log " API : http://localhost:8000"
|
log " API : http://localhost:7000"
|
||||||
log " API Docs : http://localhost:8000/docs"
|
log " API Docs : http://localhost:7000/docs"
|
||||||
log "═══════════════════════════════════════════════════════════"
|
log "═══════════════════════════════════════════════════════════"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user