forked from trent_larson/crowd-funder-for-time-pwa
docs: comprehensive documentation updates and modernization
- Update BUILDING.md with current build system information - Modernize various README files across the project - Update CHANGELOG.md with recent changes - Improve documentation consistency and formatting - Update platform-specific documentation (iOS, Electron, Docker) - Enhance test documentation and build guides
This commit is contained in:
@@ -155,6 +155,7 @@ VITE_PASSKEYS_ENABLED=true
|
||||
## Build Modes
|
||||
|
||||
### Development Mode
|
||||
|
||||
- **Target**: `development`
|
||||
- **Features**: Hot reloading, development server
|
||||
- **Port**: 5173
|
||||
@@ -168,6 +169,7 @@ docker build --target development -t timesafari:dev .
|
||||
```
|
||||
|
||||
### Staging Mode
|
||||
|
||||
- **Target**: `staging`
|
||||
- **Features**: Production build with relaxed caching
|
||||
- **Port**: 8080 (mapped from 80)
|
||||
@@ -181,6 +183,7 @@ docker build --build-arg BUILD_MODE=staging -t timesafari:staging .
|
||||
```
|
||||
|
||||
### Production Mode
|
||||
|
||||
- **Target**: `production`
|
||||
- **Features**: Optimized production build
|
||||
- **Port**: 80
|
||||
@@ -194,6 +197,7 @@ docker build -t timesafari:latest .
|
||||
```
|
||||
|
||||
### Custom Mode
|
||||
|
||||
- **Target**: Configurable via `BUILD_TARGET`
|
||||
- **Features**: Fully configurable
|
||||
- **Port**: Configurable via `CUSTOM_PORT`
|
||||
@@ -250,6 +254,7 @@ docker-compose up staging
|
||||
## Security Features
|
||||
|
||||
### Built-in Security
|
||||
|
||||
- **Non-root user execution**: All containers run as non-root users
|
||||
- **Security headers**: XSS protection, content type options, frame options
|
||||
- **Rate limiting**: API request rate limiting
|
||||
@@ -257,6 +262,7 @@ docker-compose up staging
|
||||
- **Minimal attack surface**: Alpine Linux base images
|
||||
|
||||
### Security Headers
|
||||
|
||||
- `X-Frame-Options: SAMEORIGIN`
|
||||
- `X-Content-Type-Options: nosniff`
|
||||
- `X-XSS-Protection: 1; mode=block`
|
||||
@@ -266,17 +272,20 @@ docker-compose up staging
|
||||
## Performance Optimizations
|
||||
|
||||
### Caching Strategy
|
||||
|
||||
- **Static assets**: 1 year cache with immutable flag (production)
|
||||
- **HTML files**: 1 hour cache (production) / no cache (staging)
|
||||
- **Service worker**: No cache
|
||||
- **Manifest**: 1 day cache (production) / 1 hour cache (staging)
|
||||
|
||||
### Compression
|
||||
|
||||
- **Gzip compression**: Enabled for text-based files
|
||||
- **Compression level**: 6 (balanced)
|
||||
- **Minimum size**: 1024 bytes
|
||||
|
||||
### Nginx Optimizations
|
||||
|
||||
- **Sendfile**: Enabled for efficient file serving
|
||||
- **TCP optimizations**: nopush and nodelay enabled
|
||||
- **Keepalive**: 65 second timeout
|
||||
@@ -285,19 +294,23 @@ docker-compose up staging
|
||||
## Health Checks
|
||||
|
||||
### Built-in Health Checks
|
||||
|
||||
All services include health checks that:
|
||||
|
||||
- Check every 30 seconds
|
||||
- Timeout after 10 seconds
|
||||
- Retry 3 times before marking unhealthy
|
||||
- Start checking after 40 seconds
|
||||
|
||||
### Health Check Endpoints
|
||||
|
||||
- **Production/Staging**: `http://localhost/health`
|
||||
- **Development**: `http://localhost:5173`
|
||||
|
||||
## SSL/HTTPS Setup
|
||||
|
||||
### SSL Certificates
|
||||
|
||||
For SSL deployment, create an `ssl` directory with certificates:
|
||||
|
||||
```bash
|
||||
@@ -308,6 +321,7 @@ cp your-key.pem ssl/
|
||||
```
|
||||
|
||||
### SSL Configuration
|
||||
|
||||
Use the `production-ssl` service in docker-compose:
|
||||
|
||||
```bash
|
||||
@@ -317,10 +331,12 @@ docker-compose up production-ssl
|
||||
## Monitoring and Logging
|
||||
|
||||
### Log Locations
|
||||
|
||||
- **Access logs**: `/var/log/nginx/access.log`
|
||||
- **Error logs**: `/var/log/nginx/error.log`
|
||||
|
||||
### Log Format
|
||||
|
||||
```
|
||||
$remote_addr - $remote_user [$time_local] "$request"
|
||||
$status $body_bytes_sent "$http_referer"
|
||||
@@ -328,6 +344,7 @@ $status $body_bytes_sent "$http_referer"
|
||||
```
|
||||
|
||||
### Log Levels
|
||||
|
||||
- **Production**: `warn` level
|
||||
- **Staging**: `debug` level
|
||||
- **Development**: Full logging
|
||||
@@ -337,6 +354,7 @@ $status $body_bytes_sent "$http_referer"
|
||||
### Common Issues
|
||||
|
||||
#### Build Failures
|
||||
|
||||
```bash
|
||||
# Check build logs
|
||||
docker build -t timesafari:latest . 2>&1 | tee build.log
|
||||
@@ -349,6 +367,7 @@ docker run --rm timesafari:latest npm list --depth=0
|
||||
```
|
||||
|
||||
#### Container Won't Start
|
||||
|
||||
```bash
|
||||
# Check container logs
|
||||
docker logs <container_id>
|
||||
@@ -361,6 +380,7 @@ netstat -tulpn | grep :80
|
||||
```
|
||||
|
||||
#### Environment Variables Not Set
|
||||
|
||||
```bash
|
||||
# Check environment in container
|
||||
docker exec <container_id> env | grep VITE_
|
||||
@@ -373,6 +393,7 @@ cat .env.production
|
||||
```
|
||||
|
||||
#### Performance Issues
|
||||
|
||||
```bash
|
||||
# Check container resources
|
||||
docker stats <container_id>
|
||||
@@ -387,6 +408,7 @@ docker exec <container_id> tail -f /var/log/nginx/access.log
|
||||
### Debug Commands
|
||||
|
||||
#### Container Debugging
|
||||
|
||||
```bash
|
||||
# Enter running container
|
||||
docker exec -it <container_id> /bin/sh
|
||||
@@ -399,6 +421,7 @@ docker exec <container_id> ls -la /usr/share/nginx/html
|
||||
```
|
||||
|
||||
#### Network Debugging
|
||||
|
||||
```bash
|
||||
# Check container network
|
||||
docker network inspect bridge
|
||||
@@ -413,6 +436,7 @@ docker exec <container_id> nslookup google.com
|
||||
## Production Deployment
|
||||
|
||||
### Recommended Production Setup
|
||||
|
||||
1. **Use specific version tags**: `timesafari:1.0.0`
|
||||
2. **Implement health checks**: Already included
|
||||
3. **Configure proper logging**: Use external log aggregation
|
||||
@@ -420,6 +444,7 @@ docker exec <container_id> nslookup google.com
|
||||
5. **Use Docker secrets**: For sensitive data
|
||||
|
||||
### Production Commands
|
||||
|
||||
```bash
|
||||
# Build with specific version
|
||||
docker build -t timesafari:1.0.0 .
|
||||
@@ -442,6 +467,7 @@ docker run -d --name timesafari -p 80:80 --restart unless-stopped --env-file .en
|
||||
## Development Workflow
|
||||
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
# Start development environment
|
||||
./docker/run.sh dev
|
||||
@@ -454,6 +480,7 @@ docker-compose down dev
|
||||
```
|
||||
|
||||
### Testing Changes
|
||||
|
||||
```bash
|
||||
# Build and test staging
|
||||
./docker/run.sh staging
|
||||
@@ -463,6 +490,7 @@ docker-compose down dev
|
||||
```
|
||||
|
||||
### Continuous Integration
|
||||
|
||||
```bash
|
||||
# Build and test in CI
|
||||
docker build -t timesafari:test .
|
||||
@@ -479,6 +507,7 @@ docker rm timesafari-test
|
||||
## Best Practices
|
||||
|
||||
### Security
|
||||
|
||||
- Always use non-root users
|
||||
- Keep base images updated
|
||||
- Scan images for vulnerabilities
|
||||
@@ -486,6 +515,7 @@ docker rm timesafari-test
|
||||
- Implement proper access controls
|
||||
|
||||
### Performance
|
||||
|
||||
- Use multi-stage builds
|
||||
- Optimize layer caching
|
||||
- Minimize image size
|
||||
@@ -493,6 +523,7 @@ docker rm timesafari-test
|
||||
- Implement proper caching
|
||||
|
||||
### Monitoring
|
||||
|
||||
- Use health checks
|
||||
- Monitor resource usage
|
||||
- Set up log aggregation
|
||||
@@ -500,8 +531,9 @@ docker rm timesafari-test
|
||||
- Use proper error handling
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Regular security updates
|
||||
- Monitor for vulnerabilities
|
||||
- Keep dependencies updated
|
||||
- Document configuration changes
|
||||
- Test deployment procedures
|
||||
- Test deployment procedures
|
||||
|
||||
Reference in New Issue
Block a user