From bfafe43752979aa004ac704745ac64b80548de7f Mon Sep 17 00:00:00 2001 From: Poyraz Avsever Date: Sat, 13 Jun 2026 22:01:51 +0300 Subject: [PATCH] refactor: update health check URL in Dockerfile and enhance database initialization script with new role grants and type creation --- Dockerfile | 2 +- deploy/supabase/db/init.sh | 31 +++++++++---------------------- proxy.ts | 2 +- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 51b243e..73b836e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,7 +56,7 @@ ENV HOSTNAME="0.0.0.0" # Health check for Dokploy / Coolify / Docker orchestrators HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ - CMD wget -qO- http://localhost:3000/api/health || exit 1 + CMD wget -qO- http://127.0.0.1:3000/api/health || exit 1 # Runtime env vars (Supabase keys, AI keys etc.) are injected by # Dokploy / Coolify as environment variables — no .env file needed. diff --git a/deploy/supabase/db/init.sh b/deploy/supabase/db/init.sh index 08aa0a3..c772095 100644 --- a/deploy/supabase/db/init.sh +++ b/deploy/supabase/db/init.sh @@ -16,6 +16,8 @@ grant all privileges on database postgres to supabase_storage_admin; create schema if not exists auth authorization supabase_auth_admin; create schema if not exists storage authorization supabase_storage_admin; +grant usage, create on schema public to supabase_auth_admin; +grant usage, create on schema public to supabase_storage_admin; grant usage on schema public to anon, authenticated, service_role; grant usage on schema auth to supabase_auth_admin; grant usage on schema storage to anon, authenticated, service_role, supabase_storage_admin; @@ -24,29 +26,14 @@ create extension if not exists "uuid-ossp"; create extension if not exists pgcrypto; create extension if not exists vector; -create or replace function auth.uid() -returns uuid -language sql -stable -as \$\$ - select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid; -\$\$; - -create or replace function auth.role() -returns text -language sql -stable -as \$\$ - select nullif(current_setting('request.jwt.claim.role', true), '')::text; -\$\$; - -create or replace function auth.email() -returns text -language sql -stable -as \$\$ - select nullif(current_setting('request.jwt.claim.email', true), '')::text; +do \$\$ +begin + create type auth.factor_type as enum ('totp', 'webauthn'); +exception + when duplicate_object then null; +end \$\$; +alter type auth.factor_type owner to supabase_auth_admin; alter default privileges in schema public grant select, insert, update, delete on tables to anon, authenticated, service_role; alter default privileges in schema public grant usage, select on sequences to anon, authenticated, service_role; diff --git a/proxy.ts b/proxy.ts index e8269bf..49e966f 100644 --- a/proxy.ts +++ b/proxy.ts @@ -8,6 +8,6 @@ export async function proxy(request: NextRequest) { export const config = { matcher: [ - '/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)', + '/((?!api/health|_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)', ], }