Repository navigation
Expand file tree
/
Copy pathdocker-compose.simple.yml
More file actions
175 lines (154 loc) · 5.32 KB
/
Copy pathdocker-compose.simple.yml
File metadata and controls
175 lines (154 loc) · 5.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Computer Vision CNC Manufacturing Platform - Simple Testing Environment
# Infrastructure services only for initial testing
version: '3.8'
networks:
cv-cnc-network:
driver: bridge
volumes:
postgres_data:
redis_data:
services:
# PostgreSQL Database
cv-cnc-postgres:
image: postgres:15-alpine
container_name: cv-cnc-postgres
environment:
POSTGRES_DB: cv_cnc_manufacturing_test
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass123
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- cv-cnc-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U testuser -d cv_cnc_manufacturing_test"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
cv-cnc-redis:
image: redis:7-alpine
container_name: cv-cnc-redis
command: redis-server --requirepass testredis123
volumes:
- redis_data:/data
ports:
- "6379:6379"
networks:
- cv-cnc-network
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 5s
retries: 5
# Mock CNC Machine (for testing)
cv-cnc-mock-cnc:
image: python:3.11-slim
container_name: cv-cnc-mock-cnc
command: >
sh -c "
pip install flask &&
python -c \"
import time
from threading import Thread
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/current')
def current():
return '''<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>
<MTConnectStreams>
<Header creationTime=\\\"2025-08-02T12:00:00Z\\\" />
<Streams>
<DeviceStream name=\\\"CNC-001\\\" uuid=\\\"000\\\">
<ComponentStream component=\\\"Controller\\\">
<Events>
<Execution dataItemId=\\\"exec\\\" timestamp=\\\"2025-08-02T12:00:00Z\\\">ACTIVE</Execution>
</Events>
<Samples>
<SpindleSpeed dataItemId=\\\"spindle\\\" timestamp=\\\"2025-08-02T12:00:00Z\\\">1500</SpindleSpeed>
</Samples>
</ComponentStream>
</DeviceStream>
</Streams>
</MTConnectStreams>'''
@app.route('/health')
def health():
return {'status': 'healthy', 'timestamp': '2025-08-02T23:00:00Z'}
def run_server():
app.run(host='0.0.0.0', port=5000, debug=True)
Thread(target=run_server, daemon=True).start()
# Keep container running
while True:
time.sleep(60)
\"
"
ports:
- "5000:5000"
networks:
- cv-cnc-network
# Simple API Test Service (Python with minimal dependencies)
cv-cnc-api-simple:
image: python:3.11-slim
container_name: cv-cnc-api-simple
command: >
sh -c "
pip install fastapi uvicorn psycopg2-binary redis &&
python -c \"
import uvicorn
from fastapi import FastAPI
from datetime import datetime
import psycopg2
import redis
import os
app = FastAPI(title='CV CNC Manufacturing Platform - Test', version='1.0.0')
@app.get('/')
def root():
return {
'message': 'Computer Vision CNC Manufacturing Platform - Test Mode',
'version': '1.0.0',
'status': 'running',
'timestamp': datetime.now().isoformat()
}
@app.get('/health')
def health():
health_status = {'status': 'healthy', 'checks': {}}
# Check database
try:
conn = psycopg2.connect('postgresql://testuser:testpass123@cv-cnc-postgres:5432/cv_cnc_manufacturing_test')
conn.close()
health_status['checks']['database'] = 'healthy'
except Exception as e:
health_status['checks']['database'] = f'unhealthy: {str(e)}'
health_status['status'] = 'unhealthy'
# Check Redis
try:
r = redis.Redis(host='cv-cnc-redis', port=6379, password='testredis123', decode_responses=True)
r.ping()
health_status['checks']['redis'] = 'healthy'
except Exception as e:
health_status['checks']['redis'] = f'unhealthy: {str(e)}'
health_status['status'] = 'unhealthy'
return health_status
@app.get('/api/manufacturing/status')
def manufacturing_status():
return {
'cnc_machines': {'connected': 1, 'active': 1, 'total': 1},
'computer_vision': {'status': 'ready', 'gpu_enabled': False, 'models_loaded': 2},
'quality_control': {'status': 'active', 'defect_detection': 'enabled'},
'production': {'mode': 'test', 'safety_enabled': False}
}
uvicorn.run(app, host='0.0.0.0', port=8000)
\"
"
ports:
- "8000:8000"
networks:
- cv-cnc-network
depends_on:
cv-cnc-postgres:
condition: service_healthy
cv-cnc-redis:
condition: service_healthy
restart: unless-stopped