wip: docker

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-01-14 07:39:02 +01:00
parent 1b10371940
commit 719a82f1c4
68 changed files with 3105 additions and 328 deletions

2
packages/queue/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export { eventsQueue } from './src/queues';
export { connection } from './src/connection';

View File

@@ -0,0 +1,30 @@
{
"name": "@mixan/queue",
"version": "0.0.1",
"main": "index.ts",
"scripts": {
"lint": "eslint .",
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"bullmq": "^5.1.1"
},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
"@mixan/types": "workspace:*",
"@types/node": "^18.16.0",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"eslintConfig": {
"root": true,
"extends": [
"@mixan/eslint-config/base"
]
},
"prettier": "@mixan/prettier-config"
}

View File

@@ -0,0 +1,10 @@
const parse = (connectionString: string) => {
const url = new URL(connectionString);
return {
host: url.hostname,
port: Number(url.port),
password: url.password,
} as const;
};
export const connection = parse(String(process.env.REDIS_URL));

View File

@@ -0,0 +1,17 @@
import { Queue } from 'bullmq';
import type { BatchPayload } from '@mixan/types';
import { connection } from './connection';
export interface EventsQueuePayload {
projectId: string;
payload: BatchPayload[];
}
export const eventsQueue = new Queue<EventsQueuePayload>('events', {
connection,
defaultJobOptions: {
removeOnComplete: 10,
},
});

View File

@@ -0,0 +1,12 @@
{
"extends": "@mixan/tsconfig/base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["."],
"exclude": ["node_modules"]
}