fix(runtime): bundle all deps to avoid bun CJS loader crash
This commit is contained in:
@@ -63,8 +63,6 @@ services:
|
|||||||
ROOT_ADMIN_EMAIL: ${ROOT_ADMIN_EMAIL}
|
ROOT_ADMIN_EMAIL: ${ROOT_ADMIN_EMAIL}
|
||||||
PUBLIC_SENTRY_DSN: ${PUBLIC_SENTRY_DSN}
|
PUBLIC_SENTRY_DSN: ${PUBLIC_SENTRY_DSN}
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
volumes:
|
|
||||||
- staging-app-logs:/var/log/app
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env.staging
|
- .env.staging
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -82,4 +80,3 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata-staging:
|
pgdata-staging:
|
||||||
staging-app-logs:
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ services:
|
|||||||
OSU_IRC_PASSWORD: ${OSU_IRC_PASSWORD}
|
OSU_IRC_PASSWORD: ${OSU_IRC_PASSWORD}
|
||||||
PUBLIC_SENTRY_DSN: ${PUBLIC_SENTRY_DSN}
|
PUBLIC_SENTRY_DSN: ${PUBLIC_SENTRY_DSN}
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
volumes:
|
|
||||||
- app-logs:/var/log/app
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -90,4 +88,3 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
umamidata:
|
umamidata:
|
||||||
app-logs:
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
"globals": "^17.3.0",
|
"globals": "^17.3.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.3.3",
|
"lint-staged": "^16.3.3",
|
||||||
|
"pino": "^10.3.1",
|
||||||
"pino-pretty": "^13.1.3",
|
"pino-pretty": "^13.1.3",
|
||||||
"playwright": "^1.58.1",
|
"playwright": "^1.58.1",
|
||||||
"postgres": "^3.4.8",
|
"postgres": "^3.4.8",
|
||||||
@@ -73,7 +74,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bancho.js": "^0.12.3",
|
"bancho.js": "^0.12.3",
|
||||||
"discord.js": "^14.25.1",
|
"discord.js": "^14.25.1"
|
||||||
"pino": "^10.3.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,16 @@ import type { Handle, HandleServerError } from '@sveltejs/kit';
|
|||||||
import { sequence } from '@sveltejs/kit/hooks';
|
import { sequence } from '@sveltejs/kit/hooks';
|
||||||
import { building } from '$app/environment';
|
import { building } from '$app/environment';
|
||||||
import * as Sentry from '@sentry/sveltekit';
|
import * as Sentry from '@sentry/sveltekit';
|
||||||
|
|
||||||
|
if (!building) {
|
||||||
|
Sentry.init({
|
||||||
|
dsn: process.env.PUBLIC_SENTRY_DSN,
|
||||||
|
tracesSampleRate: 0.2,
|
||||||
|
environment: process.env.NODE_ENV ?? 'development',
|
||||||
|
sendDefaultPii: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
import { auth } from '$lib/server/auth';
|
import { auth } from '$lib/server/auth';
|
||||||
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
||||||
import { db } from '$lib/server/db';
|
import { db } from '$lib/server/db';
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import * as Sentry from '@sentry/sveltekit';
|
|
||||||
|
|
||||||
Sentry.init({
|
|
||||||
dsn: process.env.PUBLIC_SENTRY_DSN,
|
|
||||||
tracesSampleRate: 0.2,
|
|
||||||
environment: process.env.NODE_ENV ?? 'development',
|
|
||||||
sendDefaultPii: true
|
|
||||||
});
|
|
||||||
@@ -4,32 +4,14 @@ import { building } from '$app/environment';
|
|||||||
|
|
||||||
const isProduction = !building && process.env.NODE_ENV === 'production';
|
const isProduction = !building && process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
const transport = building
|
// Production: JSON to stdout (Docker captures logs via log driver)
|
||||||
? undefined
|
// Dev: pipe through pino-pretty (`bun run dev | bunx pino-pretty`)
|
||||||
: isProduction
|
export const logger = pino({
|
||||||
? pino.transport({
|
level: isProduction ? 'info' : 'debug',
|
||||||
targets: [
|
base: { service: 'vash-esports' },
|
||||||
{ target: 'pino/file', options: { destination: 1 } },
|
serializers: pino.stdSerializers,
|
||||||
{
|
redact: ['req.headers.authorization', 'req.headers.cookie']
|
||||||
target: 'pino/file',
|
});
|
||||||
options: { destination: '/var/log/app/app.log', mkdir: true }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
: pino.transport({
|
|
||||||
target: 'pino-pretty',
|
|
||||||
options: { colorize: true, translateTime: 'HH:MM:ss' }
|
|
||||||
});
|
|
||||||
|
|
||||||
export const logger = pino(
|
|
||||||
{
|
|
||||||
level: isProduction ? 'info' : 'debug',
|
|
||||||
base: { service: 'vash-esports' },
|
|
||||||
serializers: pino.stdSerializers,
|
|
||||||
redact: ['req.headers.authorization', 'req.headers.cookie']
|
|
||||||
},
|
|
||||||
transport
|
|
||||||
);
|
|
||||||
|
|
||||||
// Child loggers per subsystem — maps to existing [Tag] prefixes
|
// Child loggers per subsystem — maps to existing [Tag] prefixes
|
||||||
export const log = {
|
export const log = {
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ import adapter from '@sveltejs/adapter-node';
|
|||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter(),
|
adapter: adapter()
|
||||||
experimental: {
|
|
||||||
instrumentation: {
|
|
||||||
server: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ export default defineConfig({
|
|||||||
devtoolsJson()
|
devtoolsJson()
|
||||||
],
|
],
|
||||||
ssr: {
|
ssr: {
|
||||||
external: ['bun', 'pino', 'pino-pretty']
|
external: ['bun']
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ['bun', 'pino', 'pino-pretty']
|
external: ['bun']
|
||||||
},
|
},
|
||||||
reportCompressedSize: false
|
reportCompressedSize: false
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user