dokku-compose 0.10.1 → 0.11.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/README.md +1 -0
- package/dist/index.js +43 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ All features are idempotent — running `up` twice produces no changes.
|
|
|
111
111
|
| Feature | Description | Reference |
|
|
112
112
|
|---------|-------------|-----------|
|
|
113
113
|
| Apps | Create and destroy Dokku apps | [apps](docs/reference/apps.md) |
|
|
114
|
+
| Dokku Version | Warn when the server's Dokku version is older than the pinned floor | [dokku](docs/reference/dokku.md) |
|
|
114
115
|
| Environment Variables | Set config vars per app or globally, with full convergence | [config](docs/reference/config.md) |
|
|
115
116
|
| Build | Dockerfile path, build context, app.json, build args | [builder](docs/reference/builder.md) |
|
|
116
117
|
| Docker Options | Custom Docker options per phase (build/deploy/run) | [docker_options](docs/reference/docker_options.md) |
|
package/dist/index.js
CHANGED
|
@@ -275,6 +275,9 @@ function logDone() {
|
|
|
275
275
|
function logSkip() {
|
|
276
276
|
console.log(`... ${chalk.yellow("already configured")}`);
|
|
277
277
|
}
|
|
278
|
+
function logWarn(context, message) {
|
|
279
|
+
console.warn(chalk.yellow(`[${context.padEnd(12)}] WARN: ${message}`));
|
|
280
|
+
}
|
|
278
281
|
|
|
279
282
|
// src/core/reconcile.ts
|
|
280
283
|
async function reconcile(resource, ctx, target, desired) {
|
|
@@ -818,7 +821,7 @@ async function ensurePlugins(ctx, plugins) {
|
|
|
818
821
|
async function ensureDockerAuth(ctx, config) {
|
|
819
822
|
for (const [server, creds] of Object.entries(config)) {
|
|
820
823
|
logAction("docker-auth", `Logging in to ${server} as ${creds.username}`);
|
|
821
|
-
await ctx.run("registry:login", server, creds.username, creds.password);
|
|
824
|
+
await ctx.run("registry:login", "--global", server, creds.username, creds.password);
|
|
822
825
|
logDone();
|
|
823
826
|
}
|
|
824
827
|
}
|
|
@@ -1016,6 +1019,40 @@ async function exportRedis(ctx) {
|
|
|
1016
1019
|
return services;
|
|
1017
1020
|
}
|
|
1018
1021
|
|
|
1022
|
+
// src/modules/version.ts
|
|
1023
|
+
var SEMVER_RE = /^(\d+)\.(\d+)\.(\d+)/;
|
|
1024
|
+
function parseSemver(input) {
|
|
1025
|
+
const m = input.match(SEMVER_RE);
|
|
1026
|
+
if (!m) throw new Error(`Cannot parse version: ${input}`);
|
|
1027
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
1028
|
+
}
|
|
1029
|
+
function extractServerVersion(output) {
|
|
1030
|
+
const match = output.match(/(\d+\.\d+\.\d+)/);
|
|
1031
|
+
return match ? match[1] : null;
|
|
1032
|
+
}
|
|
1033
|
+
function compareSemver(a, b) {
|
|
1034
|
+
const [aMaj, aMin, aPatch] = parseSemver(a);
|
|
1035
|
+
const [bMaj, bMin, bPatch] = parseSemver(b);
|
|
1036
|
+
if (aMaj !== bMaj) return aMaj < bMaj ? -1 : 1;
|
|
1037
|
+
if (aMin !== bMin) return aMin < bMin ? -1 : 1;
|
|
1038
|
+
if (aPatch !== bPatch) return aPatch < bPatch ? -1 : 1;
|
|
1039
|
+
return 0;
|
|
1040
|
+
}
|
|
1041
|
+
async function ensureDokkuVersion(ctx, pinned) {
|
|
1042
|
+
if (!pinned) return;
|
|
1043
|
+
const output = await ctx.query("version");
|
|
1044
|
+
const server = extractServerVersion(output);
|
|
1045
|
+
if (!server) {
|
|
1046
|
+
throw new Error(`Cannot parse Dokku server version from output: ${output}`);
|
|
1047
|
+
}
|
|
1048
|
+
if (compareSemver(server, pinned) === -1) {
|
|
1049
|
+
logWarn(
|
|
1050
|
+
"dokku",
|
|
1051
|
+
`server is v${server} but dokku-compose.yml pins >= v${pinned}. Some features may be unavailable.`
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1019
1056
|
// src/modules/links.ts
|
|
1020
1057
|
function resolveServicePlugin(name, config) {
|
|
1021
1058
|
if (config.postgres?.[name]) return { plugin: "postgres", config: config.postgres[name] };
|
|
@@ -1098,6 +1135,7 @@ async function ensureGlobalNginx(ctx, nginx) {
|
|
|
1098
1135
|
// src/commands/up.ts
|
|
1099
1136
|
async function runUp(ctx, config, appFilter) {
|
|
1100
1137
|
const apps = appFilter.length > 0 ? appFilter : Object.keys(config.apps);
|
|
1138
|
+
await ensureDokkuVersion(ctx, config.dokku?.version);
|
|
1101
1139
|
if (config.plugins) await ensurePlugins(ctx, config.plugins);
|
|
1102
1140
|
if (config.docker_auth) await ensureDockerAuth(ctx, config.docker_auth);
|
|
1103
1141
|
if (config.domains !== void 0) await ensureGlobalDomains(ctx, config.domains);
|
|
@@ -1211,9 +1249,8 @@ var ALL_APP_RESOURCES = [
|
|
|
1211
1249
|
// src/commands/export.ts
|
|
1212
1250
|
async function runExport(ctx, opts) {
|
|
1213
1251
|
const config = { apps: {} };
|
|
1214
|
-
const
|
|
1215
|
-
|
|
1216
|
-
if (versionMatch) config.dokku = { version: versionMatch[1] };
|
|
1252
|
+
const version2 = extractServerVersion(await ctx.query("version"));
|
|
1253
|
+
if (version2) config.dokku = { version: version2 };
|
|
1217
1254
|
const apps = opts.appFilter?.length ? opts.appFilter : await exportApps(ctx);
|
|
1218
1255
|
const networks = await exportNetworks(ctx);
|
|
1219
1256
|
if (networks.length > 0) config.networks = networks;
|
|
@@ -1263,7 +1300,7 @@ function maskSensitiveArgs(cmd) {
|
|
|
1263
1300
|
return `${key}=${maskValue(value)}`;
|
|
1264
1301
|
});
|
|
1265
1302
|
masked = masked.replace(
|
|
1266
|
-
/^(registry:login\s
|
|
1303
|
+
/^(registry:login\s+(?:--global\s+)?\S+\s+\S+\s+)(\S+)/,
|
|
1267
1304
|
(_, prefix, password) => `${prefix}${maskValue(password)}`
|
|
1268
1305
|
);
|
|
1269
1306
|
return masked;
|
|
@@ -1292,6 +1329,7 @@ function maskSensitiveData(data) {
|
|
|
1292
1329
|
import chalk2 from "chalk";
|
|
1293
1330
|
async function computeDiff(ctx, config) {
|
|
1294
1331
|
const result = { apps: {}, services: {}, inSync: true };
|
|
1332
|
+
await ensureDokkuVersion(ctx, config.dokku?.version);
|
|
1295
1333
|
const prefetched = /* @__PURE__ */ new Map();
|
|
1296
1334
|
await Promise.all(
|
|
1297
1335
|
ALL_APP_RESOURCES.filter((r) => !r.forceApply && !r.key.startsWith("_") && r.readAll).map(async (r) => {
|