mlgym-deploy 3.3.13 → 3.3.14
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/index.js +22 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1042,6 +1042,9 @@ async function detectDeploymentStrategy(projectPath) {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
1044
|
// Validate and potentially fix docker-compose.yml for Coolify compliance
|
|
1045
|
+
// IMPORTANT: For Coolify/Traefik routing, we must use "expose:" instead of "ports:"
|
|
1046
|
+
// Using "ports: 80:3000" tries to bind host port 80, which conflicts with Traefik
|
|
1047
|
+
// Using "expose: 3000" lets Traefik route traffic via docker labels (correct approach)
|
|
1045
1048
|
function validateAndFixDockerCompose(content) {
|
|
1046
1049
|
const lines = content.split('\n');
|
|
1047
1050
|
const issues = [];
|
|
@@ -1049,8 +1052,10 @@ function validateAndFixDockerCompose(content) {
|
|
|
1049
1052
|
let fixed = [...lines];
|
|
1050
1053
|
let inServicesSection = false;
|
|
1051
1054
|
let inPortsSection = false;
|
|
1055
|
+
let portsLineIndex = -1;
|
|
1052
1056
|
let currentService = '';
|
|
1053
1057
|
let currentIndent = '';
|
|
1058
|
+
let portsIndent = '';
|
|
1054
1059
|
|
|
1055
1060
|
for (let i = 0; i < lines.length; i++) {
|
|
1056
1061
|
const line = lines[i];
|
|
@@ -1074,38 +1079,45 @@ function validateAndFixDockerCompose(content) {
|
|
|
1074
1079
|
if ((line.startsWith(' ') || line.startsWith('\t')) &&
|
|
1075
1080
|
trimmed.endsWith(':') &&
|
|
1076
1081
|
!trimmed.startsWith('-') &&
|
|
1077
|
-
!['ports:', 'expose:', 'environment:', 'volumes:', 'networks:'].includes(trimmed)) {
|
|
1082
|
+
!['ports:', 'expose:', 'environment:', 'volumes:', 'networks:', 'depends_on:', 'healthcheck:', 'build:', 'image:', 'command:', 'labels:'].includes(trimmed)) {
|
|
1078
1083
|
currentService = trimmed.slice(0, -1);
|
|
1079
1084
|
currentIndent = line.match(/^(\s*)/)[1];
|
|
1080
1085
|
}
|
|
1081
1086
|
|
|
1082
|
-
// Check for ports section
|
|
1087
|
+
// Check for ports section - we'll convert this to expose
|
|
1083
1088
|
if (trimmed === 'ports:') {
|
|
1084
1089
|
inPortsSection = true;
|
|
1090
|
+
portsLineIndex = i;
|
|
1091
|
+
portsIndent = line.match(/^(\s*)/)[1];
|
|
1092
|
+
// Change "ports:" to "expose:"
|
|
1093
|
+
fixed[i] = line.replace('ports:', 'expose:');
|
|
1094
|
+
fixes.push(`${currentService}: Changed "ports:" to "expose:" for Traefik compatibility`);
|
|
1085
1095
|
continue;
|
|
1086
1096
|
}
|
|
1087
1097
|
|
|
1088
|
-
// Process port entries
|
|
1098
|
+
// Process port entries - convert "HOST:CONTAINER" to just "CONTAINER"
|
|
1089
1099
|
if (inPortsSection && trimmed.startsWith('- ')) {
|
|
1090
1100
|
const portEntry = trimmed.slice(2).replace(/['"]/g, '');
|
|
1091
1101
|
|
|
1092
1102
|
if (portEntry.includes(':')) {
|
|
1103
|
+
// Has host:container mapping - extract just the container port
|
|
1093
1104
|
const [external, internal] = portEntry.split(':').map(p => p.trim());
|
|
1094
|
-
const webPorts = ['80', '8080', '3000', '4000', '5000', '8000', '9000'];
|
|
1105
|
+
const webPorts = ['80', '8080', '3000', '4000', '5000', '8000', '9000', '4567', '8888'];
|
|
1095
1106
|
|
|
1096
|
-
if (webPorts.includes(internal)
|
|
1107
|
+
if (webPorts.includes(internal)) {
|
|
1097
1108
|
issues.push({
|
|
1098
1109
|
line: i + 1,
|
|
1099
1110
|
service: currentService,
|
|
1100
|
-
issue: `Port mapping "${external}:${internal}"
|
|
1101
|
-
fix: `Use "
|
|
1111
|
+
issue: `Port mapping "${external}:${internal}" binds to host port`,
|
|
1112
|
+
fix: `Use expose: "${internal}" for Traefik routing`
|
|
1102
1113
|
});
|
|
1103
1114
|
|
|
1104
|
-
// Fix the line -
|
|
1105
|
-
fixed[i] = line.replace(trimmed, `- "
|
|
1106
|
-
fixes.push(
|
|
1115
|
+
// Fix the line - use only internal port for expose
|
|
1116
|
+
fixed[i] = line.replace(trimmed, `- "${internal}"`);
|
|
1117
|
+
fixes.push(`${currentService}: ${external}:${internal} → expose: ${internal}`);
|
|
1107
1118
|
}
|
|
1108
1119
|
}
|
|
1120
|
+
// If it's just a single port (no colon), leave it as-is for expose
|
|
1109
1121
|
} else if (inPortsSection && !trimmed.startsWith('-')) {
|
|
1110
1122
|
inPortsSection = false;
|
|
1111
1123
|
}
|
package/package.json
CHANGED