Remove obsolete scripts and configuration files for self-hosting and database migrations

- Deleted `pnpm-workspace.yaml` as it is no longer needed.
- Removed `apply-migrations.sh` script that handled database migrations.
- Eliminated `generate-full-stack-env.mjs` script for environment variable generation.
- Deleted `selfhost-backup.sh` script for creating backups of the self-hosted environment.
- Removed `selfhost-doctor.sh` script for health checks of the self-hosted services.
- Deleted `selfhost-restore.sh` script for restoring backups in the self-hosted environment.
This commit is contained in:
Poyraz
2026-06-16 09:57:32 +03:00
parent da8c55d1ad
commit 72a0b38f3e
48 changed files with 2463 additions and 13020 deletions
+29 -6
View File
@@ -5,6 +5,22 @@ type FirstAdminSetupState = {
errorMessage?: string;
};
type FirstAdminSetupOptions = {
timeoutMs?: number;
};
const DEFAULT_SETUP_TIMEOUT_MS = 5_000;
function createTimeoutSignal(timeoutMs: number) {
if (typeof AbortSignal !== "undefined" && "timeout" in AbortSignal) {
return AbortSignal.timeout(timeoutMs);
}
const controller = new AbortController();
setTimeout(() => controller.abort(), timeoutMs).unref?.();
return controller.signal;
}
function isMissingSetupFunctionError(error: {
code?: string;
message?: string;
@@ -15,9 +31,10 @@ function isMissingSetupFunctionError(error: {
);
}
async function getSetupStateFromProfiles(): Promise<FirstAdminSetupState | null> {
const supabaseUrl =
process.env.SUPABASE_INTERNAL_URL || process.env.NEXT_PUBLIC_SUPABASE_URL;
async function getSetupStateFromProfiles(
timeoutMs: number,
): Promise<FirstAdminSetupState | null> {
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
if (!supabaseUrl || !serviceRoleKey) {
@@ -31,6 +48,7 @@ async function getSetupStateFromProfiles(): Promise<FirstAdminSetupState | null>
try {
const response = await fetch(endpoint, {
cache: "no-store",
signal: createTimeoutSignal(timeoutMs),
headers: {
apikey: serviceRoleKey,
authorization: `Bearer ${serviceRoleKey}`,
@@ -53,9 +71,14 @@ async function getSetupStateFromProfiles(): Promise<FirstAdminSetupState | null>
}
}
export async function getFirstAdminSetupState(): Promise<FirstAdminSetupState> {
export async function getFirstAdminSetupState(
options: FirstAdminSetupOptions = {},
): Promise<FirstAdminSetupState> {
const timeoutMs = options.timeoutMs ?? DEFAULT_SETUP_TIMEOUT_MS;
const supabase = await createClient();
const { data, error } = await supabase.rpc("is_first_admin_setup_available");
const { data, error } = await supabase
.rpc("is_first_admin_setup_available")
.abortSignal(createTimeoutSignal(timeoutMs));
if (error) {
console.error("First admin setup check failed", {
@@ -65,7 +88,7 @@ export async function getFirstAdminSetupState(): Promise<FirstAdminSetupState> {
hint: error.hint,
});
const fallbackState = await getSetupStateFromProfiles();
const fallbackState = await getSetupStateFromProfiles(timeoutMs);
if (fallbackState) {
if (isMissingSetupFunctionError(error)) {
+1 -2
View File
@@ -1,8 +1,7 @@
import { createClient } from "@supabase/supabase-js";
export function createServiceRoleClient() {
const supabaseUrl =
process.env.SUPABASE_INTERNAL_URL || process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
if (!supabaseUrl || !serviceRoleKey) {
+15 -6
View File
@@ -2,14 +2,23 @@ import { createServerClient } from '@supabase/ssr'
import { NextResponse, type NextRequest } from 'next/server'
export async function updateSession(request: NextRequest) {
const pathname = request.nextUrl.pathname
if (
pathname.startsWith('/login') ||
pathname.startsWith('/register') ||
pathname.startsWith('/auth') ||
pathname.startsWith('/forgot-password')
) {
return NextResponse.next({ request })
}
let supabaseResponse = NextResponse.next({
request,
})
const supabaseUrl =
process.env.SUPABASE_INTERNAL_URL || process.env.NEXT_PUBLIC_SUPABASE_URL!
const supabase = createServerClient(
supabaseUrl,
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {
@@ -39,9 +48,9 @@ export async function updateSession(request: NextRequest) {
if (
!user &&
!request.nextUrl.pathname.startsWith('/login') &&
!request.nextUrl.pathname.startsWith('/register') &&
!request.nextUrl.pathname.startsWith('/auth')
!pathname.startsWith('/login') &&
!pathname.startsWith('/register') &&
!pathname.startsWith('/auth')
) {
// no user, potentially respond by redirecting the user to the login page
const url = request.nextUrl.clone()
+1 -3
View File
@@ -3,11 +3,9 @@ import { cookies } from 'next/headers'
export async function createClient() {
const cookieStore = await cookies()
const supabaseUrl =
process.env.SUPABASE_INTERNAL_URL || process.env.NEXT_PUBLIC_SUPABASE_URL!
return createServerClient(
supabaseUrl,
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {