feat: production deployment - full update with providers, admin, glossaries, pricing, tests
Major changes across backend, frontend, infrastructure: - Provider system with model selection (Google, DeepL, OpenAI, Ollama, Google Cloud) - Admin panel: user management, pricing, settings - Glossary system with CSV import/export - Subscription and tier quota management - Security hardening (rate limiting, API key auth, path traversal fixes) - Docker compose for dev, prod, and IONOS deployment - Alembic migrations for new tables - Frontend: dashboard, pricing page, landing page, i18n (en/fr) - Test suite and verification scripts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
85
scripts/run-dev.sh
Executable file
85
scripts/run-dev.sh
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
# Lance le backend (FastAPI) et le frontend (Next.js) pour tester l'application.
|
||||
# Usage: ./scripts/run-dev.sh
|
||||
# Arrêt: Ctrl+C
|
||||
|
||||
set -e
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
BACKEND_PID=""
|
||||
FRONTEND_PID=""
|
||||
|
||||
cleanup() {
|
||||
echo ""
|
||||
echo "Arrêt en cours..."
|
||||
[ -n "$BACKEND_PID" ] && kill "$BACKEND_PID" 2>/dev/null || true
|
||||
[ -n "$FRONTEND_PID" ] && kill "$FRONTEND_PID" 2>/dev/null || true
|
||||
exit 0
|
||||
}
|
||||
|
||||
trap cleanup SIGINT SIGTERM
|
||||
|
||||
# Libère les ports 8000 et 3000 si déjà utilisés (ex: ancienne session)
|
||||
kill_port() {
|
||||
local port=$1
|
||||
local pids
|
||||
pids=$(lsof -ti ":$port" 2>/dev/null) || true
|
||||
if [ -n "$pids" ]; then
|
||||
echo "Libération du port $port (PID: $pids)..."
|
||||
echo "$pids" | xargs kill -9 2>/dev/null || true
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
kill_port 8000
|
||||
kill_port 3000
|
||||
|
||||
# Dossiers nécessaires
|
||||
mkdir -p uploads outputs temp
|
||||
|
||||
# .env depuis .env.example si absent
|
||||
if [ ! -f .env ]; then
|
||||
echo "Création de .env à partir de .env.example"
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
echo "=============================================="
|
||||
echo " Office Translator - Backend + Frontend"
|
||||
echo "=============================================="
|
||||
echo ""
|
||||
|
||||
# Backend avec le venv du projet
|
||||
if [ -d ".venv" ]; then
|
||||
source .venv/bin/activate
|
||||
elif [ -d "venv" ]; then
|
||||
source venv/bin/activate
|
||||
fi
|
||||
|
||||
echo "Démarrage du backend (FastAPI) sur http://localhost:8000 ..."
|
||||
python main.py &
|
||||
BACKEND_PID=$!
|
||||
|
||||
# Laisser le backend démarrer
|
||||
sleep 2
|
||||
|
||||
echo "Démarrage du frontend (Next.js) sur http://localhost:3000 ..."
|
||||
if [ ! -d "frontend/node_modules" ]; then
|
||||
echo "Installation des dépendances frontend (npm install)..."
|
||||
(cd frontend && npm install)
|
||||
fi
|
||||
(cd frontend && npx next dev --webpack) &
|
||||
FRONTEND_PID=$!
|
||||
|
||||
echo ""
|
||||
echo "=============================================="
|
||||
echo " Application prête"
|
||||
echo "=============================================="
|
||||
echo " Frontend: http://localhost:3000"
|
||||
echo " Backend: http://localhost:8000"
|
||||
echo " API Docs: http://localhost:8000/docs"
|
||||
echo " Santé: http://localhost:8000/health"
|
||||
echo "=============================================="
|
||||
echo " Arrêter: Ctrl+C"
|
||||
echo ""
|
||||
|
||||
wait
|
||||
50
scripts/verify-dev-compose.sh
Executable file
50
scripts/verify-dev-compose.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# Verify docker-compose.dev.yml: syntax, required services, and optional config check
|
||||
# Usage: ./scripts/verify-dev-compose.sh
|
||||
# Run from project root. Requires: bash, optional docker compose / docker-compose
|
||||
|
||||
set -e
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
COMPOSE_FILE="docker-compose.dev.yml"
|
||||
|
||||
echo "Checking $COMPOSE_FILE exists..."
|
||||
test -f "$COMPOSE_FILE" || { echo "Missing $COMPOSE_FILE"; exit 1; }
|
||||
|
||||
echo "Validating YAML syntax and required services (Python)..."
|
||||
python3 - "$COMPOSE_FILE" <<'PY'
|
||||
import sys
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
print("PyYAML not installed, skipping YAML check")
|
||||
sys.exit(0)
|
||||
|
||||
path = sys.argv[1]
|
||||
with open(path) as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
if not data or "services" not in data:
|
||||
print("YAML error: no 'services' key")
|
||||
sys.exit(1)
|
||||
|
||||
services = data["services"]
|
||||
required = {"postgres", "redis", "backend", "frontend"}
|
||||
missing = required - set(services)
|
||||
if missing:
|
||||
print("YAML error: missing required services:", ", ".join(sorted(missing)))
|
||||
sys.exit(1)
|
||||
print("YAML OK, required services present (postgres, redis, backend, frontend)")
|
||||
PY
|
||||
|
||||
if command -v docker-compose &>/dev/null; then
|
||||
echo "Running docker-compose config..."
|
||||
docker-compose -f "$COMPOSE_FILE" config >/dev/null && echo "docker-compose config OK"
|
||||
elif docker compose version &>/dev/null 2>&1; then
|
||||
echo "Running docker compose config..."
|
||||
docker compose -f "$COMPOSE_FILE" config >/dev/null && echo "docker compose config OK"
|
||||
else
|
||||
echo "Docker Compose not found; skip config validation. Run manually: docker compose -f $COMPOSE_FILE up"
|
||||
fi
|
||||
|
||||
echo "Done. To start dev stack: docker compose -f $COMPOSE_FILE up (or docker-compose -f $COMPOSE_FILE up)"
|
||||
51
scripts/verify-prod-compose.sh
Executable file
51
scripts/verify-prod-compose.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# Verify docker-compose.yml (production): syntax and required services
|
||||
# Usage: ./scripts/verify-prod-compose.sh
|
||||
# Run from project root. Requires: bash, optional docker compose / docker-compose
|
||||
# Production: ensure .env exists with POSTGRES_PASSWORD, JWT_SECRET_KEY, ADMIN_* (see .env.example).
|
||||
|
||||
set -e
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
COMPOSE_FILE="docker-compose.yml"
|
||||
|
||||
echo "Checking $COMPOSE_FILE exists..."
|
||||
test -f "$COMPOSE_FILE" || { echo "Missing $COMPOSE_FILE"; exit 1; }
|
||||
|
||||
echo "Validating YAML syntax and required services (Python)..."
|
||||
python3 - "$COMPOSE_FILE" <<'PY'
|
||||
import sys
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
print("PyYAML not installed, skipping YAML check")
|
||||
sys.exit(0)
|
||||
|
||||
path = sys.argv[1]
|
||||
with open(path) as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
if not data or "services" not in data:
|
||||
print("YAML error: no 'services' key")
|
||||
sys.exit(1)
|
||||
|
||||
services = data["services"]
|
||||
required = {"postgres", "redis", "backend", "frontend"}
|
||||
missing = required - set(services)
|
||||
if missing:
|
||||
print("YAML error: missing required services:", ", ".join(sorted(missing)))
|
||||
sys.exit(1)
|
||||
print("YAML OK, required services present (postgres, redis, backend, frontend)")
|
||||
PY
|
||||
|
||||
if command -v docker-compose &>/dev/null; then
|
||||
echo "Running docker-compose config..."
|
||||
docker-compose -f "$COMPOSE_FILE" config >/dev/null && echo "docker compose config OK"
|
||||
elif docker compose version &>/dev/null 2>&1; then
|
||||
echo "Running docker compose config..."
|
||||
docker compose -f "$COMPOSE_FILE" config >/dev/null && echo "docker compose config OK"
|
||||
else
|
||||
echo "Docker Compose not found; skip config validation. Run manually: docker compose -f $COMPOSE_FILE up -d"
|
||||
fi
|
||||
|
||||
echo "Done. To start prod stack: docker compose up -d (ensure .env has POSTGRES_PASSWORD, JWT_SECRET_KEY, ADMIN_*)"
|
||||
Reference in New Issue
Block a user