Repository navigation
Expand file tree
/
Copy pathdeploy.sh
More file actions
74 lines (62 loc) · 2.21 KB
/
Copy pathdeploy.sh
File metadata and controls
74 lines (62 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Requirements Tracker Deployment Script
# This script helps set up and deploy the Requirements Tracker application
set -e
echo "🚀 Requirements Tracker Deployment Script"
echo "=========================================="
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo "📝 Creating .env file from template..."
cp env.example .env
echo "✅ .env file created. Please review and edit if needed."
else
echo "✅ .env file already exists."
fi
# Generate a secure secret key if not set
if grep -q "your-secret-key-change-this" .env; then
echo "🔑 Generating secure secret key..."
SECRET_KEY=$(openssl rand -hex 32)
sed -i "s/your-secret-key-change-this/$SECRET_KEY/" .env
echo "✅ Secret key generated and updated in .env"
fi
# Create necessary directories
echo "📁 Creating necessary directories..."
mkdir -p logs
mkdir -p data/uploads
mkdir -p data/search_index
# Build and start the application
echo "🐳 Building and starting Docker containers..."
docker-compose build
echo "🚀 Starting the application..."
docker-compose up -d
# Wait for the application to be ready
echo "⏳ Waiting for the application to start..."
sleep 10
# Check if the application is running
if curl -f http://localhost:8080/health &> /dev/null; then
echo "✅ Application is running successfully!"
echo ""
echo "🌐 Access the application at: http://localhost:8080"
echo "👤 Default admin username: admin"
echo ""
echo "📋 Useful commands:"
echo " - View logs: docker-compose logs -f"
echo " - Stop application: docker-compose down"
echo " - Restart application: docker-compose restart"
echo " - Update application: git pull && docker-compose up -d --build"
echo ""
echo "🎉 Deployment complete!"
else
echo "❌ Application failed to start. Check logs with: docker-compose logs"
exit 1
fi