Merge pull request #4636 from Infisical/ENG-3802

feat(gateway-v2, relays): health check or relays & health alerts
This commit is contained in:
Andre
2025-10-10 16:10:35 -04:00
committed by GitHub
17 changed files with 568 additions and 20 deletions
@@ -0,0 +1,19 @@
import { Knex } from "knex";
import { TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
if (!(await knex.schema.hasColumn(TableName.Relay, "heartbeat"))) {
await knex.schema.alterTable(TableName.Relay, (t) => {
t.datetime("heartbeat");
});
}
}
export async function down(knex: Knex): Promise<void> {
if (await knex.schema.hasColumn(TableName.Relay, "heartbeat")) {
await knex.schema.alterTable(TableName.Relay, (t) => {
t.dropColumn("heartbeat");
});
}
}
@@ -0,0 +1,29 @@
import { Knex } from "knex";
import { TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
if (!(await knex.schema.hasColumn(TableName.Relay, "healthAlertedAt"))) {
await knex.schema.alterTable(TableName.Relay, (t) => {
t.datetime("healthAlertedAt");
});
}
if (!(await knex.schema.hasColumn(TableName.GatewayV2, "healthAlertedAt"))) {
await knex.schema.alterTable(TableName.GatewayV2, (t) => {
t.datetime("healthAlertedAt");
});
}
}
export async function down(knex: Knex): Promise<void> {
if (await knex.schema.hasColumn(TableName.GatewayV2, "healthAlertedAt")) {
await knex.schema.alterTable(TableName.GatewayV2, (t) => {
t.dropColumn("healthAlertedAt");
});
}
if (await knex.schema.hasColumn(TableName.Relay, "healthAlertedAt")) {
await knex.schema.alterTable(TableName.Relay, (t) => {
t.dropColumn("healthAlertedAt");
});
}
}
+2 -1
View File
@@ -18,7 +18,8 @@ export const GatewaysV2Schema = z.object({
relayId: z.string().uuid().nullable().optional(),
name: z.string(),
heartbeat: z.date().nullable().optional(),
encryptedPamSessionKey: zodBuffer.nullable().optional()
encryptedPamSessionKey: zodBuffer.nullable().optional(),
healthAlertedAt: z.date().nullable().optional()
});
export type TGatewaysV2 = z.infer<typeof GatewaysV2Schema>;
+3 -1
View File
@@ -14,7 +14,9 @@ export const RelaysSchema = z.object({
orgId: z.string().uuid().nullable().optional(),
identityId: z.string().uuid().nullable().optional(),
name: z.string(),
host: z.string()
host: z.string(),
heartbeat: z.date().nullable().optional(),
healthAlertedAt: z.date().nullable().optional()
});
export type TRelays = z.infer<typeof RelaysSchema>;