feat(onboarding): add Docker label discovery during init
Port label-based container discovery from config-portability and wire it into the onboarding integrations step. Labeled containers take priority over image matching, sync into category sections, and preserve board layout when placing integration widgets.
This commit is contained in:
26 files changed
+1630
-58
No files matched your search
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE `docker_app_source` (
|
||||
`host` varchar(512) NOT NULL,
|
||||
`container_id` varchar(128) NOT NULL,
|
||||
`external_id` varchar(512) NOT NULL,
|
||||
`app_id` varchar(64) NOT NULL,
|
||||
`board_id` varchar(64) NOT NULL,
|
||||
`item_id` varchar(64),
|
||||
`integration_id` varchar(64),
|
||||
`updated_at` timestamp NOT NULL DEFAULT (now()),
|
||||
CONSTRAINT `docker_app_source_host_container_id_pk` PRIMARY KEY(`host`,`container_id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_app_id_app_id_fk` FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_board_id_board_id_fk` FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_item_id_item_id_fk` FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_integration_id_integration_id_fk` FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX `docker_app_source__external_id_idx` ON `docker_app_source` (`host`,`external_id`);
|
||||
@@ -295,6 +295,13 @@
|
||||
"when": 1780764500000,
|
||||
"tag": "0041_merge_custom_widget_url",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 42,
|
||||
"version": "5",
|
||||
"when": 1780764600000,
|
||||
"tag": "0042_add_docker_app_source",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE "docker_app_source" (
|
||||
"host" varchar(512) NOT NULL,
|
||||
"container_id" varchar(128) NOT NULL,
|
||||
"external_id" varchar(512) NOT NULL,
|
||||
"app_id" varchar(64) NOT NULL,
|
||||
"board_id" varchar(64) NOT NULL,
|
||||
"item_id" varchar(64),
|
||||
"integration_id" varchar(64),
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "docker_app_source_host_container_id_pk" PRIMARY KEY("host","container_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_app_id_app_id_fk" FOREIGN KEY ("app_id") REFERENCES "public"."app"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_board_id_board_id_fk" FOREIGN KEY ("board_id") REFERENCES "public"."board"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_item_id_item_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."item"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_integration_id_integration_id_fk" FOREIGN KEY ("integration_id") REFERENCES "public"."integration"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "docker_app_source__external_id_idx" ON "docker_app_source" USING btree ("host","external_id");
|
||||
@@ -57,6 +57,13 @@
|
||||
"when": 1780764500000,
|
||||
"tag": "0007_merge_custom_widget_url",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 8,
|
||||
"version": "7",
|
||||
"when": 1780764600000,
|
||||
"tag": "0008_add_docker_app_source",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE `docker_app_source` (
|
||||
`host` text NOT NULL,
|
||||
`container_id` text NOT NULL,
|
||||
`external_id` text NOT NULL,
|
||||
`app_id` text NOT NULL,
|
||||
`board_id` text NOT NULL,
|
||||
`item_id` text,
|
||||
`integration_id` text,
|
||||
`updated_at` integer NOT NULL,
|
||||
PRIMARY KEY(`host`, `container_id`),
|
||||
FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON UPDATE no action ON DELETE set null,
|
||||
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE set null
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `docker_app_source__external_id_idx` ON `docker_app_source` (`host`,`external_id`);
|
||||
@@ -281,6 +281,13 @@
|
||||
"when": 1780764500000,
|
||||
"tag": "0039_merge_custom_widget_url",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 40,
|
||||
"version": "6",
|
||||
"when": 1780764600000,
|
||||
"tag": "0040_add_docker_app_source",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -51,6 +51,7 @@ export const {
|
||||
cronJobConfigurations,
|
||||
customWidgetDefinitions,
|
||||
customWidgetSecrets,
|
||||
dockerAppSources,
|
||||
} = schema;
|
||||
|
||||
export type User = InferSelectModel<typeof schema.users>;
|
||||
|
||||
@@ -547,6 +547,33 @@ export const cronJobConfigurations = mysqlTable("cron_job_configuration", {
|
||||
isEnabled: boolean().default(true).notNull(),
|
||||
});
|
||||
|
||||
export const dockerAppSources = mysqlTable(
|
||||
"docker_app_source",
|
||||
{
|
||||
host: varchar({ length: 512 }).notNull(),
|
||||
containerId: varchar({ length: 128 }).notNull(),
|
||||
externalId: varchar({ length: 512 }).notNull(),
|
||||
appId: varchar({ length: 64 })
|
||||
.notNull()
|
||||
.references(() => apps.id, { onDelete: "cascade" }),
|
||||
boardId: varchar({ length: 64 })
|
||||
.notNull()
|
||||
.references(() => boards.id, { onDelete: "cascade" }),
|
||||
itemId: varchar({ length: 64 }).references(() => items.id, { onDelete: "set null" }),
|
||||
integrationId: varchar({ length: 64 }).references(() => integrations.id, { onDelete: "set null" }),
|
||||
updatedAt: timestamp()
|
||||
.notNull()
|
||||
.$onUpdateFn(() => new Date())
|
||||
.$defaultFn(() => new Date()),
|
||||
},
|
||||
(table) => ({
|
||||
compoundKey: primaryKey({
|
||||
columns: [table.host, table.containerId],
|
||||
}),
|
||||
externalIdIdx: index("docker_app_source__external_id_idx").on(table.host, table.externalId),
|
||||
}),
|
||||
);
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
user: one(users, {
|
||||
fields: [accounts.userId],
|
||||
@@ -826,3 +853,22 @@ export const customWidgetSecretRelations = relations(customWidgetSecrets, ({ one
|
||||
references: [customWidgetDefinitions.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const dockerAppSourceRelations = relations(dockerAppSources, ({ one }) => ({
|
||||
app: one(apps, {
|
||||
fields: [dockerAppSources.appId],
|
||||
references: [apps.id],
|
||||
}),
|
||||
board: one(boards, {
|
||||
fields: [dockerAppSources.boardId],
|
||||
references: [boards.id],
|
||||
}),
|
||||
item: one(items, {
|
||||
fields: [dockerAppSources.itemId],
|
||||
references: [items.id],
|
||||
}),
|
||||
integration: one(integrations, {
|
||||
fields: [dockerAppSources.integrationId],
|
||||
references: [integrations.id],
|
||||
}),
|
||||
}));
|
||||
@@ -546,6 +546,33 @@ export const cronJobConfigurations = pgTable("cron_job_configuration", {
|
||||
isEnabled: boolean().default(true).notNull(),
|
||||
});
|
||||
|
||||
export const dockerAppSources = pgTable(
|
||||
"docker_app_source",
|
||||
{
|
||||
host: varchar({ length: 512 }).notNull(),
|
||||
containerId: varchar({ length: 128 }).notNull(),
|
||||
externalId: varchar({ length: 512 }).notNull(),
|
||||
appId: varchar({ length: 64 })
|
||||
.notNull()
|
||||
.references(() => apps.id, { onDelete: "cascade" }),
|
||||
boardId: varchar({ length: 64 })
|
||||
.notNull()
|
||||
.references(() => boards.id, { onDelete: "cascade" }),
|
||||
itemId: varchar({ length: 64 }).references(() => items.id, { onDelete: "set null" }),
|
||||
integrationId: varchar({ length: 64 }).references(() => integrations.id, { onDelete: "set null" }),
|
||||
updatedAt: timestamp()
|
||||
.notNull()
|
||||
.$onUpdateFn(() => new Date())
|
||||
.$defaultFn(() => new Date()),
|
||||
},
|
||||
(table) => ({
|
||||
compoundKey: primaryKey({
|
||||
columns: [table.host, table.containerId],
|
||||
}),
|
||||
externalIdIdx: index("docker_app_source__external_id_idx").on(table.host, table.externalId),
|
||||
}),
|
||||
);
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
user: one(users, {
|
||||
fields: [accounts.userId],
|
||||
@@ -825,3 +852,22 @@ export const customWidgetSecretRelations = relations(customWidgetSecrets, ({ one
|
||||
references: [customWidgetDefinitions.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const dockerAppSourceRelations = relations(dockerAppSources, ({ one }) => ({
|
||||
app: one(apps, {
|
||||
fields: [dockerAppSources.appId],
|
||||
references: [apps.id],
|
||||
}),
|
||||
board: one(boards, {
|
||||
fields: [dockerAppSources.boardId],
|
||||
references: [boards.id],
|
||||
}),
|
||||
item: one(items, {
|
||||
fields: [dockerAppSources.itemId],
|
||||
references: [items.id],
|
||||
}),
|
||||
integration: one(integrations, {
|
||||
fields: [dockerAppSources.integrationId],
|
||||
references: [integrations.id],
|
||||
}),
|
||||
}));
|
||||
@@ -536,6 +536,33 @@ export const cronJobConfigurations = sqliteTable("cron_job_configuration", {
|
||||
isEnabled: int({ mode: "boolean" }).default(true).notNull(),
|
||||
});
|
||||
|
||||
export const dockerAppSources = sqliteTable(
|
||||
"docker_app_source",
|
||||
{
|
||||
host: text().notNull(),
|
||||
containerId: text().notNull(),
|
||||
externalId: text().notNull(),
|
||||
appId: text()
|
||||
.notNull()
|
||||
.references(() => apps.id, { onDelete: "cascade" }),
|
||||
boardId: text()
|
||||
.notNull()
|
||||
.references(() => boards.id, { onDelete: "cascade" }),
|
||||
itemId: text().references(() => items.id, { onDelete: "set null" }),
|
||||
integrationId: text().references(() => integrations.id, { onDelete: "set null" }),
|
||||
updatedAt: int({ mode: "timestamp" })
|
||||
.$onUpdateFn(() => new Date())
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date()),
|
||||
},
|
||||
(table) => ({
|
||||
compoundKey: primaryKey({
|
||||
columns: [table.host, table.containerId],
|
||||
}),
|
||||
externalIdIdx: index("docker_app_source__external_id_idx").on(table.host, table.externalId),
|
||||
}),
|
||||
);
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
user: one(users, {
|
||||
fields: [accounts.userId],
|
||||
@@ -815,3 +842,22 @@ export const customWidgetSecretRelations = relations(customWidgetSecrets, ({ one
|
||||
references: [customWidgetDefinitions.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const dockerAppSourceRelations = relations(dockerAppSources, ({ one }) => ({
|
||||
app: one(apps, {
|
||||
fields: [dockerAppSources.appId],
|
||||
references: [apps.id],
|
||||
}),
|
||||
board: one(boards, {
|
||||
fields: [dockerAppSources.boardId],
|
||||
references: [boards.id],
|
||||
}),
|
||||
item: one(items, {
|
||||
fields: [dockerAppSources.itemId],
|
||||
references: [items.id],
|
||||
}),
|
||||
integration: one(integrations, {
|
||||
fields: [dockerAppSources.integrationId],
|
||||
references: [integrations.id],
|
||||
}),
|
||||
}));
|
||||
Reference in new issue
Block a user