-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
98 lines (89 loc) · 2.81 KB
/
setup.sh
File metadata and controls
98 lines (89 loc) · 2.81 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
echo "======================================"
echo "TeamUp Application Setup Script"
echo "======================================"
echo ""
# Check for Java
echo "Checking Java installation..."
if command -v java &> /dev/null; then
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "✓ Java found: $JAVA_VERSION"
else
echo "✗ Java not found. Please install Java 17 or higher."
exit 1
fi
# Check for Maven
echo "Checking Maven installation..."
if command -v mvn &> /dev/null; then
MVN_VERSION=$(mvn -version | head -n 1)
echo "✓ Maven found: $MVN_VERSION"
else
echo "✗ Maven not found. Installing..."
echo "Please install Maven manually:"
echo " Fedora/RHEL: sudo dnf install maven"
echo " Ubuntu/Debian: sudo apt install maven"
echo " macOS: brew install maven"
exit 1
fi
# Check for PostgreSQL
echo "Checking PostgreSQL installation..."
if command -v psql &> /dev/null; then
PG_VERSION=$(psql --version)
echo "✓ PostgreSQL found: $PG_VERSION"
else
echo "⚠ PostgreSQL not found. Please install PostgreSQL 12 or higher."
echo " Fedora/RHEL: sudo dnf install postgresql postgresql-server"
echo " Ubuntu/Debian: sudo apt install postgresql postgresql-contrib"
echo " macOS: brew install postgresql"
fi
echo ""
echo "======================================"
echo "Database Setup"
echo "======================================"
echo ""
echo "Please ensure PostgreSQL is running and create the database:"
echo ""
echo " sudo -u postgres psql"
echo " CREATE DATABASE teamup_db;"
echo " CREATE USER teamup_user WITH PASSWORD 'teamup_pass';"
echo " GRANT ALL PRIVILEGES ON DATABASE teamup_db TO teamup_user;"
echo " \\q"
echo ""
read -p "Have you created the database? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Please create the database and run this script again."
exit 1
fi
echo ""
echo "======================================"
echo "Building Application"
echo "======================================"
echo ""
# Build the application
echo "Running Maven clean install..."
mvn clean install -DskipTests
if [ $? -eq 0 ]; then
echo ""
echo "✓ Build successful!"
echo ""
echo "======================================"
echo "Starting Application"
echo "======================================"
echo ""
echo "To start the application, run:"
echo " mvn spring-boot:run"
echo ""
echo "Or use the compiled JAR:"
echo " java -jar target/TeamUp-0.0.1-SNAPSHOT.jar"
echo ""
echo "The application will be available at:"
echo " http://localhost:8080"
echo ""
echo "Default credentials for first user:"
echo " Register at: http://localhost:8080/register"
echo ""
else
echo "✗ Build failed. Please check the error messages above."
exit 1
fi