Skip to content

Commit aab6c0a

Browse files
committed
docs
1 parent 0e9f448 commit aab6c0a

File tree

5 files changed

+188
-84
lines changed

5 files changed

+188
-84
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.3.0] - 2024-01-15
6+
### Added
7+
- Secure file validation using magic bytes for enhanced security
8+
- Improved image processing with optimized resize operations
9+
- Redis cache integration for better performance
10+
- AWS S3 Glacier storage class support
11+
- Worker pool implementation for concurrent processing
12+
- Health check endpoint with detailed status
13+
- Prometheus metrics integration
14+
15+
### Changed
16+
- Refactored image processing service for better reliability
17+
- Enhanced error handling with detailed messages
18+
- Updated logging system with structured logs
19+
- Improved request validation
20+
- Optimized cache invalidation strategy
21+
22+
### Fixed
23+
- Memory leak in image processing operations
24+
- Concurrent upload handling issues
25+
- Cache invalidation race conditions
26+
- File type validation security issues
27+
- Error handling in batch operations
28+
29+
## [1.2.0] - 2023-12-01
30+
### Added
31+
- Basic image processing capabilities
32+
- MinIO storage integration
33+
- Simple caching mechanism
34+
- Basic error handling
35+
- Initial API endpoints
36+
37+
### Changed
38+
- Improved file upload process
39+
- Enhanced storage handling
40+
- Basic performance optimizations
41+
42+
## [1.1.0] - 2023-09-15
43+
### Added
44+
- Initial MinIO integration
45+
- Basic file upload/download
46+
- Simple authentication
47+
48+
## [1.0.0] - 2023-06-15
49+
- Initial release
50+
- Basic CDN functionality

README.md

Lines changed: 8 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -175,92 +175,16 @@ For production deployments, we provide comprehensive Kubernetes configurations w
175175

176176
For detailed instructions, see [Kubernetes Deployment Guide](k8s/README.md)
177177

178-
## Testing
178+
## Documentation
179179

180-
### Prerequisites for Testing
181-
The project requires ImageMagick for image processing operations. To ensure a consistent test environment, we recommend running tests inside Docker containers.
180+
For detailed information, please refer to:
182181

183-
### Running Tests
184-
185-
1. Build and start the containers:
186-
```bash
187-
docker-compose up -d
188-
```
189-
190-
2. Run tests inside the container:
191-
```bash
192-
# Run all tests
193-
docker exec cdn-golang go test ./... -v
194-
195-
# Run specific package tests
196-
docker exec cdn-golang go test ./pkg/worker -v
197-
docker exec cdn-golang go test ./service -v
198-
docker exec cdn-golang go test ./handler -v
199-
```
200-
201-
3. Run tests with coverage:
202-
```bash
203-
docker exec cdn-golang go test ./... -coverprofile=coverage.out
204-
docker exec cdn-golang go tool cover -html=coverage.out -o coverage.html
205-
```
206-
207-
### Test Environment
208-
The test container includes:
209-
- ImageMagick (latest version, dynamically managed)
210-
- Redis for caching and rate limiting tests
211-
- MinIO for storage tests
212-
- Mock AWS services
213-
- k6 for load testing
214-
215-
### Test Coverage
216-
- Unit tests with minimum 80% coverage
217-
- Integration tests for all endpoints
218-
- Performance tests using k6
219-
- Load testing scenarios
220-
- Automated API testing
221-
222-
### Load Testing
223-
```bash
224-
# Run basic load test
225-
k6 run test/performance/load_test.js
226-
227-
# Run stress test
228-
k6 run --vus 50 --duration 5m test/performance/load_test.js
229-
230-
# Run spike test
231-
k6 run --vus 100 --duration 10s test/performance/spike_test.js
232-
```
233-
234-
## Architecture
235-
236-
The service is built with a modular architecture:
237-
238-
- `cmd/`: Application entry point
239-
- `handler/`: Request handlers
240-
- `service/`: Core business logic
241-
- `pkg/`:
242-
- `batch/`: Batch processing
243-
- `worker/`: Worker pool
244-
- `middleware/`: HTTP middlewares
245-
- `observability/`: Monitoring and tracing
246-
- `config/`: Configuration management
247-
248-
## Performance Optimizations
249-
250-
- Redis caching for resized images
251-
- Worker pool for concurrent image processing
252-
- Batch processing for bulk operations
253-
- Rate limiting with bypass protection
254-
- Efficient memory management
255-
- Dynamic resource allocation
256-
257-
## Contributing
258-
259-
1. Fork the repository
260-
2. Create your feature branch
261-
3. Commit your changes
262-
4. Push to the branch
263-
5. Create a new Pull Request
182+
- [Testing Guide](docs/testing.md)
183+
- [Troubleshooting Guide](docs/troubleshooting.md)
184+
- [Migration Guide](docs/migration.md)
185+
- [Changelog](CHANGELOG.md)
186+
- [Kubernetes Deployment Guide](k8s/README.md)
187+
- [Contributing](CONTRIBUTING.md)
264188

265189
## License
266190

docs/migration.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Migration Guide
2+
3+
## Migrating from v1.x to v2.x
4+
5+
1. **Configuration Changes**
6+
- Add new environment variables using `.env.example` as reference
7+
- Update Redis cache configuration
8+
9+
2. **API Changes**
10+
- `/upload` endpoint now expects `multipart/form-data`
11+
- Resize parameters moved from query string to form data
12+
13+
3. **Database Changes**
14+
- Cache system migrated to Redis
15+
- MinIO bucket structure updated
16+
17+
4. **Required Steps**
18+
```bash
19+
# 1. Stop the service
20+
systemctl stop cdn-service
21+
22+
# 2. Install new version
23+
git pull
24+
go build
25+
26+
# 3. Update configuration
27+
cp .env.example .env
28+
nano .env
29+
30+
# 4. Clear cache
31+
redis-cli FLUSHALL
32+
33+
# 5. Start service
34+
systemctl start cdn-service
35+
```

docs/testing.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Testing Guide
2+
3+
## Prerequisites
4+
5+
The project requires ImageMagick for image processing operations. To ensure a consistent test environment, we recommend running tests inside Docker containers.
6+
7+
## Running Tests
8+
9+
1. Build and start the containers:
10+
```bash
11+
docker-compose up -d
12+
```
13+
14+
2. Run tests inside the container:
15+
```bash
16+
# Run all tests
17+
docker exec cdn-golang go test ./... -v
18+
19+
# Run specific package tests
20+
docker exec cdn-golang go test ./pkg/worker -v
21+
docker exec cdn-golang go test ./service -v
22+
docker exec cdn-golang go test ./handler -v
23+
```
24+
25+
3. Run tests with coverage:
26+
```bash
27+
docker exec cdn-golang go test ./... -coverprofile=coverage.out
28+
docker exec cdn-golang go tool cover -html=coverage.out -o coverage.html
29+
```
30+
31+
## Test Environment
32+
33+
The test container includes:
34+
- ImageMagick (latest version, dynamically managed)
35+
- Redis for caching and rate limiting tests
36+
- MinIO for storage tests
37+
- Mock AWS services
38+
- k6 for load testing
39+
40+
## Test Coverage
41+
42+
- Unit tests with minimum 80% coverage
43+
- Integration tests for all endpoints
44+
- Performance tests using k6
45+
- Load testing scenarios
46+
- Automated API testing
47+
48+
## Load Testing
49+
50+
```bash
51+
# Run basic load test
52+
k6 run test/performance/load_test.js
53+
54+
# Run stress test
55+
k6 run --vus 50 --duration 5m test/performance/load_test.js
56+
57+
# Run spike test
58+
k6 run --vus 100 --duration 10s test/performance/spike_test.js
59+
```

docs/troubleshooting.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Troubleshooting Guide
2+
3+
## Common Issues and Solutions
4+
5+
1. **MinIO Connection Issues**
6+
- Error: "Unable to connect to MinIO server"
7+
- Solution:
8+
- Ensure MinIO service is running
9+
- Check MinIO connection details in `.env` file
10+
- Verify firewall settings
11+
12+
2. **File Upload Issues**
13+
- Error: "File size exceeds limit"
14+
- Solution:
15+
- Check `BodyLimit` setting (default: 25MB)
16+
- If using Nginx, verify `client_max_body_size` setting
17+
18+
3. **Image Processing Issues**
19+
- Error: "Image processing failed"
20+
- Solution:
21+
- Verify ImageMagick is installed
22+
- Check if file format is supported
23+
- Monitor memory limits
24+
25+
4. **Cache Issues**
26+
- Error: "Redis connection failed"
27+
- Solution:
28+
- Ensure Redis service is running
29+
- Verify Redis connection details
30+
- Monitor Redis memory usage
31+
32+
## Logging and Monitoring
33+
34+
- Error logs: `/var/log/cdn-service/error.log`
35+
- Application logs: `/var/log/cdn-service/app.log`
36+
- Metrics: Available via `/metrics` endpoint for Prometheus

0 commit comments

Comments
 (0)