collabrix/scripts/setup.sh
DGSoft 93b98cfb5c Initial commit: Team Chat System with Code Snippet Library
- Complete chat application similar to Microsoft Teams
- Code snippet library with syntax highlighting
- Real-time messaging with WebSockets
- File upload with Office integration
- Department-based permissions
- Dark/Light theme support
- Production deployment with SSL/Reverse Proxy
- Docker containerization
- PostgreSQL database with SQLModel ORM
2025-12-09 22:25:03 +01:00

112 lines
2.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Team Chat - Setup Script
set -e
echo "🚀 Team Chat Setup Script"
echo "=========================="
# Check if Docker is available
if command -v docker &> /dev/null && command -v docker-compose &> /dev/null; then
echo ""
echo "✅ Docker and Docker Compose found"
echo ""
read -p "Do you want to use Docker? (Y/n): " use_docker
use_docker=${use_docker:-Y}
else
use_docker="n"
fi
if [[ $use_docker =~ ^[Yy]$ ]]; then
echo ""
echo "📦 Starting with Docker..."
# Build and start containers
docker-compose up -d --build
echo ""
echo "⏳ Waiting for services to be ready..."
sleep 10
echo ""
echo "✅ Services started!"
echo ""
echo "Backend API: http://localhost:8000"
echo "Frontend: http://localhost:5173"
echo "API Docs: http://localhost:8000/docs"
echo ""
read -p "Do you want to create demo data? (Y/n): " create_demo
create_demo=${create_demo:-Y}
if [[ $create_demo =~ ^[Yy]$ ]]; then
echo ""
echo "📊 Creating demo data..."
sleep 5
python3 scripts/create_demo_data.py
fi
else
echo ""
echo "📦 Manual setup..."
# Backend setup
echo ""
echo "1⃣ Setting up Backend..."
cd backend
if [ ! -d "venv" ]; then
echo " Creating virtual environment..."
python3 -m venv venv
fi
echo " Activating virtual environment..."
source venv/bin/activate
echo " Installing dependencies..."
pip install -r requirements.txt
if [ ! -f ".env" ]; then
echo " Creating .env file..."
cp .env.example .env
echo " ⚠️ Please edit backend/.env with your PostgreSQL credentials"
fi
echo ""
echo " Starting backend server..."
uvicorn app.main:app --reload &
BACKEND_PID=$!
cd ..
# Frontend setup
echo ""
echo "2⃣ Setting up Frontend..."
cd frontend
if [ ! -d "node_modules" ]; then
echo " Installing dependencies..."
npm install
fi
echo ""
echo " Starting frontend dev server..."
npm run dev &
FRONTEND_PID=$!
cd ..
echo ""
echo "✅ Services started!"
echo ""
echo "Backend API: http://localhost:8000"
echo "Frontend: http://localhost:5173"
echo ""
echo "Press Ctrl+C to stop all services"
# Wait for Ctrl+C
trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null" EXIT
wait
fi