Files
url_tracker_tool/deploy.sh
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
2025-08-19 19:12:23 +00:00

126 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# Redirect Intelligence v2 Production Deployment Script
set -e
echo "🚀 Starting Redirect Intelligence v2 Deployment..."
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if Docker and Docker Compose are installed
if ! command -v docker &> /dev/null; then
print_error "Docker is not installed. Please install Docker first."
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
print_error "Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
# Check if .env file exists
if [ ! -f .env ]; then
print_warning ".env file not found. Creating from .env.production template..."
cp .env.production .env
print_warning "Please edit .env file with your production values before continuing."
print_warning "Important: Change DB_PASSWORD and JWT_SECRET!"
exit 1
fi
# Load environment variables
source .env
# Check critical environment variables
if [[ "$JWT_SECRET" == "your-super-secret-jwt-key-minimum-32-characters-long" ]]; then
print_error "Please update JWT_SECRET in .env file!"
exit 1
fi
if [[ "$DB_PASSWORD" == "your_secure_db_password_here" ]]; then
print_error "Please update DB_PASSWORD in .env file!"
exit 1
fi
print_status "Building application..."
# Build all packages
npm run build
print_success "Application built successfully!"
print_status "Stopping existing containers..."
# Fix Docker environment issue
unset DOCKER_HOST
# Stop existing containers
docker-compose -f docker-compose.prod.yml down
print_status "Building Docker images..."
# Build Docker images
docker-compose -f docker-compose.prod.yml build --no-cache
print_status "Starting services..."
# Start services
docker-compose -f docker-compose.prod.yml up -d
print_status "Waiting for services to start..."
# Wait for database to be ready
sleep 10
print_status "Running database migrations..."
# Run database migrations
docker-compose -f docker-compose.prod.yml exec -T api npx prisma migrate deploy
print_status "Seeding database..."
# Seed database
docker-compose -f docker-compose.prod.yml exec -T api npx prisma db seed
print_success "Deployment completed successfully!"
echo ""
echo "🎉 Redirect Intelligence v2 is now running!"
echo ""
echo "Services:"
echo " 🌐 Frontend: http://localhost:3000"
echo " 🔗 API: http://localhost:3333"
echo " 📊 Health Check: http://localhost:3333/health"
echo ""
echo "To view logs:"
echo " docker-compose -f docker-compose.prod.yml logs -f"
echo ""
echo "To stop services:"
echo " docker-compose -f docker-compose.prod.yml down"
echo ""
# Show running containers
print_status "Running containers:"
docker-compose -f docker-compose.prod.yml ps