attempt fix: trpc routes not found

main
avraham 7 months ago
parent add21288be
commit 2597c0f6ac

@ -6,18 +6,23 @@ RUN corepack enable
COPY package.json pnpm-lock.yaml /app/ COPY package.json pnpm-lock.yaml /app/
WORKDIR /app WORKDIR /app
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
# install dev dependencies which are needed for building, such as typescript:
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY tsconfig.json /app/ COPY tsconfig.json /app/
COPY src /app/src COPY src /app/src
RUN pnpm run build CMD [ "pnpm", "tsx", "src/index.ts" ]
# FROM base AS prod-deps
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
# # install dev dependencies which are needed for building, such as typescript:
# FROM base AS build
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# COPY tsconfig.json /app/
# COPY src /app/src
# RUN pnpm run build
FROM base # FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules # COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist # COPY --from=build /app/dist /app/dist
WORKDIR /app/dist # WORKDIR /app/dist
CMD [ "node", "index.js" ] # CMD [ "node", "index.js" ]

@ -9,11 +9,12 @@
"cli": "tsx src/cli.tsx" "cli": "tsx src/cli.tsx"
}, },
"dependencies": { "dependencies": {
"@clickhouse/client": "^0.2.7", "@clickhouse/client": "^1.4.1",
"@humanwhocodes/env": "^3.0.5", "@humanwhocodes/env": "^3.0.5",
"@sinclair/typebox": "^0.32.5", "@sinclair/typebox": "^0.32.5",
"@trpc/server": "^10.45.0", "@trpc/server": "^10.45.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"date-fns": "^3.6.0",
"execa": "^9.3.0", "execa": "^9.3.0",
"ink": "^4.1.0", "ink": "^4.1.0",
"ink-text-input": "^5.0.1", "ink-text-input": "^5.0.1",

@ -9,8 +9,8 @@ importers:
.: .:
dependencies: dependencies:
'@clickhouse/client': '@clickhouse/client':
specifier: ^0.2.7 specifier: ^1.4.1
version: 0.2.7 version: 1.4.1
'@humanwhocodes/env': '@humanwhocodes/env':
specifier: ^3.0.5 specifier: ^3.0.5
version: 3.0.5 version: 3.0.5
@ -23,6 +23,9 @@ importers:
cors: cors:
specifier: ^2.8.5 specifier: ^2.8.5
version: 2.8.5 version: 2.8.5
date-fns:
specifier: ^3.6.0
version: 3.6.0
execa: execa:
specifier: ^9.3.0 specifier: ^9.3.0
version: 9.3.0 version: 9.3.0
@ -88,11 +91,11 @@ packages:
resolution: {integrity: sha512-3yWxPTq3UQ/FY9p1ErPxIyfT64elWaMvM9lIHnaqpyft63tkxodF5aUElYHrdisWve5cETkh1+KBw1yJuW0aRw==} resolution: {integrity: sha512-3yWxPTq3UQ/FY9p1ErPxIyfT64elWaMvM9lIHnaqpyft63tkxodF5aUElYHrdisWve5cETkh1+KBw1yJuW0aRw==}
engines: {node: '>=14.13.1'} engines: {node: '>=14.13.1'}
'@clickhouse/client-common@0.2.7': '@clickhouse/client-common@1.4.1':
resolution: {integrity: sha512-vgZm+8c5Cu1toIx1/xplF5dEHlCPw+7pJDOOEtLv2CIUVZ0Bl6nGVZ43EWxRdHeah9ivTfoRWhN1zI1PxjH0xQ==} resolution: {integrity: sha512-f5eoTrUSDplrMoi3ddeZ0MzGTn0iGMByEQ8j63eVMoBSOI2+F6jEIPcW2tWofT79Rvnn3RRlveYcShiaIiCJyw==}
'@clickhouse/client@0.2.7': '@clickhouse/client@1.4.1':
resolution: {integrity: sha512-ZiyarrGngHc+f5AjZSA7mkQfvnE/71jgXk304B0ps8V+aBpE2CsFB6AQmE/Mk2YkP5j+8r/JfG+m0AZWmE27ig==} resolution: {integrity: sha512-12iV+MeykxdQySRFHwaVU+hKUv3JP6kdwOI+z3zzyfPVYHynTlV8emJjjGZR0+VfRaj3PCMuQfryfsJ82nh9WQ==}
engines: {node: '>=16'} engines: {node: '>=16'}
'@esbuild/aix-ppc64@0.19.11': '@esbuild/aix-ppc64@0.19.11':
@ -610,6 +613,9 @@ packages:
csstype@3.1.3: csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
date-fns@3.6.0:
resolution: {integrity: sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==}
debug@4.3.5: debug@4.3.5:
resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==} resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==}
engines: {node: '>=6.0'} engines: {node: '>=6.0'}
@ -1626,11 +1632,11 @@ snapshots:
ansi-styles: 6.2.1 ansi-styles: 6.2.1
is-fullwidth-code-point: 4.0.0 is-fullwidth-code-point: 4.0.0
'@clickhouse/client-common@0.2.7': {} '@clickhouse/client-common@1.4.1': {}
'@clickhouse/client@0.2.7': '@clickhouse/client@1.4.1':
dependencies: dependencies:
'@clickhouse/client-common': 0.2.7 '@clickhouse/client-common': 1.4.1
'@esbuild/aix-ppc64@0.19.11': '@esbuild/aix-ppc64@0.19.11':
optional: true optional: true
@ -2021,6 +2027,8 @@ snapshots:
csstype@3.1.3: {} csstype@3.1.3: {}
date-fns@3.6.0: {}
debug@4.3.5: debug@4.3.5:
dependencies: dependencies:
ms: 2.1.2 ms: 2.1.2

@ -9,18 +9,18 @@ const { CLICKHOUSE_USER, CLICKHOUSE_PASS } = env.required;
const CLICKHOUSE_HOST = env.get("CLICKHOUSE_HOST", "http://localhost:8123"); const CLICKHOUSE_HOST = env.get("CLICKHOUSE_HOST", "http://localhost:8123");
export const clickhouse = createClickhouseClient({ export const clickhouse = createClickhouseClient({
host: CLICKHOUSE_HOST, url: CLICKHOUSE_HOST,
username: CLICKHOUSE_USER, username: CLICKHOUSE_USER,
password: CLICKHOUSE_PASS, password: CLICKHOUSE_PASS,
keep_alive: { keep_alive: {
enabled: true, enabled: true,
socket_ttl: 2500, // socket_ttl: 2500,
}, },
}); });
export async function query<T>( export async function query<T>(
queryString: string, queryString: string,
format: DataFormat = "JSONEachRow", format: DataFormat = "JSONEachRow"
): Promise<Array<T>> { ): Promise<Array<T>> {
return await retry( return await retry(
async () => { async () => {
@ -33,6 +33,6 @@ export async function query<T>(
}); });
return await result.json(); return await result.json();
}, },
{ maxRetries: 5 }, { maxRetries: 5 }
); );
} }

Loading…
Cancel
Save