Skip to content

Commit 7af55da

Browse files
committed
Update README.md
1 parent 5d4ce73 commit 7af55da

1 file changed

Lines changed: 45 additions & 153 deletions

File tree

README.md

Lines changed: 45 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ A containerized development environment for testing and developing applications
3333

3434
## ✨ Features
3535

36-
- **Cross-platform compatibility**: All services run in Docker containers
37-
- **Hot reloading**: All servers automatically reload when code changes
38-
- **Unified dashboard**: Monitor all services in one interface
39-
- **Standardized API endpoints**: Common patterns across all server implementations
40-
- **CORS enabled**: All services configured for cross-origin requests
41-
- **Health checks**: Docker health checks implemented for all services
42-
- **Reverse proxy (optional)**: Nginx configuration for unified routing
43-
- **API testing tools**: Scripts for validating service functionality
44-
- **Resource management**: Docker container resource limits for stable performance
45-
- **Git workflow**: Complete Git configuration with hooks, templates, and CI/CD
46-
- **Comprehensive CI/CD**: Automated testing and deployment with GitHub Actions
36+
- **📦 Cross-platform compatibility**: All services run in Docker containers
37+
- **🔄 Hot reloading**: All servers automatically reload when code changes
38+
- **📊 Unified dashboard**: Monitor all services in one interface
39+
- **🔌 Standardized API endpoints**: Common patterns across all server implementations
40+
- **🌐 CORS enabled**: All services configured for cross-origin requests
41+
- **💓 Health checks**: Docker health checks implemented for all services
42+
- **🔄 Reverse proxy (optional)**: Nginx configuration for unified routing
43+
- **🧪 API testing tools**: Scripts for validating service functionality
44+
- **💪 Resource management**: Docker container resource limits for stable performance
45+
- **🔀 Git workflow**: Complete Git configuration with hooks, templates, and CI/CD
46+
- **🚢 Comprehensive CI/CD**: Automated testing and deployment with GitHub Actions
4747

4848
## 🏗️ Architecture
4949

@@ -120,30 +120,27 @@ The development environment consists of the following components:
120120

121121
4. Build and start all services:
122122
```bash
123-
docker-compose up --build
123+
docker compose up --build
124124
```
125125

126126
5. Access the dashboard:
127127
- Open your browser and navigate to [http://localhost:8081](http://localhost:8081)
128128

129129
## 🔌 Service Access Points
130130

131-
<details>
132-
<summary>Click to expand all service endpoints</summary>
133-
134131
- **Dashboard**: [http://localhost:8081](http://localhost:8081)
135132
- **Live Server API**: [http://localhost:8081/api.html](http://localhost:8081/api.html)
136133
- **Flask API**: [http://localhost:8082](http://localhost:8082)
134+
- Documentation: [http://localhost:8082/docs](http://localhost:8082/docs)
137135
- **FastAPI**: [http://localhost:8083](http://localhost:8083)
138136
- OpenAPI Documentation: [http://localhost:8083/docs](http://localhost:8083/docs)
139137
- **Node.js Express**: [http://localhost:8084](http://localhost:8084)
138+
- Swagger Documentation: [http://localhost:8084/docs](http://localhost:8084/docs)
140139
- **Unified Access** (if using Nginx): [http://localhost:8080](http://localhost:8080)
141140
- Flask API: [http://localhost:8080/flask](http://localhost:8080/flask)
142141
- FastAPI: [http://localhost:8080/fastapi](http://localhost:8080/fastapi)
143142
- Node.js: [http://localhost:8080/node](http://localhost:8080/node)
144143

145-
</details>
146-
147144
## 💻 Development Workflow
148145

149146
### Project Structure
@@ -196,39 +193,10 @@ All code is mounted as volumes in the Docker containers, so changes to files wil
196193
- **Python**: Add to `requirements.txt` and restart the containers
197194
- **Node.js**: Add to `package.json` and restart the containers
198195

199-
### Environment Variables
200-
201-
Configure your development environment by editing the `.env` file:
202-
203-
<details>
204-
<summary>View example environment configuration</summary>
205-
206-
```
207-
# Server Configurations
208-
FLASK_ENV=development
209-
FLASK_DEBUG=1
210-
NODE_ENV=development
211-
212-
# API Keys (for demonstration)
213-
DEMO_API_KEY=your_api_key_here
214-
215-
# Database Configuration (if needed)
216-
DB_HOST=localhost
217-
DB_PORT=5432
218-
DB_NAME=devdb
219-
DB_USER=devuser
220-
DB_PASSWORD=devpassword
221-
```
222-
223-
</details>
224-
225196
## 📝 API Documentation
226197

227198
All services implement the following standard endpoints:
228199

229-
<details>
230-
<summary>View API endpoints</summary>
231-
232200
### Root Endpoint
233201

234202
```
@@ -286,14 +254,12 @@ Response:
286254
}
287255
```
288256

289-
</details>
290-
291-
### FastAPI Documentation
292-
293-
FastAPI automatically generates interactive API documentation:
257+
### API Documentation Access
294258

295-
- **Swagger UI**: [http://localhost:8083/docs](http://localhost:8083/docs)
296-
- **ReDoc**: [http://localhost:8083/redoc](http://localhost:8083/redoc)
259+
- **Flask**: [http://localhost:8082/docs](http://localhost:8082/docs)
260+
- **FastAPI**: [http://localhost:8083/docs](http://localhost:8083/docs)
261+
- **Node.js**: [http://localhost:8084/docs](http://localhost:8084/docs)
262+
- **Live Server**: [http://localhost:8081/api.html](http://localhost:8081/api.html)
297263

298264
## 🧪 Testing
299265

@@ -305,9 +271,6 @@ The dashboard provides an interactive way to test all services:
305271
2. Click "Test" buttons for individual services
306272
3. Click "Test All Services" for a comprehensive check
307273

308-
<details>
309-
<summary>View command line testing options</summary>
310-
311274
### Command Line Testing
312275

313276
#### Bash Script
@@ -335,64 +298,55 @@ npm test
335298

336299
```bash
337300
# Run the Flask tests
338-
docker-compose exec flask-dev pytest tests/test_flask.py
301+
docker compose exec flask-dev pytest tests/test_flask.py
339302

340303
# Run the FastAPI tests
341-
docker-compose exec fastapi-dev pytest
304+
docker compose exec fastapi-dev pytest
342305
```
343306

344-
</details>
345-
346307
## 🐳 Managing Containers
347308

348-
<details>
349-
<summary>View Docker management commands</summary>
350-
351309
### Starting Services
352310

353311
```bash
354312
# Start all services
355-
docker-compose up
313+
docker compose up
356314

357315
# Start in detached mode
358-
docker-compose up -d
316+
docker compose up -d
359317

360318
# Start a specific service
361-
docker-compose up flask-dev
319+
docker compose up flask-dev
362320
```
363321

364322
### Stopping Services
365323

366324
```bash
367325
# Stop all services
368-
docker-compose down
326+
docker compose down
369327

370328
# Stop and remove volumes
371-
docker-compose down -v
329+
docker compose down -v
372330
```
373331

374332
### Viewing Logs
375333

376334
```bash
377335
# View logs from all services
378-
docker-compose logs
336+
docker compose logs
379337

380338
# Follow logs
381-
docker-compose logs -f
339+
docker compose logs -f
382340

383341
# View logs for a specific service
384-
docker-compose logs flask-dev
342+
docker compose logs flask-dev
385343
```
386344

387-
</details>
388-
389345
## 🚄 Performance Optimization
390346

391-
This environment includes several performance optimizations:
392-
393-
### FastAPI Resource Management
347+
### Resource Management
394348

395-
The FastAPI service includes CPU and memory limits to prevent resource contention:
349+
The services include CPU and memory limits to prevent resource contention:
396350

397351
```yaml
398352
deploy:
@@ -405,65 +359,39 @@ deploy:
405359
memory: 128M
406360
```
407361
408-
### Uvicorn Worker Configuration
362+
### Worker Configuration
409363
410-
For production deployments, the FastAPI service is configured with optimized worker settings:
364+
For production deployments, services can be configured with optimized worker settings:
411365
412366
```
413367
command: ["uvicorn", "app_fastapi:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1", "--log-level", "warning"]
414368
```
415369
416-
### Development vs. Production Settings
417-
418-
For development, use the included hot-reload settings. For production, consider:
419-
420-
1. Disabling hot-reload flags (`--reload`)
421-
2. Adjusting worker counts based on available CPU cores
422-
3. Setting appropriate logging levels
423-
424370
## 🔒 Security Considerations
425371
426372
### Container Security
427373
428-
The Dockerfile includes commented sections for running containers as non-root users:
374+
The Dockerfile includes sections for running containers as non-root users:
429375
430376
```dockerfile
431-
# --- Create non-root user and group ---
377+
# Create non-root user and group
432378
RUN addgroup -S dev-group && adduser -S dev-user -G dev-group
433379

434-
# --- Change ownership of the application directory ---
380+
# Change ownership of the application directory
435381
RUN chown -R dev-user:dev-group /app
436382

437-
# --- Switch to the non-root user ---
383+
# Switch to the non-root user
438384
USER dev-user
439385
```
440386

441387
Uncomment these sections for improved container security in production.
442388

443389
### Environment Variables
444390

445-
Ensure sensitive information is stored in `.env` files and never committed to version control. Update your `.gitignore` to exclude `.env` files:
446-
447-
```
448-
# Environment variables
449-
.env
450-
.env.*
451-
!.env.example
452-
```
391+
Store sensitive information in `.env` files and never commit them to version control.
453392

454393
## 🔄 Git Configuration
455394

456-
This project includes a complete Git workflow setup:
457-
458-
- **`.gitignore`**: Comprehensive ignore patterns for development files
459-
- **`.gitattributes`**: Line ending normalization and file handling
460-
- **GitHub Workflows**: Automated CI/CD with GitHub Actions
461-
- **Issue & PR Templates**: Standardized formats for contributions
462-
- **Git Hooks**: Pre-commit validation for code quality
463-
464-
<details>
465-
<summary>View Git setup instructions</summary>
466-
467395
### Setting Up Git Hooks
468396

469397
```bash
@@ -485,72 +413,36 @@ Follow the GitHub Flow branching strategy:
485413

486414
For detailed instructions, see [GIT_SETUP.md](GIT_SETUP.md).
487415

488-
</details>
489-
490416
## 🔧 Troubleshooting
491417

492-
<details>
493-
<summary>View common issues and solutions</summary>
494-
495418
### Common Issues
496419

497420
#### Service Not Starting
498421

499422
Check the Docker logs:
500423
```bash
501-
docker-compose logs [service-name]
424+
docker compose logs [service-name]
502425
```
503426

504427
#### Hot Reloading Not Working
505428

506429
Ensure the correct volume mounts are in place and file permissions are correct:
507430
```bash
508-
docker-compose down
509-
docker-compose up --build
431+
docker compose down
432+
docker compose up --build
510433
```
511434

512435
#### Cannot Access Service
513436

514437
Verify the port mappings in `compose.yml` and check if the container is running:
515438
```bash
516-
docker-compose ps
517-
```
518-
519-
#### High CPU Usage in FastAPI
520-
521-
If FastAPI is consuming excessive CPU resources, adjust the resource limits in `compose.yml` and consider disabling hot reload:
522-
523-
```yaml
524-
command: ["uvicorn", "app_fastapi:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1", "--log-level", "warning"]
525-
deploy:
526-
resources:
527-
limits:
528-
cpus: '0.5'
529-
memory: 256M
439+
docker compose ps
530440
```
531441

532-
#### Live Server Test Failing
533-
534-
Ensure the `src/api.html` file exists for the Live Server API endpoint. If the test still fails, check the browser console for CORS errors.
535-
536-
#### CI Pipeline Failing
537-
538-
Check the GitHub Actions logs for detailed error information. Common issues include:
539-
540-
- Missing test files or incorrect paths
541-
- Import errors in Python tests
542-
- Timing issues with service startup
543-
544-
### Health Checks
545-
546-
Each service has built-in health checks that Docker uses to monitor container status:
547-
548-
```bash
549-
# View container health
550-
docker ps
551-
```
442+
#### Debug Tools
552443

553-
</details>
444+
Use the debug interface to diagnose connection issues:
445+
- [http://localhost:8081/debug.html](http://localhost:8081/debug.html)
554446

555447
## 👥 Contributing
556448

0 commit comments

Comments
 (0)