File size: 6,863 Bytes
1c8e50c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# πŸš€ Quick Start Guide

## Prerequisites

Make sure you have these installed:
- βœ… Docker & Docker Compose
- βœ… Java 17 or higher
- βœ… Node.js & npm (for frontend)

---

## 🎯 Option 1: Start Everything at Once (Recommended)

### Start All Services (Backend + Frontend)
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
./start-all.sh
```

### Stop All Services
```bash
./stop-all.sh
```

**That's it!** After running `./start-all.sh`:
- Backend services will be ready in ~30 seconds
- Frontend will be available at http://localhost:3000 in ~45 seconds

---

## 🎯 Option 2: Start Services Separately

### Backend Services Only

**Start:**
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
./run-system.sh
```

**Stop:**
```bash
./stop-system.sh
```

### Frontend Only

**Start:**
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices/task-management-ui
npm install    # First time only
npm start
```

**Stop:** Press `Ctrl+C` in the terminal

---

## 🎯 Option 3: Manual Docker Commands

If the scripts don't work, you can use Docker commands directly:

### Start Backend
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices

# Build all services first
./build-all.sh

# Start with Docker Compose
docker-compose up -d

# Check status
docker-compose ps
```

### Stop Backend
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
docker-compose down
```

---

## πŸ“Š Access the Application

Once everything is running:

| Service | URL | Description |
|---------|-----|-------------|
| **Frontend** | http://localhost:3000 | React web interface |
| **API Gateway** | http://localhost:8090 | Main API endpoint |
| **Eureka Dashboard** | http://localhost:8085 | Service discovery |
| **Zipkin** | http://localhost:9411 | Distributed tracing |
| **User Service** | http://localhost:8081 | User management |
| **Task Service** | http://localhost:8082 | Task management |
| **Submission Service** | http://localhost:8083 | Submission management |

---

## πŸ” Troubleshooting

### Check if services are running
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
docker-compose ps
```

All services should show "Up (healthy)".

### View logs
```bash
# All services
docker-compose logs -f

# Specific service
docker-compose logs -f api-gateway
docker-compose logs -f user-service
```

### Services not starting?
```bash
# Stop everything
docker-compose down

# Remove old containers and volumes
docker-compose down -v

# Rebuild and start fresh
./build-all.sh
docker-compose up -d
```

### Frontend not loading?
```bash
cd task-management-ui

# Check if .env file exists
cat .env

# Should show: REACT_APP_API_BASE_URL=http://localhost:8090

# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install
npm start
```

### Port already in use?
```bash
# Check what's using the port (e.g., 3000)
lsof -i :3000

# Kill the process
kill -9 <PID>
```

---

## πŸ—οΈ Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React UI      β”‚ ← You interact here (localhost:3000)
β”‚  (Frontend)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ HTTP Requests
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  API Gateway    β”‚ ← All requests go through here (localhost:8090)
β”‚  (Port 8090)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ Service Discovery
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Eureka Server   β”‚ ← Manages all microservices (localhost:8085)
β”‚  (Port 8085)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    ↓         ↓            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  User   β”‚ β”‚   Task   β”‚ β”‚ Submission  β”‚
β”‚ Service β”‚ β”‚ Service  β”‚ β”‚  Service    β”‚
β”‚ (8081)  β”‚ β”‚ (8082)   β”‚ β”‚  (8083)     β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
     β”‚           β”‚               β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
           β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
           β”‚  MongoDB   β”‚ ← Database (localhost:27017)
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ“ Development Workflow

### Starting development for the day
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
./start-all.sh
```

### Making changes to backend code
1. Make your changes in the respective service folder
2. Rebuild that specific service:
   ```bash
   cd TaskUserService  # or TaskService, etc.
   ./gradlew build
   ```
3. Restart the service:
   ```bash
   docker-compose restart user-service
   ```

### Making changes to frontend code
- Just save the file - React hot reloads automatically! ✨

### Ending development for the day
```bash
cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
./stop-all.sh
```

---

## πŸŽ“ First Time Setup

If this is your first time running the project:

1. **Clone the repository** (if not already done)
2. **Navigate to the project:**
   ```bash
   cd /home/garvitpathak27/cloud_computing/Task-Management-System-using-microservices
   ```

3. **Install frontend dependencies:**
   ```bash
   cd task-management-ui
   npm install
   cd ..
   ```

4. **Start everything:**
   ```bash
   ./start-all.sh
   ```

5. **Wait ~1 minute** for all services to start

6. **Open your browser:** http://localhost:3000

---

## βœ… Current Status

**All services are currently running!** πŸŽ‰

You can verify by running:
```bash
docker-compose ps
```

To stop them:
```bash
./stop-all.sh
```

To restart them:
```bash
./start-all.sh
```

---

## πŸ’‘ Tips

- **First startup takes longer** (~2-3 minutes) as Docker downloads images
- **Subsequent startups are faster** (~30 seconds)
- **Frontend compilation** takes ~10-15 seconds
- **Check Eureka dashboard** to see all registered services
- **Use Zipkin** to trace requests across microservices
- **MongoDB data persists** between restarts (stored in Docker volume)

---

## πŸ†˜ Need Help?

1. Check the logs: `docker-compose logs -f`
2. Verify all services are healthy: `docker-compose ps`
3. Make sure ports are not in use: `lsof -i :3000,8081,8082,8083,8090`
4. See detailed troubleshooting: [FRONTEND_INTEGRATION_ISSUES.md](./FRONTEND_INTEGRATION_ISSUES.md)

---

**Happy Coding! πŸš€**