- Complete web-based STL file storage and 3D viewer - Express.js backend with SQLite database - Interactive Three.js 3D viewer with orbit controls - File upload with drag-and-drop support - Security features: rate limiting, input validation, helmet - Container deployment with Docker/Podman - Production-ready configuration management - Comprehensive logging and monitoring 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
122 lines
2.8 KiB
Markdown
122 lines
2.8 KiB
Markdown
# STL Storage - Docker Deployment
|
|
|
|
A web-based STL file storage and 3D viewer application packaged for container deployment.
|
|
|
|
## Quick Start
|
|
|
|
### Using Podman/Docker Compose (Recommended)
|
|
|
|
1. **Build and start the application:**
|
|
```bash
|
|
podman-compose up -d --build
|
|
# or with Docker
|
|
docker-compose up -d --build
|
|
```
|
|
|
|
2. **Access the application:**
|
|
- Web interface: http://localhost:3000
|
|
- Upload STL files and view them in 3D
|
|
|
|
### Using Podman/Docker directly
|
|
|
|
1. **Build the container:**
|
|
```bash
|
|
podman build -t stl-storage .
|
|
# or with Docker
|
|
docker build -t stl-storage .
|
|
```
|
|
|
|
2. **Run the container:**
|
|
```bash
|
|
podman run -d \
|
|
--name stl-storage-app \
|
|
-p 3000:3000 \
|
|
-v ./uploads:/app/uploads \
|
|
-v ./stl_storage.db:/app/stl_storage.db \
|
|
stl-storage
|
|
```
|
|
|
|
## Features
|
|
|
|
### 🎯 **Core Functionality**
|
|
- **Web-based STL upload** with drag-and-drop support
|
|
- **3D viewer** with interactive controls (rotate, zoom, pan)
|
|
- **File management** (search, download, delete)
|
|
- **Viewer controls** (wireframe mode, color changes, screenshots)
|
|
- **SQLite database** for metadata storage
|
|
- **Local file storage** for STL files
|
|
|
|
### 🔒 **Security Features**
|
|
- **Rate limiting** and DDoS protection
|
|
- **Input validation** and sanitization
|
|
- **File format validation** beyond extension checking
|
|
- **Security headers** via Helmet.js
|
|
- **Non-root container** execution
|
|
- **Structured logging** with Winston
|
|
|
|
### 📊 **Monitoring & Reliability**
|
|
- **Health checks** for container monitoring
|
|
- **Graceful shutdown** handling
|
|
- **Error tracking** and logging
|
|
- **Configurable file size** and rate limits
|
|
|
|
## Container Details
|
|
|
|
- **Base Image:** Node.js 18 Alpine
|
|
- **Port:** 3000
|
|
- **User:** Non-root user (stlapp:1001)
|
|
- **Health Check:** Built-in endpoint monitoring
|
|
- **Persistent Data:** Uploads and database via volumes
|
|
|
|
## Volume Mounts
|
|
|
|
- `./uploads:/app/uploads` - STL file storage
|
|
- `./stl_storage.db:/app/stl_storage.db` - SQLite database
|
|
|
|
## Environment Variables
|
|
|
|
- `NODE_ENV=production` (default)
|
|
- `PORT=3000` (default)
|
|
|
|
## Management Commands
|
|
|
|
```bash
|
|
# View logs
|
|
podman logs stl-storage-app
|
|
|
|
# Stop application
|
|
podman-compose down
|
|
|
|
# Restart application
|
|
podman-compose restart
|
|
|
|
# Update application
|
|
podman-compose up -d --build
|
|
```
|
|
|
|
## Security Features
|
|
|
|
- Non-root user execution
|
|
- File type validation (STL only)
|
|
- File size limits (100MB)
|
|
- CORS protection
|
|
- Health monitoring
|
|
|
|
## Troubleshooting
|
|
|
|
1. **Port conflicts:** Change the port mapping in docker-compose.yml
|
|
2. **Permission issues:** Ensure upload directory is writable
|
|
3. **Database issues:** Delete stl_storage.db to reinitialize
|
|
4. **Memory issues:** Increase container memory limits for large STL files
|
|
|
|
## Development
|
|
|
|
To run in development mode:
|
|
```bash
|
|
podman run -it --rm \
|
|
-p 3000:3000 \
|
|
-v $(pwd):/app \
|
|
-w /app \
|
|
node:18-alpine \
|
|
npm run dev
|
|
``` |