-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-manual.sh
More file actions
99 lines (89 loc) · 2.89 KB
/
setup-manual.sh
File metadata and controls
99 lines (89 loc) · 2.89 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
98
99
#!/bin/bash
echo "============================================"
echo " GoodFood Manual Setup Script (No Docker)"
echo "============================================"
echo
echo "This script helps you set up GoodFood application"
echo "for development without Docker."
echo
echo "[Prerequisites Check]"
echo "Checking for required tools..."
if ! command -v dotnet &> /dev/null; then
echo "ERROR: .NET 8.0 SDK is not installed or not in PATH"
echo "Please install .NET 8.0 SDK from: https://dotnet.microsoft.com/download/dotnet/8.0"
exit 1
fi
echo "✓ .NET SDK found"
if ! command -v psql &> /dev/null; then
echo "WARNING: PostgreSQL client tools (psql) not found in PATH"
echo "You may need to create the database manually"
echo
else
echo "✓ PostgreSQL client tools found"
fi
echo
echo "[Database Setup]"
echo "Please ensure PostgreSQL server is running on localhost:5432"
echo "Default credentials: username=postgres, password=postgres"
echo
read -p "Continue with database setup? (y/n): " continue
if [[ ! "$continue" =~ ^[Yy]$ ]]; then
echo "Setup cancelled."
exit 0
fi
echo
echo "Creating database 'goodfood_db_pub'..."
psql -h localhost -p 5432 -U postgres -f setup-database.sql
if [ $? -ne 0 ]; then
echo
echo "WARNING: Database creation failed or database already exists"
echo "You can create it manually using pgAdmin or run:"
echo " createdb -h localhost -p 5432 -U postgres goodfood_db_pub"
echo
fi
echo
echo "[EF Core Tools Setup]"
echo "Installing Entity Framework Core tools..."
dotnet tool install --global dotnet-ef 2>/dev/null || true
echo
echo "[Database Migration]"
echo "Running database migrations..."
dotnet ef database update --project src/GoodFood.Infrastructure --startup-project src/GoodFood.Web
if [ $? -ne 0 ]; then
echo
echo "ERROR: Migration failed. Please check:"
echo "1. PostgreSQL server is running"
echo "2. Database 'goodfood_db_pub' exists"
echo "3. Connection string in appsettings.Development.json is correct"
echo
exit 1
fi
echo
echo "============================================"
echo " 🎉 Setup Complete! 🎉"
echo "============================================"
echo
echo "✅ To run the FULL application you need to start:"
echo
echo "1. 🌐 Web Application:"
echo " cd src/GoodFood.Web"
echo " dotnet run"
echo
echo "2. 📧 Email Worker (in separate terminal):"
echo " cd src/GoodFood.Worker.EmailSender"
echo " dotnet run"
echo
echo "🚀 The web application will be available at:"
echo " 👉 https://localhost:7001 (HTTPS)"
echo " 👉 http://localhost:5000 (HTTP)"
echo
echo "📊 Database connection details:"
echo " Host: localhost"
echo " Port: 5432"
echo " Database: goodfood_db_pub"
echo " Username: postgres"
echo " Password: postgres"
echo
echo "💡 TIP: For the best experience, run both services!"
echo " The email worker handles background email processing."
echo