48 lines
973 B
Bash
48 lines
973 B
Bash
|
|
#!/bin/bash
|
||
|
|
set -e
|
||
|
|
|
||
|
|
echo "=== IOM Platform Deployment ==="
|
||
|
|
|
||
|
|
# Check environment
|
||
|
|
if [ -z "$ENVIRONMENT" ]; then
|
||
|
|
echo "Error: ENVIRONMENT not set"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "Environment: $ENVIRONMENT"
|
||
|
|
|
||
|
|
# Pull latest images
|
||
|
|
echo "Pulling latest images..."
|
||
|
|
docker-compose pull
|
||
|
|
|
||
|
|
# Run database migrations
|
||
|
|
echo "Running database migrations..."
|
||
|
|
docker-compose run --rm api alembic upgrade head
|
||
|
|
|
||
|
|
# Start services
|
||
|
|
echo "Starting services..."
|
||
|
|
docker-compose up -d
|
||
|
|
|
||
|
|
# Wait for health checks
|
||
|
|
echo "Waiting for health checks..."
|
||
|
|
sleep 10
|
||
|
|
|
||
|
|
# Check API health
|
||
|
|
if curl -s http://localhost:8000/health | grep -q "healthy"; then
|
||
|
|
echo "✓ API is healthy"
|
||
|
|
else
|
||
|
|
echo "✗ API health check failed"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Check database
|
||
|
|
docker-compose exec -T postgres pg_isready -U iom
|
||
|
|
|
||
|
|
# Check Redis
|
||
|
|
docker-compose exec -T redis redis-cli ping
|
||
|
|
|
||
|
|
echo "=== Deployment Complete ==="
|
||
|
|
echo "API: http://localhost:8000"
|
||
|
|
echo "Grafana: http://localhost:3000"
|
||
|
|
echo "Prometheus: http://localhost:9090"
|