diff --git a/frontend/index.html b/frontend/index.html
index 8779caa..0405fad 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -729,6 +729,12 @@
? 'Exists'
: 'Not found'}
+
+ PgBouncer
+ ${infra?.pgbouncer?.configured
+ ? 'Reachable'
+ : 'Not configured'}
+
Storage
${infra?.spaces?.configured
diff --git a/src/lib/k8s.ts b/src/lib/k8s.ts
index 3cc9cd1..2652d5d 100644
--- a/src/lib/k8s.ts
+++ b/src/lib/k8s.ts
@@ -113,6 +113,17 @@ export async function getConfigMap(namespace: string, name: string): Promise {
const sql = postgres(config.doadminDbUrl.replace(/\/([^/?]+)(\?|$)/, `/${slug}$2`), { max: 1, connect_timeout: 5 });
try {
@@ -240,6 +240,16 @@ export async function customerRoutes(app: FastifyInstance) {
await sql.end();
}
})(),
+ // Try connecting via pgbouncer
+ (async () => {
+ const sql = postgres(`postgresql://${slug}@${PGBOUNCER_HOST}:${PGBOUNCER_PORT}/${slug}`, { max: 1, connect_timeout: 5 });
+ try {
+ await sql`SELECT 1`;
+ return true;
+ } finally {
+ await sql.end();
+ }
+ })(),
db`
SELECT recorded_at, db_size_bytes, spaces_size_bytes, spaces_object_count
FROM customer_size_snapshots
@@ -253,11 +263,13 @@ export async function customerRoutes(app: FastifyInstance) {
]);
const dbExists = dbCheck.status === "fulfilled" ? dbCheck.value : false;
+ const pgbouncerReachable = pgbouncerCheck.status === "fulfilled" ? pgbouncerCheck.value : false;
const secretData = secrets.status === "fulfilled" ? secrets.value : null;
const dns = dnsCheck.status === "fulfilled" ? dnsCheck.value : { exists: false, proxied: false, ip: null };
const health = healthCheck.status === "fulfilled" ? healthCheck.value : { reachable: false, status: null };
const infra = {
database: { exists: dbExists },
+ pgbouncer: { configured: pgbouncerReachable },
spaces: {
configured: !!(secretData?.["spaces-prefix"]),
bucket: secretData?.["spaces-bucket"] ?? null,
@@ -311,6 +323,7 @@ export async function customerRoutes(app: FastifyInstance) {
if (!customer) return reply.code(404).send({ message: "Not found" });
const version = await getLatestChartVersion();
await upgradeCustomerChart(slug, version);
+ await syncArgoApp(`customer-${slug}`);
await db`UPDATE customers SET updated_at = NOW() WHERE slug = ${slug}`;
app.log.info({ slug, version }, "customer chart upgraded");
return reply.send({ slug, version });
@@ -322,6 +335,7 @@ export async function customerRoutes(app: FastifyInstance) {
const version = await getLatestChartVersion();
const slugs = customers.map((c: any) => c.slug);
await upgradeAllCustomerCharts(slugs, version);
+ await Promise.all(slugs.map((s: string) => syncArgoApp(`customer-${s}`)));
app.log.info({ slugs, version }, "all customers chart upgraded");
return reply.send({ upgraded: slugs, version });
});