-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
157 lines (150 loc) · 5.91 KB
/
docker-compose.yml
File metadata and controls
157 lines (150 loc) · 5.91 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
# =============================================================================
# WAPRO Network Mock - Docker Compose Configuration
# =============================================================================
# All settings are loaded from .env file
# Set *_ENABLED=false in .env to disable a service and use external one
# =============================================================================
services:
# ---------------------------------------------------------------------------
# MSSQL WAPROMAG DATABASE
# ---------------------------------------------------------------------------
mssql-wapromag:
image: mcr.microsoft.com/mssql/server:2019-latest
container_name: ${MSSQL_CONTAINER_NAME:-wapromag-mssql}
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=${MSSQL_SA_PASSWORD:-WapromagPass123!}
- MSSQL_PID=Express
ports:
- "${MSSQL_EXTERNAL_PORT:-1433}:1433"
volumes:
- mssql_wapromag_data:/var/opt/mssql
- ./mssql-wapromag/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
wapro-network:
ipv4_address: 192.168.9.20
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P ${MSSQL_SA_PASSWORD:-WapromagPass123!} -Q 'SELECT 1' -C || /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${MSSQL_SA_PASSWORD:-WapromagPass123!} -Q 'SELECT 1'"]
interval: 30s
timeout: 10s
retries: 3
profiles:
- mssql
- full
# ---------------------------------------------------------------------------
# RPI SERVER (Main Application)
# ---------------------------------------------------------------------------
rpi-server:
build: ./rpi-server
container_name: ${RPI_CONTAINER_NAME:-rpi-mock-server}
ports:
- "${RPI_GUI_EXTERNAL_PORT:-8082}:${RPI_GUI_INTERNAL_PORT:-8080}"
- "${RPI_API_EXTERNAL_PORT:-8081}:${RPI_API_INTERNAL_PORT:-8081}"
environment:
- NODE_ENV=${NODE_ENV:-development}
# Database connection (can point to Docker or external)
- MSSQL_HOST=${MSSQL_HOST:-mssql-wapromag}
- MSSQL_PORT=${MSSQL_PORT:-1433}
- MSSQL_USER=${MSSQL_USER:-sa}
- MSSQL_PASSWORD=${MSSQL_PASSWORD:-WapromagPass123!}
- MSSQL_DATABASE=${MSSQL_DATABASE:-WAPROMAG_TEST}
# Printer 1 connection (can point to Docker or external)
- ZEBRA_1_HOST=${ZEBRA_1_HOST:-zebra-printer-1}
- ZEBRA_1_PORT=${ZEBRA_1_SOCKET_PORT:-9100}
- ZEBRA_1_NAME=${ZEBRA_1_NAME:-ZEBRA-001}
- ZEBRA_1_MODEL=${ZEBRA_1_MODEL:-ZT230}
# Printer 2 connection (can point to Docker or external)
- ZEBRA_2_HOST=${ZEBRA_2_HOST:-zebra-printer-2}
- ZEBRA_2_PORT=${ZEBRA_2_SOCKET_PORT:-9100}
- ZEBRA_2_NAME=${ZEBRA_2_NAME:-ZEBRA-002}
- ZEBRA_2_MODEL=${ZEBRA_2_MODEL:-ZT410}
# Internal ports
- RPI_GUI_PORT=${RPI_GUI_INTERNAL_PORT:-8080}
- RPI_API_PORT=${RPI_API_INTERNAL_PORT:-8081}
volumes:
- ./rpi-server:/app
- /app/node_modules
- /var/run/docker.sock:/var/run/docker.sock
user: "0:0"
networks:
wapro-network:
ipv4_address: 192.168.9.100
command: ["/bin/sh", "-c", "if [ ! -f node_modules/socket.io/package.json ]; then echo 'Installing dependencies (runtime as root)...' && mkdir -p node_modules && npm install --production --no-audit --no-fund; fi; node server.js"]
healthcheck:
test: ["CMD-SHELL", "curl -fs http://localhost:${RPI_GUI_INTERNAL_PORT:-8080}/health || curl -fs http://localhost:${RPI_API_INTERNAL_PORT:-8081}/health"]
interval: 30s
timeout: 10s
retries: 3
profiles:
- rpi
- full
# ---------------------------------------------------------------------------
# ZEBRA PRINTER 1 (Mock)
# ---------------------------------------------------------------------------
zebra-printer-1:
build: ./zebra-printer-1
container_name: ${ZEBRA_1_CONTAINER_NAME:-zebra-printer-1}
ports:
- "${ZEBRA_1_EXTERNAL_SOCKET_PORT:-9100}:9100"
- "${ZEBRA_1_EXTERNAL_WEB_PORT:-8091}:${ZEBRA_1_INTERNAL_WEB_PORT:-8080}"
environment:
- PRINTER_NAME=${ZEBRA_1_NAME:-ZEBRA-001}
- PRINTER_MODEL=${ZEBRA_1_MODEL:-ZT230}
- PRINTER_IP=${ZEBRA_1_HOST:-zebra-printer-1}
- PRINTER_SOCKET_PORT=9100
- FLASK_RUN_PORT=${ZEBRA_1_INTERNAL_WEB_PORT:-8080}
networks:
wapro-network:
ipv4_address: 192.168.9.165
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "9100"]
interval: 15s
timeout: 5s
retries: 3
profiles:
- zebra1
- zebra
- full
# ---------------------------------------------------------------------------
# TEST RUNNER
# ---------------------------------------------------------------------------
test-runner:
build: ./test-runner
container_name: ${TEST_RUNNER_CONTAINER_NAME:-test-runner}
environment:
- TEST_ENVIRONMENT=${TEST_ENVIRONMENT:-docker}
- MSSQL_HOST=${MSSQL_HOST:-mssql-wapromag}
- MSSQL_PORT=${MSSQL_PORT:-1433}
- ZEBRA_1_HOST=${ZEBRA_1_HOST:-zebra-printer-1}
- ZEBRA_1_PORT=${ZEBRA_1_SOCKET_PORT:-9100}
- ZEBRA_2_HOST=${ZEBRA_2_HOST:-zebra-printer-2}
- ZEBRA_2_PORT=${ZEBRA_2_SOCKET_PORT:-9100}
volumes:
- ./tests:/tests
- ./reports:/reports
networks:
wapro-network:
ipv4_address: 192.168.9.50
healthcheck:
test: ["CMD", "python3", "-c", "print('ok')"]
interval: 30s
timeout: 5s
retries: 3
profiles:
- testing
# =============================================================================
# NETWORKS
# =============================================================================
networks:
wapro-network:
driver: bridge
ipam:
config:
- subnet: ${NETWORK_SUBNET:-192.168.9.0/24}
# =============================================================================
# VOLUMES
# =============================================================================
volumes:
mssql_wapromag_data:
grafana_data:
prometheus_data: