-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-and-run.bat
More file actions
76 lines (68 loc) · 2.12 KB
/
setup-and-run.bat
File metadata and controls
76 lines (68 loc) · 2.12 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
@echo off
echo ============================================
echo GoodFood Application Setup Script
echo ============================================
echo.
echo [1/6] Stopping any existing containers...
docker-compose down -v
echo.
echo [2/6] Starting PostgreSQL database...
docker-compose up -d db
echo.
echo [3/6] Waiting for database to be healthy...
:waitloop
docker exec goodfood_db pg_isready -U postgres -d goodfood_db_pub >nul 2>&1
if %errorlevel% neq 0 (
echo Database not ready yet, waiting 5 seconds...
timeout /t 5 /nobreak >nul
goto waitloop
)
echo Database is ready!
echo.
echo [4/6] Running database migrations inside Docker container...
echo Building migrations container...
docker-compose build migrations
echo Running migrations...
docker-compose run --rm migrations dotnet ef database update --project /src/src/GoodFood.Infrastructure --startup-project /src/src/GoodFood.Web
if %errorlevel% neq 0 (
echo.
echo ERROR: Failed to run migrations. Please check:
echo 1. Docker containers are running properly
echo 2. Database connection string is correct
echo 3. Project builds successfully inside container
echo.
pause
exit /b 1
)
echo.
echo [5/6] Building and starting email worker service...
docker-compose build emailworker
docker-compose up -d emailworker
echo.
echo [6/6] Starting the web application...
echo Starting the application container...
docker-compose up -d webapp
echo.
echo ============================================
echo 🎉 Setup Complete! 🎉
echo ============================================
echo.
echo ✅ Services Started:
echo 📧 Email Worker: Running in background
echo 🗄️ Database: PostgreSQL on localhost:5432
echo 🌐 Web App: http://localhost:8090
echo.
echo 🚀 Click here to open the application:
echo 👉 http://localhost:8090
echo.
echo 📋 To view logs:
echo docker-compose logs webapp
echo docker-compose logs emailworker
echo docker-compose logs db
echo.
echo 🛑 To stop all services:
echo docker-compose down
echo.
echo Press any key to open the application in your browser...
pause >nul
start http://localhost:8090