Skip to content

Commit d5da670

Browse files
author
Shreyas-Microsoft
committed
add diff terminal logic
1 parent af62f95 commit d5da670

File tree

1 file changed

+126
-13
lines changed

1 file changed

+126
-13
lines changed

docs/LocalDevelopmentSetup.md

Lines changed: 126 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,71 @@
22

33
This guide provides comprehensive instructions for setting up the Container Migration Solution Accelerator for local development across Windows and Linux platforms.
44

5-
**Note**: This project uses separate `.env` files in the processor (`src/processor`), backend API (`src/backend-api/src/app`), and frontend (`src/frontend`) directories, each with different configuration requirements. When copying `.env` samples, always navigate to the particular folder first before copying the values.
5+
## Important Setup Notes
6+
7+
### Multi-Service Architecture
8+
9+
This application consists of **three separate services** that run independently:
10+
11+
1. **Processor** - Handles migration logic (Queue Mode or Direct Mode)
12+
2. **Backend API** - REST API server for the frontend
13+
3. **Frontend** - React-based user interface
14+
15+
> **⚠️ Critical: Each service must run in its own terminal/console window**
16+
>
17+
> - **Do NOT close terminals** while services are running
18+
> - Open **3 separate terminal windows** for local development
19+
> - Each service will occupy its terminal and show live logs
20+
>
21+
> **Terminal Organization:**
22+
> - **Terminal 1**: Processor (Queue Mode) - Runs continuously, polls for messages
23+
> - **Terminal 2**: Backend API - HTTP server on port 8000
24+
> - **Terminal 3**: Frontend - Development server on port 5173
25+
26+
### Path Conventions
27+
28+
**All paths in this guide are relative to the repository root directory:**
29+
30+
```bash
31+
Container-Migration-Solution-Accelerator/ ← Repository root (start here)
32+
├── src/
33+
│ ├── processor/ ← cd src/processor
34+
│ │ ├── .venv/ ← Virtual environment
35+
│ │ └── src/ ← cd src/processor/src
36+
│ │ ├── main.py ← Direct Mode entry point
37+
│ │ ├── main_service.py ← Queue Mode entry point
38+
│ │ └── .env ← Processor config file
39+
│ ├── backend-api/ ← cd src/backend-api
40+
│ │ ├── .venv/ ← Virtual environment
41+
│ │ └── src/app/ ← cd src/backend-api/src/app
42+
│ │ ├── main.py ← API entry point
43+
│ │ └── .env ← Backend API config file
44+
│ └── frontend/ ← cd src/frontend
45+
│ ├── node_modules/ ← npm dependencies
46+
│ └── .env ← Frontend config file
47+
└── docs/ ← Documentation (you are here)
48+
```
49+
50+
**Before starting any step, ensure you are in the repository root directory:**
51+
52+
```bash
53+
# Verify you're in the correct location
54+
pwd # Linux/macOS - should show: .../Container-Migration-Solution-Accelerator
55+
Get-Location # Windows PowerShell - should show: ...\Container-Migration-Solution-Accelerator
56+
57+
# If not, navigate to repository root
58+
cd path/to/Container-Migration-Solution-Accelerator
59+
```
60+
61+
### Configuration Files
62+
63+
This project uses separate `.env` files in each service directory with different configuration requirements:
64+
65+
- **Processor**: `src/processor/src/.env` - Azure App Configuration URL
66+
- **Backend API**: `src/backend-api/src/app/.env` - Azure App Configuration URL
67+
- **Frontend**: `src/frontend/.env` - Azure AD authentication settings
68+
69+
When copying `.env` samples, always navigate to the specific service directory first.
670

771
## Step 1: Prerequisites - Install Required Tools
872

@@ -178,6 +242,8 @@ Depending on the features you use, you may also need:
178242

179243
## Step 4: Processor Setup & Run Instructions
180244

245+
> **📋 Terminal Reminder**: Open a **dedicated terminal window (Terminal 1)** for the Processor service. All commands in this section assume you start from the **repository root directory**.
246+
181247
The Processor handles the actual migration logic and can run in two modes:
182248
- **Queue-based mode** (`main_service.py`): Processes migration requests from Azure Storage Queue (production)
183249
- **Direct execution mode** (`main.py`): Runs migrations directly without queue (development/testing)
@@ -237,7 +303,7 @@ py -3.12 -m uv sync
237303
238304
### 4.4. Run the Processor
239305

240-
#### Option A: Direct Execution Mode (Development/Testing)
306+
#### Option A: Direct Execution Mode (Production)
241307

242308
Run migrations directly without queue infrastructure:
243309

@@ -246,12 +312,8 @@ cd src
246312
python main.py
247313
```
248314

249-
This mode is useful for:
250-
- Local development and testing
251-
- Running single migrations
252-
- Debugging migration logic
253315

254-
#### Option B: Queue-Based Mode (Production)
316+
#### Option B: Queue-Based Mode (Development/Testing) [Preferred for local set up]
255317

256318
Process migration requests from Azure Storage Queue:
257319

@@ -279,20 +341,24 @@ python main_service.py
279341
```
280342

281343
This mode provides:
282-
- Concurrent processing with multiple workers
283344
- Automatic retry logic with exponential backoff
284-
- Horizontal scalability
285345
- Production-ready error handling
346+
- Local development and testing
347+
- Running single migrations
348+
- Debugging migration logic
286349
- Message polling with "No messages in main queue" logs
287350

288351
## Step 5: Backend API Setup & Run Instructions
289352

353+
> **📋 Terminal Reminder**: Open a **second dedicated terminal window (Terminal 2)** for the Backend API. Keep Terminal 1 (Processor) running. All commands assume you start from the **repository root directory**.
354+
290355
The Backend API provides REST endpoints for the frontend and handles API requests.
291356

292357
### 5.1. Navigate to Backend API Directory
293358

294359
```bash
295-
cd ../../backend-api
360+
# From repository root
361+
cd src/backend-api
296362
```
297363

298364
### 5.2. Configure Backend API Environment Variables
@@ -344,12 +410,15 @@ The Backend API will start at:
344410

345411
## Step 6: Frontend (UI) Setup & Run Instructions
346412

413+
> **📋 Terminal Reminder**: Open a **third dedicated terminal window (Terminal 3)** for the Frontend. Keep Terminals 1 (Processor) and 2 (Backend API) running. All commands assume you start from the **repository root directory**.
414+
347415
The UI is located under `src/frontend`.
348416

349417
### 6.1. Navigate to Frontend Directory
350418

351419
```bash
352-
cd ../../frontend
420+
# From repository root
421+
cd src/frontend
353422
```
354423

355424
### 6.2. Install UI Dependencies
@@ -506,9 +575,53 @@ Get-ChildItem Env:AZURE* # Windows PowerShell
506575
cat .env | grep -v '^#' | grep '=' # Should show key=value pairs
507576
```
508577

509-
## Step 7: Next Steps
578+
## Step 7: Verify All Services Are Running
579+
580+
Before using the application, confirm all three services are running in separate terminals:
581+
582+
### Terminal Status Checklist
583+
584+
| Terminal | Service | Command | Expected Output | URL |
585+
|----------|---------|---------|-----------------|-----|
586+
| **Terminal 1** | Processor (Queue Mode) | `python -m main_service` | `INFO: No messages in main queue` (repeating every 5s) | N/A |
587+
| **Terminal 2** | Backend API | `python -m uvicorn main:app --reload` | `INFO: Application startup complete` | http://localhost:8000 |
588+
| **Terminal 3** | Frontend | `npm run dev` | `Local: http://localhost:5173/` | http://localhost:5173 |
589+
590+
### Quick Verification
591+
592+
**1. Check Backend API:**
593+
```bash
594+
# In a new terminal (Terminal 4)
595+
curl http://localhost:8000/health
596+
# Expected: {"status":"healthy"} or similar
597+
```
598+
599+
**2. Check Frontend:**
600+
- Open browser to http://localhost:5173
601+
- Should see the Container Migration UI
602+
- If authentication is configured, you'll be redirected to Azure AD login
603+
604+
**3. Check Processor:**
605+
- Look at Terminal 1 output
606+
- Should see regular polling messages: `INFO: No messages in main queue`
607+
- No error messages
608+
609+
### Common Issues
610+
611+
**Service not starting?**
612+
- Ensure you're in the correct directory
613+
- Verify virtual environment is activated (Python services)
614+
- Check that port is not already in use (8000 for API, 5173 for frontend)
615+
- Review error messages in the terminal
616+
617+
**Can't access services?**
618+
- Verify firewall isn't blocking ports 8000 or 5173
619+
- Try `http://localhost:port` instead of `http://127.0.0.1:port`
620+
- Ensure services show "startup complete" messages
621+
622+
## Step 8: Next Steps
510623

511-
Once all services are running (as configured in Steps 4-6), you can:
624+
Once all services are running (as confirmed in Step 7), you can:
512625

513626
1. **Access the Application**: Open `http://localhost:5173` in your browser to explore the frontend UI
514627
2. **Try a Sample Workflow**: Follow [SampleWorkflow.md](SampleWorkflow.md) for a guided walkthrough of the migration process

0 commit comments

Comments
 (0)