cyclecad 2.1.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BILLING-IMPLEMENTATION-SUMMARY.md +425 -0
- package/BILLING-INDEX.md +293 -0
- package/BILLING-INTEGRATION-GUIDE.md +414 -0
- package/COLLABORATION-INDEX.md +440 -0
- package/COLLABORATION-SYSTEM-SUMMARY.md +548 -0
- package/DELIVERABLES.txt +296 -445
- package/DOCKER-BUILD-MANIFEST.txt +483 -0
- package/DOCKER-FILES-REFERENCE.md +440 -0
- package/DOCKER-INFRASTRUCTURE.md +475 -0
- package/DOCKER-README.md +435 -0
- package/Dockerfile +33 -55
- package/ENHANCEMENT_COMPLETION_REPORT.md +383 -0
- package/ENHANCEMENT_SUMMARY.txt +308 -0
- package/FEATURE_INVENTORY.md +235 -0
- package/FUSION360_FEATURES_SUMMARY.md +452 -0
- package/FUSION360_PARITY_ENHANCEMENTS.md +461 -0
- package/FUSION360_PARITY_SUMMARY.md +520 -0
- package/FUSION360_QUICK_REFERENCE.md +351 -0
- package/MODULE_API_REFERENCE.md +712 -0
- package/MODULE_INVENTORY.txt +264 -0
- package/PWA-FILES-CREATED.txt +350 -0
- package/QUICK-START-TESTING.md +126 -0
- package/STEP-IMPORT-QUICKSTART.md +347 -0
- package/STEP-IMPORT-SYSTEM-SUMMARY.md +502 -0
- package/app/css/mobile.css +1074 -0
- package/app/icons/generate-icons.js +203 -0
- package/app/index.html +1342 -5031
- package/app/js/app.js +1312 -514
- package/app/js/billing-ui.js +990 -0
- package/app/js/brep-kernel.js +933 -981
- package/app/js/collab-client.js +750 -0
- package/app/js/mobile-nav.js +623 -0
- package/app/js/mobile-toolbar.js +476 -0
- package/app/js/modules/animation-module.js +497 -3
- package/app/js/modules/billing-module.js +724 -0
- package/app/js/modules/cam-module.js +507 -2
- package/app/js/modules/collaboration-module.js +513 -0
- package/app/js/modules/constraint-module.js +1266 -0
- package/app/js/modules/data-module.js +544 -1146
- package/app/js/modules/formats-module.js +438 -738
- package/app/js/modules/inspection-module.js +393 -0
- package/app/js/modules/mesh-module-enhanced.js +880 -0
- package/app/js/modules/plugin-module.js +597 -0
- package/app/js/modules/rendering-module.js +460 -0
- package/app/js/modules/scripting-module.js +593 -475
- package/app/js/modules/sketch-module.js +998 -2
- package/app/js/modules/step-module-enhanced.js +938 -0
- package/app/js/modules/surface-module.js +312 -0
- package/app/js/modules/version-module.js +420 -0
- package/app/js/offline-manager.js +705 -0
- package/app/js/responsive-init.js +360 -0
- package/app/js/touch-handler.js +429 -0
- package/app/manifest.json +211 -0
- package/app/offline.html +508 -0
- package/app/sw.js +571 -0
- package/app/tests/billing-tests.html +779 -0
- package/app/tests/brep-tests.html +980 -0
- package/app/tests/collab-tests.html +743 -0
- package/app/tests/mobile-tests.html +1299 -0
- package/app/tests/pwa-tests.html +1134 -0
- package/app/tests/step-tests.html +1042 -0
- package/app/tests/test-agent-v3.html +719 -0
- package/cycleCAD-Architecture-v2.pptx +0 -0
- package/docker-compose.yml +225 -0
- package/docs/BILLING-HELP.json +260 -0
- package/docs/BILLING-README.md +639 -0
- package/docs/BILLING-TUTORIAL.md +736 -0
- package/docs/BREP-HELP.json +326 -0
- package/docs/BREP-TUTORIAL.md +802 -0
- package/docs/COLLABORATION-HELP.json +228 -0
- package/docs/COLLABORATION-TUTORIAL.md +818 -0
- package/docs/DOCKER-HELP.json +224 -0
- package/docs/DOCKER-TUTORIAL.md +974 -0
- package/docs/MOBILE-HELP.json +243 -0
- package/docs/MOBILE-RESPONSIVE-README.md +378 -0
- package/docs/MOBILE-TUTORIAL.md +747 -0
- package/docs/PWA-HELP.json +228 -0
- package/docs/PWA-README.md +662 -0
- package/docs/PWA-TUTORIAL.md +757 -0
- package/docs/STEP-HELP.json +481 -0
- package/docs/STEP-IMPORT-TUTORIAL.md +824 -0
- package/docs/TESTING-GUIDE.md +528 -0
- package/docs/TESTING-HELP.json +182 -0
- package/fusion-vs-cyclecad.html +1771 -0
- package/nginx.conf +237 -0
- package/package.json +1 -1
- package/server/Dockerfile.converter +51 -0
- package/server/Dockerfile.signaling +28 -0
- package/server/billing-server.js +487 -0
- package/server/converter-enhanced.py +528 -0
- package/server/requirements-converter.txt +29 -0
- package/server/signaling-server.js +801 -0
- package/tests/docker-tests.sh +389 -0
- package/~$cycleCAD-Architecture-v2.pptx +0 -0
|
@@ -0,0 +1,974 @@
|
|
|
1
|
+
# cycleCAD Docker Infrastructure — Complete Guide
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
1. [Overview](#overview)
|
|
5
|
+
2. [Quick Start](#quick-start)
|
|
6
|
+
3. [Service Architecture](#service-architecture)
|
|
7
|
+
4. [Building Images](#building-images)
|
|
8
|
+
5. [Running Services](#running-services)
|
|
9
|
+
6. [Environment Configuration](#environment-configuration)
|
|
10
|
+
7. [Development Workflow](#development-workflow)
|
|
11
|
+
8. [Production Deployment](#production-deployment)
|
|
12
|
+
9. [SSL/TLS with Let's Encrypt](#ssltls-with-lets-encrypt)
|
|
13
|
+
10. [Scaling & Performance](#scaling--performance)
|
|
14
|
+
11. [Monitoring & Logging](#monitoring--logging)
|
|
15
|
+
12. [Troubleshooting](#troubleshooting)
|
|
16
|
+
13. [CI/CD Pipeline](#cicd-pipeline)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
cycleCAD Docker infrastructure consists of 4 microservices:
|
|
23
|
+
|
|
24
|
+
| Service | Tech | Port | Role |
|
|
25
|
+
|---------|------|------|------|
|
|
26
|
+
| **cyclecad** | Nginx | 8080 | Web application (landing + CAD app) |
|
|
27
|
+
| **converter** | FastAPI (Python) | 8787 | STEP/IGES → GLB conversion |
|
|
28
|
+
| **signaling** | Node.js/Express | 8788 | WebSocket for real-time collaboration |
|
|
29
|
+
| **explodeview** | Nginx | 3000 | 3D viewer (optional) |
|
|
30
|
+
|
|
31
|
+
### Resource Requirements
|
|
32
|
+
- **Minimum**: 4GB RAM, 2 CPU cores
|
|
33
|
+
- **Recommended**: 8GB RAM, 4 CPU cores
|
|
34
|
+
- **Production**: 16GB RAM, 8 CPU cores (with load balancer)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Prerequisites
|
|
41
|
+
- Docker Desktop (Mac/Windows) or Docker Engine (Linux)
|
|
42
|
+
- docker-compose v2.0+
|
|
43
|
+
- 4GB free disk space
|
|
44
|
+
- Port 8080, 8787, 8788 available (or modify docker-compose.yml)
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
47
|
+
|
|
48
|
+
**Mac/Windows:**
|
|
49
|
+
1. Download [Docker Desktop](https://www.docker.com/products/docker-desktop)
|
|
50
|
+
2. Install and start Docker Desktop
|
|
51
|
+
3. Open Terminal and verify:
|
|
52
|
+
```bash
|
|
53
|
+
docker --version
|
|
54
|
+
docker-compose --version
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Linux (Ubuntu/Debian):**
|
|
58
|
+
```bash
|
|
59
|
+
# Install Docker
|
|
60
|
+
sudo apt-get update
|
|
61
|
+
sudo apt-get install docker.io docker-compose
|
|
62
|
+
|
|
63
|
+
# Add user to docker group (avoid sudo)
|
|
64
|
+
sudo usermod -aG docker $USER
|
|
65
|
+
newgrp docker
|
|
66
|
+
|
|
67
|
+
# Verify
|
|
68
|
+
docker --version
|
|
69
|
+
docker-compose --version
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Start All Services
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd ~/cyclecad
|
|
76
|
+
docker-compose up -d
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Wait 30 seconds for health checks to pass. Then:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Check status
|
|
83
|
+
docker-compose ps
|
|
84
|
+
|
|
85
|
+
# Should show 3 services as (healthy)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Access Services
|
|
89
|
+
|
|
90
|
+
- **cycleCAD**: http://localhost:8080
|
|
91
|
+
- **Converter API**: http://localhost:8787/docs (OpenAPI Swagger)
|
|
92
|
+
- **Signaling**: ws://localhost:8788
|
|
93
|
+
- **ExplodeView** (optional): http://localhost:3000
|
|
94
|
+
|
|
95
|
+
### Stop All Services
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
docker-compose down
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
To also remove all volumes and data:
|
|
102
|
+
```bash
|
|
103
|
+
docker-compose down -v
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Service Architecture
|
|
109
|
+
|
|
110
|
+
### cycleCAD Web Application (Port 8080)
|
|
111
|
+
**Image**: `nginx:alpine`
|
|
112
|
+
**Role**: Static file serving + SPA routing
|
|
113
|
+
|
|
114
|
+
- Serves landing page (`/`)
|
|
115
|
+
- Serves CAD app (`/app/`)
|
|
116
|
+
- Reverse proxies API calls to converter and signaling
|
|
117
|
+
- Enables CORS, COOP/COEP headers for Web Workers
|
|
118
|
+
- Gzip compression for JS, CSS, WASM, JSON
|
|
119
|
+
- Health check: `GET /health` → JSON
|
|
120
|
+
|
|
121
|
+
**Features:**
|
|
122
|
+
- SPA routing: all `/app/*` routes → `/app/index.html`
|
|
123
|
+
- Max upload: 500MB (for STEP files)
|
|
124
|
+
- Cache strategy:
|
|
125
|
+
- Static assets (JS/CSS/WASM): 1 year
|
|
126
|
+
- HTML: no cache
|
|
127
|
+
- API responses: no cache
|
|
128
|
+
|
|
129
|
+
### STEP Converter Service (Port 8787)
|
|
130
|
+
**Image**: `python:3.11 + FastAPI`
|
|
131
|
+
**Role**: Server-side STEP/IGES import
|
|
132
|
+
|
|
133
|
+
- Accepts POST requests with STEP file
|
|
134
|
+
- Parses using CadQuery (powered by OpenCASCADE)
|
|
135
|
+
- Returns GLB (binary glTF 2.0) format
|
|
136
|
+
- Extracts metadata: parts, assemblies, properties
|
|
137
|
+
- Handles large files (tested up to 500MB)
|
|
138
|
+
- Health check: `GET /health` → JSON
|
|
139
|
+
|
|
140
|
+
**Memory**: 2GB reserved, 4GB limit
|
|
141
|
+
**Timeout**: 300 seconds
|
|
142
|
+
**Workers**: 2 concurrent requests
|
|
143
|
+
|
|
144
|
+
**Endpoints:**
|
|
145
|
+
- `POST /convert` — Convert STEP → GLB
|
|
146
|
+
- `GET /health` — Health check
|
|
147
|
+
- `GET /docs` — OpenAPI documentation
|
|
148
|
+
|
|
149
|
+
### Signaling Server (Port 8788)
|
|
150
|
+
**Image**: `node:20-alpine + Express + WebSocket`
|
|
151
|
+
**Role**: Real-time collaboration and cursor tracking
|
|
152
|
+
|
|
153
|
+
- Manages WebSocket connections
|
|
154
|
+
- Broadcasts cursor positions and selections
|
|
155
|
+
- Handles document state sync
|
|
156
|
+
- User presence tracking
|
|
157
|
+
- Connection pooling
|
|
158
|
+
|
|
159
|
+
**Features:**
|
|
160
|
+
- Max 1,000 concurrent connections
|
|
161
|
+
- Auto cleanup on disconnect
|
|
162
|
+
- JSON message protocol
|
|
163
|
+
- Health check: `GET /health` → JSON
|
|
164
|
+
|
|
165
|
+
**Endpoints:**
|
|
166
|
+
- `GET /health` — Health check
|
|
167
|
+
- `WS /ws` — WebSocket upgrade
|
|
168
|
+
|
|
169
|
+
### ExplodeView Viewer (Port 3000, Optional)
|
|
170
|
+
**Image**: `nginx:alpine`
|
|
171
|
+
**Role**: 3D CAD viewer for STEP/Inventor files
|
|
172
|
+
|
|
173
|
+
- Read-only viewer for assemblies
|
|
174
|
+
- Share and embed functionality
|
|
175
|
+
- Lightweight (40+ features)
|
|
176
|
+
|
|
177
|
+
**To enable**: `docker-compose --profile with-explodeview up -d`
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Building Images
|
|
182
|
+
|
|
183
|
+
### Build All Images
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cd ~/cyclecad
|
|
187
|
+
docker-compose build
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Output**: Pulls base images, installs deps, builds 3-4 images (~10 minutes first run)
|
|
191
|
+
|
|
192
|
+
### Build Specific Service
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Build only converter (useful for development)
|
|
196
|
+
docker-compose build converter
|
|
197
|
+
|
|
198
|
+
# Build with no cache (force full rebuild)
|
|
199
|
+
docker-compose build --no-cache converter
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### View Built Images
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
docker images | grep cyclecad
|
|
206
|
+
|
|
207
|
+
# Output:
|
|
208
|
+
# cyclecad latest abc123def456 2 minutes ago
|
|
209
|
+
# cyclecad-converter latest def456ghi789 1 minute ago
|
|
210
|
+
# cyclecad-signaling latest ghi789jkl012 30 seconds ago
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Running Services
|
|
216
|
+
|
|
217
|
+
### Start All Services (Foreground)
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
docker-compose up
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Shows real-time logs from all services. Press `Ctrl+C` to stop.
|
|
224
|
+
|
|
225
|
+
### Start All Services (Background)
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
docker-compose up -d
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Returns immediately. Services run in background.
|
|
232
|
+
|
|
233
|
+
### Check Status
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
docker-compose ps
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Output:**
|
|
240
|
+
```
|
|
241
|
+
NAME STATUS PORTS
|
|
242
|
+
cyclecad-app Up 2 minutes (healthy) 0.0.0.0:8080->80/tcp
|
|
243
|
+
cyclecad-converter Up 2 minutes (healthy) 0.0.0.0:8787->8787/tcp
|
|
244
|
+
cyclecad-signaling Up 2 minutes (healthy) 0.0.0.0:8788->8788/tcp
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### View Logs
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# All services
|
|
251
|
+
docker-compose logs -f
|
|
252
|
+
|
|
253
|
+
# Specific service
|
|
254
|
+
docker-compose logs -f converter
|
|
255
|
+
|
|
256
|
+
# Last 100 lines
|
|
257
|
+
docker-compose logs --tail 100
|
|
258
|
+
|
|
259
|
+
# Since specific time
|
|
260
|
+
docker-compose logs --since 2024-03-31 --until 2024-03-31T12:00:00
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Execute Commands in Service
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Shell into service
|
|
267
|
+
docker-compose exec cyclecad sh
|
|
268
|
+
|
|
269
|
+
# Run single command
|
|
270
|
+
docker-compose exec converter python -V
|
|
271
|
+
|
|
272
|
+
# Run with specific user
|
|
273
|
+
docker-compose exec -u root cyclecad apt-get update
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Stop Services
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Stop (can restart with docker-compose up)
|
|
280
|
+
docker-compose stop
|
|
281
|
+
|
|
282
|
+
# Stop specific service
|
|
283
|
+
docker-compose stop converter
|
|
284
|
+
|
|
285
|
+
# Stop and remove containers
|
|
286
|
+
docker-compose down
|
|
287
|
+
|
|
288
|
+
# Stop, remove containers, and remove volumes
|
|
289
|
+
docker-compose down -v
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Restart Service
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Restart all
|
|
296
|
+
docker-compose restart
|
|
297
|
+
|
|
298
|
+
# Restart specific service
|
|
299
|
+
docker-compose restart converter
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Environment Configuration
|
|
305
|
+
|
|
306
|
+
### Default Environment Variables
|
|
307
|
+
|
|
308
|
+
Create `.env` file in project root:
|
|
309
|
+
|
|
310
|
+
```env
|
|
311
|
+
# Application
|
|
312
|
+
APP_VERSION=0.8.6
|
|
313
|
+
APP_ENV=production
|
|
314
|
+
LOG_LEVEL=info
|
|
315
|
+
|
|
316
|
+
# Services
|
|
317
|
+
CONVERTER_URL=http://converter:8787
|
|
318
|
+
SIGNALING_URL=ws://signaling:8788
|
|
319
|
+
|
|
320
|
+
# Converter (FastAPI)
|
|
321
|
+
WORKERS=2
|
|
322
|
+
MAX_FILE_SIZE=500
|
|
323
|
+
TIMEOUT=300
|
|
324
|
+
|
|
325
|
+
# Signaling (Node.js)
|
|
326
|
+
NODE_ENV=production
|
|
327
|
+
MAX_CONNECTIONS=1000
|
|
328
|
+
|
|
329
|
+
# Nginx
|
|
330
|
+
NGINX_WORKER_PROCESSES=auto
|
|
331
|
+
NGINX_WORKER_CONNECTIONS=2048
|
|
332
|
+
|
|
333
|
+
# Database (optional, for future use)
|
|
334
|
+
DB_HOST=db
|
|
335
|
+
DB_PORT=5432
|
|
336
|
+
DB_NAME=cyclecad
|
|
337
|
+
DB_USER=cyclecad
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Load Environment Variables
|
|
341
|
+
|
|
342
|
+
Docker Compose automatically loads `.env` file. To override:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Override on command line
|
|
346
|
+
WORKERS=4 docker-compose up -d
|
|
347
|
+
|
|
348
|
+
# Or create environment file
|
|
349
|
+
docker-compose --env-file custom.env up -d
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Pass Environment to Service
|
|
353
|
+
|
|
354
|
+
In `docker-compose.yml`:
|
|
355
|
+
```yaml
|
|
356
|
+
services:
|
|
357
|
+
converter:
|
|
358
|
+
environment:
|
|
359
|
+
- WORKERS=${WORKERS:-2}
|
|
360
|
+
- LOG_LEVEL=${LOG_LEVEL:-info}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Development Workflow
|
|
366
|
+
|
|
367
|
+
### Local Development (No Docker)
|
|
368
|
+
|
|
369
|
+
For testing code changes without Docker:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Install dependencies locally
|
|
373
|
+
cd server
|
|
374
|
+
pip install -r requirements-converter.txt
|
|
375
|
+
|
|
376
|
+
# Run converter
|
|
377
|
+
python converter.py
|
|
378
|
+
|
|
379
|
+
# In another terminal, build and test CAD app
|
|
380
|
+
cd ../app
|
|
381
|
+
npm install # if using Node build tools
|
|
382
|
+
npm start
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Docker Development (with Hot Reload)
|
|
386
|
+
|
|
387
|
+
For rapid iteration on containerized code:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Mount source code as volume
|
|
391
|
+
docker-compose -f docker-compose.yml \
|
|
392
|
+
-f docker-compose.dev.yml \
|
|
393
|
+
up -d
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Create `docker-compose.dev.yml`:
|
|
397
|
+
```yaml
|
|
398
|
+
version: '3.8'
|
|
399
|
+
services:
|
|
400
|
+
converter:
|
|
401
|
+
volumes:
|
|
402
|
+
- ./server:/app # Mount source, code changes auto-reload
|
|
403
|
+
environment:
|
|
404
|
+
- RELOAD=true # Enable uvicorn reload
|
|
405
|
+
|
|
406
|
+
signaling:
|
|
407
|
+
volumes:
|
|
408
|
+
- ./server:/app
|
|
409
|
+
environment:
|
|
410
|
+
- NODE_ENV=development
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Testing Converter Service
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
# Health check
|
|
417
|
+
curl http://localhost:8787/health
|
|
418
|
+
|
|
419
|
+
# View API docs (Swagger UI)
|
|
420
|
+
open http://localhost:8787/docs
|
|
421
|
+
|
|
422
|
+
# Test STEP upload
|
|
423
|
+
curl -X POST http://localhost:8787/convert \
|
|
424
|
+
-F "file=@model.stp"
|
|
425
|
+
|
|
426
|
+
# Check response
|
|
427
|
+
# Returns GLB file in response body
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Testing Signaling Service
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Health check
|
|
434
|
+
curl http://localhost:8788/health
|
|
435
|
+
|
|
436
|
+
# Connect with websocat (install: brew install websocat)
|
|
437
|
+
websocat ws://localhost:8788/ws
|
|
438
|
+
|
|
439
|
+
# Type JSON and send
|
|
440
|
+
{"type":"cursor","x":100,"y":200}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Production Deployment
|
|
446
|
+
|
|
447
|
+
### Pre-Deployment Checklist
|
|
448
|
+
|
|
449
|
+
- [ ] All services pass health checks locally
|
|
450
|
+
- [ ] Environment variables set correctly
|
|
451
|
+
- [ ] Database backups in place
|
|
452
|
+
- [ ] SSL/TLS certificates ready (for HTTPS)
|
|
453
|
+
- [ ] Firewall rules configured (only expose 443, 22 for SSH)
|
|
454
|
+
- [ ] Resource limits verified (CPU, memory, disk)
|
|
455
|
+
- [ ] Logging configured (centralized logging service)
|
|
456
|
+
- [ ] Monitoring enabled (Prometheus, DataDog, etc.)
|
|
457
|
+
|
|
458
|
+
### VPS Deployment (DigitalOcean, AWS EC2, Linode)
|
|
459
|
+
|
|
460
|
+
**Step 1: Provision VM**
|
|
461
|
+
```bash
|
|
462
|
+
# Ubuntu 22.04 LTS, 8GB RAM, 4 CPU, 80GB SSD
|
|
463
|
+
|
|
464
|
+
# SSH into server
|
|
465
|
+
ssh root@your-vps-ip
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
**Step 2: Install Docker**
|
|
469
|
+
```bash
|
|
470
|
+
apt-get update
|
|
471
|
+
apt-get install -y docker.io docker-compose git
|
|
472
|
+
|
|
473
|
+
# Add user
|
|
474
|
+
adduser deploy
|
|
475
|
+
usermod -aG docker deploy
|
|
476
|
+
su - deploy
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Step 3: Clone Repository**
|
|
480
|
+
```bash
|
|
481
|
+
cd /home/deploy
|
|
482
|
+
git clone https://github.com/vvlars-cmd/cyclecad.git
|
|
483
|
+
cd cyclecad
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
**Step 4: Configure Environment**
|
|
487
|
+
```bash
|
|
488
|
+
# Create .env for production
|
|
489
|
+
cat > .env << EOF
|
|
490
|
+
APP_ENV=production
|
|
491
|
+
LOG_LEVEL=warn
|
|
492
|
+
CONVERTER_URL=https://cyclecad.com/converter
|
|
493
|
+
SIGNALING_URL=wss://cyclecad.com/signal
|
|
494
|
+
EOF
|
|
495
|
+
|
|
496
|
+
# Create production override file
|
|
497
|
+
cat > docker-compose.prod.yml << EOF
|
|
498
|
+
version: '3.8'
|
|
499
|
+
services:
|
|
500
|
+
cyclecad:
|
|
501
|
+
restart: always
|
|
502
|
+
deploy:
|
|
503
|
+
resources:
|
|
504
|
+
limits:
|
|
505
|
+
cpus: '2'
|
|
506
|
+
memory: 1G
|
|
507
|
+
logging:
|
|
508
|
+
driver: awslogs
|
|
509
|
+
options:
|
|
510
|
+
awslogs-group: cyclecad
|
|
511
|
+
awslogs-region: us-east-1
|
|
512
|
+
EOF
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
**Step 5: Start Services**
|
|
516
|
+
```bash
|
|
517
|
+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
**Step 6: Verify**
|
|
521
|
+
```bash
|
|
522
|
+
docker-compose ps
|
|
523
|
+
curl http://localhost:8080/health
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### AWS Elastic Container Service (ECS)
|
|
527
|
+
|
|
528
|
+
See `docs/DEPLOYMENT-ECS.md` for detailed ECS setup with Fargate.
|
|
529
|
+
|
|
530
|
+
### Kubernetes Deployment
|
|
531
|
+
|
|
532
|
+
For large-scale deployments with auto-scaling:
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
# Create Kubernetes manifests in k8s/ directory
|
|
536
|
+
ls k8s/
|
|
537
|
+
|
|
538
|
+
# Deploy
|
|
539
|
+
kubectl apply -f k8s/
|
|
540
|
+
kubectl rollout status deployment/cyclecad
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
See `docs/DEPLOYMENT-K8S.md` for full Kubernetes setup.
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## SSL/TLS with Let's Encrypt
|
|
548
|
+
|
|
549
|
+
### Using Nginx-Proxy + ACME Companion
|
|
550
|
+
|
|
551
|
+
For automatic SSL certificate management:
|
|
552
|
+
|
|
553
|
+
```yaml
|
|
554
|
+
version: '3.8'
|
|
555
|
+
services:
|
|
556
|
+
# Reverse proxy with automatic SSL
|
|
557
|
+
nginx-proxy:
|
|
558
|
+
image: nginxproxy/nginx-proxy
|
|
559
|
+
ports:
|
|
560
|
+
- "80:80"
|
|
561
|
+
- "443:443"
|
|
562
|
+
volumes:
|
|
563
|
+
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
564
|
+
- certs:/etc/nginx/certs:ro
|
|
565
|
+
- vhost:/etc/nginx/vhost.d
|
|
566
|
+
- html:/usr/share/nginx/html
|
|
567
|
+
networks:
|
|
568
|
+
- cyclecad-network
|
|
569
|
+
|
|
570
|
+
# Automatic SSL certificate generation
|
|
571
|
+
acme:
|
|
572
|
+
image: nginxproxy/acme-companion
|
|
573
|
+
environment:
|
|
574
|
+
- DEFAULT_EMAIL=your-email@cyclecad.com
|
|
575
|
+
volumes_from:
|
|
576
|
+
- nginx-proxy
|
|
577
|
+
volumes:
|
|
578
|
+
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
579
|
+
- acme:/etc/acme.sh
|
|
580
|
+
networks:
|
|
581
|
+
- cyclecad-network
|
|
582
|
+
|
|
583
|
+
cyclecad:
|
|
584
|
+
build: .
|
|
585
|
+
environment:
|
|
586
|
+
- VIRTUAL_HOST=cyclecad.com,www.cyclecad.com
|
|
587
|
+
- LETSENCRYPT_HOST=cyclecad.com,www.cyclecad.com
|
|
588
|
+
- LETSENCRYPT_EMAIL=your-email@cyclecad.com
|
|
589
|
+
networks:
|
|
590
|
+
- cyclecad-network
|
|
591
|
+
|
|
592
|
+
volumes:
|
|
593
|
+
certs:
|
|
594
|
+
vhost:
|
|
595
|
+
html:
|
|
596
|
+
acme:
|
|
597
|
+
|
|
598
|
+
networks:
|
|
599
|
+
cyclecad-network:
|
|
600
|
+
driver: bridge
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
**Start with SSL:**
|
|
604
|
+
```bash
|
|
605
|
+
docker-compose -f docker-compose.yml -f docker-compose.ssl.yml up -d
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
Certificates auto-generated and auto-renewed. Traffic redirected HTTP → HTTPS.
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
## Scaling & Performance
|
|
613
|
+
|
|
614
|
+
### Horizontal Scaling (Multiple Converters)
|
|
615
|
+
|
|
616
|
+
For heavy STEP processing load:
|
|
617
|
+
|
|
618
|
+
```yaml
|
|
619
|
+
services:
|
|
620
|
+
converter-1:
|
|
621
|
+
build: ./server/Dockerfile.converter
|
|
622
|
+
ports: ["8787:8787"]
|
|
623
|
+
deploy:
|
|
624
|
+
resources:
|
|
625
|
+
limits:
|
|
626
|
+
memory: 4G
|
|
627
|
+
|
|
628
|
+
converter-2:
|
|
629
|
+
build: ./server/Dockerfile.converter
|
|
630
|
+
ports: ["8787:8787"]
|
|
631
|
+
deploy:
|
|
632
|
+
resources:
|
|
633
|
+
limits:
|
|
634
|
+
memory: 4G
|
|
635
|
+
|
|
636
|
+
# Load balancer
|
|
637
|
+
converter-lb:
|
|
638
|
+
image: haproxy:2.8-alpine
|
|
639
|
+
ports: ["8787:8787"]
|
|
640
|
+
volumes:
|
|
641
|
+
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
642
|
+
depends_on:
|
|
643
|
+
- converter-1
|
|
644
|
+
- converter-2
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
### Vertical Scaling (More Resources)
|
|
648
|
+
|
|
649
|
+
Increase resource limits in `docker-compose.yml`:
|
|
650
|
+
```yaml
|
|
651
|
+
deploy:
|
|
652
|
+
resources:
|
|
653
|
+
limits:
|
|
654
|
+
cpus: '8'
|
|
655
|
+
memory: 16G
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### Caching Strategy
|
|
659
|
+
|
|
660
|
+
Use Redis for caching converter results:
|
|
661
|
+
|
|
662
|
+
```yaml
|
|
663
|
+
services:
|
|
664
|
+
redis:
|
|
665
|
+
image: redis:7-alpine
|
|
666
|
+
ports: ["6379:6379"]
|
|
667
|
+
volumes:
|
|
668
|
+
- redis-data:/data
|
|
669
|
+
|
|
670
|
+
converter:
|
|
671
|
+
environment:
|
|
672
|
+
- REDIS_URL=redis://redis:6379
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### Database (Future)
|
|
676
|
+
|
|
677
|
+
For user accounts and project storage:
|
|
678
|
+
|
|
679
|
+
```yaml
|
|
680
|
+
services:
|
|
681
|
+
db:
|
|
682
|
+
image: postgres:15-alpine
|
|
683
|
+
environment:
|
|
684
|
+
POSTGRES_DB: cyclecad
|
|
685
|
+
POSTGRES_USER: cyclecad
|
|
686
|
+
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
687
|
+
volumes:
|
|
688
|
+
- db-data:/var/lib/postgresql/data
|
|
689
|
+
healthcheck:
|
|
690
|
+
test: ["CMD", "pg_isready", "-U", "cyclecad"]
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
## Monitoring & Logging
|
|
696
|
+
|
|
697
|
+
### View Real-Time Logs
|
|
698
|
+
|
|
699
|
+
```bash
|
|
700
|
+
# All services
|
|
701
|
+
docker-compose logs -f --timestamps
|
|
702
|
+
|
|
703
|
+
# Specific service with color
|
|
704
|
+
docker-compose logs -f --timestamps converter
|
|
705
|
+
|
|
706
|
+
# Filter by pattern
|
|
707
|
+
docker-compose logs converter | grep ERROR
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
### Docker Events
|
|
711
|
+
|
|
712
|
+
```bash
|
|
713
|
+
# Monitor all Docker events
|
|
714
|
+
docker events --filter 'label=com.docker.compose.project=cyclecad'
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### Performance Monitoring
|
|
718
|
+
|
|
719
|
+
```bash
|
|
720
|
+
# CPU and memory usage
|
|
721
|
+
docker stats
|
|
722
|
+
|
|
723
|
+
# Check disk usage
|
|
724
|
+
docker system df
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Send Logs to Central Service (AWS CloudWatch)
|
|
728
|
+
|
|
729
|
+
Configure in `docker-compose.yml`:
|
|
730
|
+
```yaml
|
|
731
|
+
services:
|
|
732
|
+
converter:
|
|
733
|
+
logging:
|
|
734
|
+
driver: awslogs
|
|
735
|
+
options:
|
|
736
|
+
awslogs-group: /cyclecad/converter
|
|
737
|
+
awslogs-region: us-east-1
|
|
738
|
+
awslogs-stream-prefix: ecs
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
### Prometheus Metrics (Optional)
|
|
742
|
+
|
|
743
|
+
Add metrics endpoint to services:
|
|
744
|
+
|
|
745
|
+
```bash
|
|
746
|
+
# View Prometheus metrics
|
|
747
|
+
curl http://localhost:8787/metrics
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
---
|
|
751
|
+
|
|
752
|
+
## Troubleshooting
|
|
753
|
+
|
|
754
|
+
### Service Won't Start
|
|
755
|
+
|
|
756
|
+
```bash
|
|
757
|
+
# Check logs
|
|
758
|
+
docker-compose logs converter
|
|
759
|
+
|
|
760
|
+
# Common issues:
|
|
761
|
+
# 1. Port already in use
|
|
762
|
+
sudo lsof -i :8787 # Find process using port
|
|
763
|
+
kill -9 <PID>
|
|
764
|
+
|
|
765
|
+
# 2. Image not found
|
|
766
|
+
docker-compose pull
|
|
767
|
+
docker-compose build
|
|
768
|
+
|
|
769
|
+
# 3. Out of memory
|
|
770
|
+
# Increase Docker memory limit in settings
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### Health Check Failing
|
|
774
|
+
|
|
775
|
+
```bash
|
|
776
|
+
# Test manually
|
|
777
|
+
curl -v http://localhost:8080/health
|
|
778
|
+
curl -v http://localhost:8787/health
|
|
779
|
+
|
|
780
|
+
# If timeout, check firewall
|
|
781
|
+
sudo ufw allow 8080
|
|
782
|
+
sudo ufw allow 8787
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
### Service Crashes on Startup
|
|
786
|
+
|
|
787
|
+
```bash
|
|
788
|
+
# View detailed error
|
|
789
|
+
docker-compose logs -f converter
|
|
790
|
+
|
|
791
|
+
# Common fixes:
|
|
792
|
+
# 1. Rebuild without cache
|
|
793
|
+
docker-compose build --no-cache converter
|
|
794
|
+
|
|
795
|
+
# 2. Increase timeout
|
|
796
|
+
# Edit docker-compose.yml healthcheck start_period
|
|
797
|
+
|
|
798
|
+
# 3. Check system resources
|
|
799
|
+
docker system df
|
|
800
|
+
docker stats
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### WebSocket Connection Issues
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
# Check signaling service
|
|
807
|
+
curl http://localhost:8788/health
|
|
808
|
+
|
|
809
|
+
# Test WebSocket (requires websocat)
|
|
810
|
+
websocat ws://localhost:8788/ws
|
|
811
|
+
|
|
812
|
+
# If connection refused:
|
|
813
|
+
# 1. Firewall blocking
|
|
814
|
+
# 2. Service not running
|
|
815
|
+
# 3. Port mapping incorrect
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
### STEP Conversion Fails
|
|
819
|
+
|
|
820
|
+
```bash
|
|
821
|
+
# Check converter logs
|
|
822
|
+
docker-compose logs converter
|
|
823
|
+
|
|
824
|
+
# Test converter API
|
|
825
|
+
curl -X POST http://localhost:8787/convert \
|
|
826
|
+
-F "file=@test.stp" \
|
|
827
|
+
-v
|
|
828
|
+
|
|
829
|
+
# If timeout:
|
|
830
|
+
# 1. Increase TIMEOUT in .env
|
|
831
|
+
# 2. Increase memory: limits.memory: 8G
|
|
832
|
+
# 3. Increase workers: WORKERS=4
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
### Disk Space Issues
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
# Check disk usage
|
|
839
|
+
docker system df
|
|
840
|
+
|
|
841
|
+
# Clean up unused images/containers/volumes
|
|
842
|
+
docker system prune -a
|
|
843
|
+
|
|
844
|
+
# Remove specific volume
|
|
845
|
+
docker volume rm cyclecad_db-data
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
---
|
|
849
|
+
|
|
850
|
+
## CI/CD Pipeline
|
|
851
|
+
|
|
852
|
+
### GitHub Actions
|
|
853
|
+
|
|
854
|
+
Create `.github/workflows/docker-test.yml`:
|
|
855
|
+
|
|
856
|
+
```yaml
|
|
857
|
+
name: Docker E2E Tests
|
|
858
|
+
on: [push, pull_request]
|
|
859
|
+
|
|
860
|
+
jobs:
|
|
861
|
+
test:
|
|
862
|
+
runs-on: ubuntu-latest
|
|
863
|
+
steps:
|
|
864
|
+
- uses: actions/checkout@v4
|
|
865
|
+
|
|
866
|
+
- name: Set up Docker Buildx
|
|
867
|
+
uses: docker/setup-buildx-action@v2
|
|
868
|
+
|
|
869
|
+
- name: Build images
|
|
870
|
+
run: docker-compose build
|
|
871
|
+
|
|
872
|
+
- name: Start services
|
|
873
|
+
run: docker-compose up -d
|
|
874
|
+
|
|
875
|
+
- name: Wait for health
|
|
876
|
+
run: sleep 30
|
|
877
|
+
|
|
878
|
+
- name: Run tests
|
|
879
|
+
run: bash tests/docker-tests.sh
|
|
880
|
+
|
|
881
|
+
- name: Check logs
|
|
882
|
+
if: failure()
|
|
883
|
+
run: docker-compose logs
|
|
884
|
+
|
|
885
|
+
- name: Cleanup
|
|
886
|
+
run: docker-compose down
|
|
887
|
+
|
|
888
|
+
publish:
|
|
889
|
+
needs: test
|
|
890
|
+
runs-on: ubuntu-latest
|
|
891
|
+
if: github.ref == 'refs/heads/main'
|
|
892
|
+
steps:
|
|
893
|
+
- uses: actions/checkout@v4
|
|
894
|
+
|
|
895
|
+
- name: Login to Docker Hub
|
|
896
|
+
uses: docker/login-action@v2
|
|
897
|
+
with:
|
|
898
|
+
username: ${{ secrets.DOCKER_USERNAME }}
|
|
899
|
+
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
900
|
+
|
|
901
|
+
- name: Push to Docker Hub
|
|
902
|
+
run: |
|
|
903
|
+
docker tag cyclecad:latest cyclecad:$(git rev-parse --short HEAD)
|
|
904
|
+
docker push cyclecad:latest
|
|
905
|
+
docker push cyclecad:$(git rev-parse --short HEAD)
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
### Deploy on Push to Main
|
|
909
|
+
|
|
910
|
+
```yaml
|
|
911
|
+
- name: Deploy to VPS
|
|
912
|
+
if: success()
|
|
913
|
+
run: |
|
|
914
|
+
ssh -i ~/.ssh/deploy_key deploy@cyclecad.com << EOF
|
|
915
|
+
cd /home/deploy/cyclecad
|
|
916
|
+
git pull origin main
|
|
917
|
+
docker-compose pull
|
|
918
|
+
docker-compose up -d
|
|
919
|
+
EOF
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
---
|
|
923
|
+
|
|
924
|
+
## Maintenance
|
|
925
|
+
|
|
926
|
+
### Regular Backups
|
|
927
|
+
|
|
928
|
+
```bash
|
|
929
|
+
# Backup database
|
|
930
|
+
docker-compose exec db pg_dump cyclecad > backup.sql
|
|
931
|
+
|
|
932
|
+
# Backup all volumes
|
|
933
|
+
docker run --rm -v cyclecad_db-data:/data \
|
|
934
|
+
-v $(pwd):/backup ubuntu tar czf /backup/db-backup.tar.gz /data
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
### Update Services
|
|
938
|
+
|
|
939
|
+
```bash
|
|
940
|
+
# Pull latest images
|
|
941
|
+
docker-compose pull
|
|
942
|
+
|
|
943
|
+
# Restart with new images
|
|
944
|
+
docker-compose up -d
|
|
945
|
+
|
|
946
|
+
# Verify
|
|
947
|
+
docker-compose ps
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
### Clean Up Old Images
|
|
951
|
+
|
|
952
|
+
```bash
|
|
953
|
+
# Remove dangling images
|
|
954
|
+
docker image prune
|
|
955
|
+
|
|
956
|
+
# Remove all unused images
|
|
957
|
+
docker image prune -a
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
---
|
|
961
|
+
|
|
962
|
+
## Further Reading
|
|
963
|
+
|
|
964
|
+
- [Docker Documentation](https://docs.docker.com/)
|
|
965
|
+
- [Docker Compose Reference](https://docs.docker.com/compose/compose-file/)
|
|
966
|
+
- [Nginx Best Practices](https://nginx.org/en/docs/)
|
|
967
|
+
- [FastAPI Deployment](https://fastapi.tiangolo.com/deployment/)
|
|
968
|
+
- [Kubernetes Documentation](https://kubernetes.io/docs/)
|
|
969
|
+
|
|
970
|
+
## Support
|
|
971
|
+
|
|
972
|
+
For issues or questions:
|
|
973
|
+
- GitHub Issues: https://github.com/vvlars-cmd/cyclecad/issues
|
|
974
|
+
- Email: vvlars@googlemail.com
|