dokku-compose 0.6.6 → 0.6.7
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/dist/index.js +24 -75
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,11 +142,6 @@ function createRunner(opts = {}) {
|
|
|
142
142
|
const result = await execa("dokku", args);
|
|
143
143
|
return { stdout: result.stdout, ok: true };
|
|
144
144
|
} catch (e) {
|
|
145
|
-
if (process.env.DOKKU_COMPOSE_DEBUG) {
|
|
146
|
-
console.error(`[debug] execDokku error for: dokku ${args.join(" ")}`);
|
|
147
|
-
console.error(`[debug] exit code: ${e.exitCode}, stderr: ${(e.stderr ?? "").slice(0, 200)}`);
|
|
148
|
-
console.error(`[debug] stdout length: ${(e.stdout ?? "").length}`);
|
|
149
|
-
}
|
|
150
145
|
return { stdout: e.stdout ?? "", ok: false };
|
|
151
146
|
}
|
|
152
147
|
}
|
|
@@ -162,9 +157,6 @@ function createRunner(opts = {}) {
|
|
|
162
157
|
},
|
|
163
158
|
async query(...args) {
|
|
164
159
|
const { stdout } = await execDokku(args);
|
|
165
|
-
if (process.env.DOKKU_COMPOSE_DEBUG && args[0]?.includes("builder-dockerfile")) {
|
|
166
|
-
console.error(`[debug] query ${args.join(" ")} => ${stdout.length} bytes`);
|
|
167
|
-
}
|
|
168
160
|
return stdout.trim();
|
|
169
161
|
},
|
|
170
162
|
async check(...args) {
|
|
@@ -190,13 +182,9 @@ function createContext(runner) {
|
|
|
190
182
|
runner,
|
|
191
183
|
query(...args) {
|
|
192
184
|
const key = args.join("\0");
|
|
193
|
-
|
|
194
|
-
if (!cached) {
|
|
185
|
+
if (!cache.has(key)) {
|
|
195
186
|
cache.set(key, runner.query(...args));
|
|
196
187
|
}
|
|
197
|
-
if (process.env.DOKKU_COMPOSE_DEBUG && args[0]?.includes("builder-dockerfile")) {
|
|
198
|
-
console.error(`[debug] ctx.query(${args.join(" ")}) cached=${cached}`);
|
|
199
|
-
}
|
|
200
188
|
return cache.get(key);
|
|
201
189
|
},
|
|
202
190
|
check(...args) {
|
|
@@ -553,64 +541,32 @@ function parseBuildArgs(dockerOptsBuild) {
|
|
|
553
541
|
for (const m of matches) args[m[1]] = m[2];
|
|
554
542
|
return args;
|
|
555
543
|
}
|
|
556
|
-
function buildConfigFromReports(builderReport, dockerfileReport, appJsonReport, dockerOptsBuild) {
|
|
557
|
-
const config = {};
|
|
558
|
-
if (dockerfileReport["dockerfile-path"])
|
|
559
|
-
config.dockerfile = dockerfileReport["dockerfile-path"];
|
|
560
|
-
if (appJsonReport["selected"])
|
|
561
|
-
config.app_json = appJsonReport["selected"];
|
|
562
|
-
if (builderReport["build-dir"])
|
|
563
|
-
config.context = builderReport["build-dir"];
|
|
564
|
-
const args = parseBuildArgs(dockerOptsBuild);
|
|
565
|
-
if (Object.keys(args).length > 0) config.args = args;
|
|
566
|
-
return config;
|
|
567
|
-
}
|
|
568
544
|
var Builder = {
|
|
569
545
|
key: "build",
|
|
570
546
|
async read(ctx, target) {
|
|
571
|
-
const builderRaw = await
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
547
|
+
const [builderRaw, dockerfileRaw, appJsonRaw, dockerOptsRaw] = await Promise.all([
|
|
548
|
+
ctx.query("builder:report", target),
|
|
549
|
+
ctx.query("builder-dockerfile:report", target),
|
|
550
|
+
ctx.query("app-json:report", target),
|
|
551
|
+
ctx.query("docker-options:report", target)
|
|
552
|
+
]);
|
|
553
|
+
const config = {};
|
|
554
|
+
const builderReport = parseReport(builderRaw, "builder");
|
|
555
|
+
const dockerfileReport = parseReport(dockerfileRaw, "builder-dockerfile");
|
|
556
|
+
const appJsonReport = parseReport(appJsonRaw, "app-json");
|
|
575
557
|
const dockerOptsReport = parseReport(dockerOptsRaw, "docker-options");
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
const dockerfileRaw = await ctx.query("builder-dockerfile:report");
|
|
586
|
-
const appJsonRaw = await ctx.query("app-json:report");
|
|
587
|
-
const dockerOptsRaw = await ctx.query("docker-options:report");
|
|
588
|
-
const builderBulk = parseBulkReport(builderRaw, "builder");
|
|
589
|
-
const dockerfileBulk = parseBulkReport(dockerfileRaw, "builder-dockerfile");
|
|
590
|
-
const appJsonBulk = parseBulkReport(appJsonRaw, "app-json");
|
|
591
|
-
const dockerOptsBulk = parseBulkReport(dockerOptsRaw, "docker-options");
|
|
592
|
-
if (process.env.DOKKU_COMPOSE_DEBUG) {
|
|
593
|
-
console.error("[debug] builderRaw length:", builderRaw.length);
|
|
594
|
-
console.error("[debug] dockerfileRaw length:", dockerfileRaw.length);
|
|
595
|
-
console.error("[debug] appJsonRaw length:", appJsonRaw.length);
|
|
596
|
-
console.error("[debug] dockerOptsRaw length:", dockerOptsRaw.length);
|
|
597
|
-
console.error("[debug] dockerfileRaw first 300:", JSON.stringify(dockerfileRaw.slice(0, 300)));
|
|
598
|
-
console.error("[debug] dockerOptsRaw first 300:", JSON.stringify(dockerOptsRaw.slice(0, 300)));
|
|
599
|
-
console.error("[debug] builderBulk keys:", [...builderBulk.keys()]);
|
|
600
|
-
console.error("[debug] dockerfileBulk keys:", [...dockerfileBulk.keys()]);
|
|
601
|
-
console.error("[debug] dockerOptsBulk keys:", [...dockerOptsBulk.keys()]);
|
|
602
|
-
}
|
|
603
|
-
const result = /* @__PURE__ */ new Map();
|
|
604
|
-
for (const app of builderBulk.keys()) {
|
|
605
|
-
result.set(app, buildConfigFromReports(
|
|
606
|
-
builderBulk.get(app) ?? {},
|
|
607
|
-
dockerfileBulk.get(app) ?? {},
|
|
608
|
-
appJsonBulk.get(app) ?? {},
|
|
609
|
-
dockerOptsBulk.get(app)?.["build"] ?? ""
|
|
610
|
-
));
|
|
611
|
-
}
|
|
612
|
-
return result;
|
|
558
|
+
if (dockerfileReport["dockerfile-path"])
|
|
559
|
+
config.dockerfile = dockerfileReport["dockerfile-path"];
|
|
560
|
+
if (appJsonReport["selected"])
|
|
561
|
+
config.app_json = appJsonReport["selected"];
|
|
562
|
+
if (builderReport["build-dir"])
|
|
563
|
+
config.context = builderReport["build-dir"];
|
|
564
|
+
const args = parseBuildArgs(dockerOptsReport["build"] ?? "");
|
|
565
|
+
if (Object.keys(args).length > 0) config.args = args;
|
|
566
|
+
return config;
|
|
613
567
|
},
|
|
568
|
+
// No readAll — builder-dockerfile:report and docker-options:report
|
|
569
|
+
// don't support bulk mode (no app arg) on all Dokku installations
|
|
614
570
|
async onChange(ctx, target, { after }) {
|
|
615
571
|
if (after.dockerfile)
|
|
616
572
|
await ctx.run("builder-dockerfile:set", target, "dockerfile-path", after.dockerfile);
|
|
@@ -650,15 +606,8 @@ var DockerOptions = {
|
|
|
650
606
|
const raw = await ctx.query("docker-options:report", target);
|
|
651
607
|
return dockerOptsFromReport(parseReport(raw, "docker-options"));
|
|
652
608
|
},
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const bulk = parseBulkReport(raw, "docker-options");
|
|
656
|
-
const result = /* @__PURE__ */ new Map();
|
|
657
|
-
for (const [app, report] of bulk) {
|
|
658
|
-
result.set(app, dockerOptsFromReport(report));
|
|
659
|
-
}
|
|
660
|
-
return result;
|
|
661
|
-
},
|
|
609
|
+
// No readAll — docker-options:report doesn't support bulk mode (no app arg)
|
|
610
|
+
// on all Dokku installations due to basher environment issues
|
|
662
611
|
async onChange(ctx, target, { before, after }) {
|
|
663
612
|
for (const phase of PHASES) {
|
|
664
613
|
const prev = new Set(before[phase] ?? []);
|