feat: add config portability — full export/import, homepage import, docker label discovery
Add a dedicated Import/Export tool page with full configuration export/import (v2.0 bundle with encrypted secrets), Homepage services.yaml import with env variable resolution, and manual Docker label discovery (moved from cron job). Support importing Homarr JSON during onboarding alongside legacy zip import. New @homarr/board-portability package handles schema, serialization, compat checks, and import planning. Shared preview UI reused across admin and onboarding. Fix xterm.js crash by removing deprecated @xterm/addon-canvas (incompatible with xterm v6). Fix Homepage env variable i18n and React 19 currentTarget bug. See docs/config-portability.md for full changelog.
This commit is contained in:
100 files changed
+13394
-56
No files matched your search
@@ -26,6 +26,7 @@
|
||||
"dependencies": {
|
||||
"@drizzle-team/brocli": "catalog:",
|
||||
"@homarr/auth": "workspace:^0.1.0",
|
||||
"@homarr/board-portability": "workspace:^0.1.0",
|
||||
"@homarr/common": "workspace:^0.1.0",
|
||||
"@homarr/db": "workspace:^0.1.0",
|
||||
"@homarr/validation": "workspace:^0.1.0",
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { writeFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { command, string } from "@drizzle-team/brocli";
|
||||
|
||||
import { exportBoardBundleAsync, bundleFilenameForBoard } from "@homarr/board-portability";
|
||||
import { db } from "@homarr/db";
|
||||
import { boards } from "@homarr/db/schema";
|
||||
import { eq } from "@homarr/db";
|
||||
|
||||
export const boardsExport = command({
|
||||
name: "export",
|
||||
desc: "Export a board as a portable JSON bundle",
|
||||
options: {
|
||||
name: string("name").desc("Name of the board to export").required(),
|
||||
output: string("output").alias("o").desc("Output file path (defaults to homarr-board-<name>.json)"),
|
||||
},
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
handler: async (opts) => {
|
||||
const board = await db.query.boards.findFirst({
|
||||
where: eq(boards.name, opts.name),
|
||||
});
|
||||
|
||||
if (!board) {
|
||||
console.error(`Board "${opts.name}" not found`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const result = await exportBoardBundleAsync(db, board.id, "cli");
|
||||
|
||||
if (!result) {
|
||||
console.error(`Failed to export board "${opts.name}"`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const outputPath = resolve(opts.output ?? bundleFilenameForBoard(board.name));
|
||||
writeFileSync(outputPath, result.content, "utf-8");
|
||||
console.log(`Board exported to ${outputPath}`);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import { command } from "@drizzle-team/brocli";
|
||||
|
||||
import { db } from "@homarr/db";
|
||||
|
||||
export const boardsList = command({
|
||||
name: "list",
|
||||
desc: "List all boards (id, name, public)",
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
handler: async () => {
|
||||
const all = await db.query.boards.findMany();
|
||||
if (all.length === 0) {
|
||||
console.log("No boards found");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("ID\t\t\t\tName\t\tPublic");
|
||||
for (const board of all) {
|
||||
console.log(`${board.id}\t${board.name}\t\t${board.isPublic ? "yes" : "no"}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { command } from "@drizzle-team/brocli";
|
||||
|
||||
import { boardsExport } from "./boards-export";
|
||||
import { boardsList } from "./boards-list";
|
||||
|
||||
export const boardsRoot = command({
|
||||
name: "boards",
|
||||
desc: "Group of commands to manage boards",
|
||||
subcommands: [boardsList, boardsExport],
|
||||
});
|
||||
@@ -1,12 +1,13 @@
|
||||
import { run } from "@drizzle-team/brocli";
|
||||
|
||||
import { boardsRoot } from "./commands/boards";
|
||||
import { fixUsernames } from "./commands/fix-usernames";
|
||||
import { integrationsRoot } from "./commands/integrations";
|
||||
import { recreateAdmin } from "./commands/recreate-admin";
|
||||
import { resetPassword } from "./commands/reset-password";
|
||||
import { usersRoot } from "./commands/users";
|
||||
|
||||
const commands = [usersRoot, integrationsRoot, resetPassword, fixUsernames, recreateAdmin];
|
||||
const commands = [usersRoot, integrationsRoot, boardsRoot, resetPassword, fixUsernames, recreateAdmin];
|
||||
|
||||
void run(commands, {
|
||||
name: "homarr-cli",
|
||||
|
||||
Reference in new issue
Block a user