feat: add code queue services and baidu netdisk
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
FROM oven/bun:1-alpine
|
||||
|
||||
WORKDIR /app/src/components/microservices/baidu-netdisk
|
||||
COPY src/components/microservices/baidu-netdisk/package.json ./package.json
|
||||
RUN bun install --production
|
||||
COPY src/components/microservices/baidu-netdisk/tsconfig.json ./tsconfig.json
|
||||
COPY src/components/shared /app/src/components/shared
|
||||
COPY src/components/microservices/baidu-netdisk/src ./src
|
||||
|
||||
EXPOSE 4244
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 1,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "@unidesk/baidu-netdisk",
|
||||
"dependencies": {
|
||||
"postgres": "latest",
|
||||
},
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
"postgres": ["postgres@3.4.9", "", {}, "sha512-GD3qdB0x1z9xgFI6cdRD6xu2Sp2WCOEoe3mtnyB5Ee0XrrL5Pe+e4CCnJrRMnL1zYtRDZmQQVbvOttLnKDLnaw=="],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@unidesk/baidu-netdisk",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "bun run src/index.ts",
|
||||
"check": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"postgres": "latest"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -13,5 +13,6 @@
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [{ "path": "../../shared" }]
|
||||
}
|
||||
+9
-6
@@ -15,6 +15,8 @@ RUN apt-get update \
|
||||
gcc \
|
||||
git \
|
||||
gzip \
|
||||
iproute2 \
|
||||
iputils-ping \
|
||||
jq \
|
||||
make \
|
||||
npm \
|
||||
@@ -33,17 +35,18 @@ RUN apt-get update \
|
||||
&& mkdir -p /usr/local/lib/docker/cli-plugins /root/.docker/cli-plugins \
|
||||
&& ln -sf /usr/bin/docker-compose /usr/local/lib/docker/cli-plugins/docker-compose \
|
||||
&& ln -sf /usr/bin/docker-compose /root/.docker/cli-plugins/docker-compose \
|
||||
&& npm install -g @openai/codex@0.128.0 playwright@1.59.1 \
|
||||
&& npm install -g @openai/codex@0.128.0 opencode-ai@1.14.48 playwright@1.59.1 \
|
||||
&& playwright install --with-deps chromium \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY src/components/microservices/codex-queue/package.json ./package.json
|
||||
WORKDIR /app/src/components/microservices/code-queue
|
||||
COPY src/components/microservices/code-queue/package.json ./package.json
|
||||
RUN bun install --production
|
||||
COPY src/components/microservices/codex-queue/tsconfig.json ./tsconfig.json
|
||||
COPY src/components/microservices/codex-queue/src ./src
|
||||
COPY src/components/shared /app/src/components/shared
|
||||
COPY src/components/microservices/code-queue/tsconfig.json ./tsconfig.json
|
||||
COPY src/components/microservices/code-queue/src ./src
|
||||
|
||||
EXPOSE 4222
|
||||
ENTRYPOINT ["tini", "--"]
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
CMD ["bun", "--smol", "run", "src/index.ts"]
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@unidesk/codex-queue",
|
||||
"name": "@unidesk/code-queue",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
+3120
-281
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"types": ["bun", "node"],
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [{ "path": "../../shared" }]
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
FROM oven/bun:1-alpine
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR /app/src/components/microservices/project-manager
|
||||
COPY src/components/microservices/project-manager/package.json ./package.json
|
||||
RUN bun install --production
|
||||
COPY src/components/microservices/project-manager/tsconfig.json ./tsconfig.json
|
||||
COPY src/components/shared /app/src/components/shared
|
||||
COPY src/components/microservices/project-manager/src ./src
|
||||
|
||||
EXPOSE 4233
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { appendFileSync, mkdirSync } from "node:fs";
|
||||
import { dirname } from "node:path";
|
||||
import postgres from "postgres";
|
||||
import * as XLSX from "xlsx";
|
||||
import { createHourlyJsonlWriter, logRetentionBytesForService } from "../../../shared/src/rotating-jsonl";
|
||||
|
||||
type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
|
||||
type JsonRecord = Record<string, JsonValue>;
|
||||
@@ -96,15 +95,22 @@ function configFromEnv(): RuntimeConfig {
|
||||
|
||||
const config = configFromEnv();
|
||||
const sql = postgres(config.databaseUrl, { max: 8, idle_timeout: 20, connect_timeout: 10 });
|
||||
const logWriter = config.logFile
|
||||
? createHourlyJsonlWriter({
|
||||
baseLogFile: config.logFile,
|
||||
service: "project-manager",
|
||||
maxBytes: logRetentionBytesForService("project-manager"),
|
||||
})
|
||||
: null;
|
||||
logWriter?.prune();
|
||||
|
||||
function log(event: string, detail: JsonRecord = {}): void {
|
||||
const record: JsonRecord = { at: new Date().toISOString(), event, ...detail };
|
||||
recentLogs.push(record);
|
||||
if (recentLogs.length > 300) recentLogs.shift();
|
||||
if (config.logFile) {
|
||||
if (logWriter !== null) {
|
||||
try {
|
||||
mkdirSync(dirname(config.logFile), { recursive: true });
|
||||
appendFileSync(config.logFile, `${JSON.stringify(record)}\n`, "utf8");
|
||||
logWriter.appendJson(record, new Date(String(record.at)));
|
||||
} catch {
|
||||
// Logging must not break request handling.
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [{ "path": "../../shared" }]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user