mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-12 18:32:44 +00:00
fix: fix dns lookup for dnsrr
This commit is contained in:
@@ -24,7 +24,7 @@ services:
|
|||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 5
|
retries: 5
|
||||||
links:
|
depends_on:
|
||||||
- mongodb
|
- mongodb
|
||||||
- redis
|
- redis
|
||||||
- streamer
|
- streamer
|
||||||
@@ -34,9 +34,9 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
image: tdurieux/anonymous_github:v2
|
image: tdurieux/anonymous_github:v2
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
qmode: replicated
|
||||||
replicas: 4
|
replicas: 4
|
||||||
endpoint_mode: vip
|
endpoint_mode: dnsrr
|
||||||
entrypoint: ["node", "./build/streamer/index.js"]
|
entrypoint: ["node", "./build/streamer/index.js"]
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
|
|||||||
1
package-lock.json
generated
1
package-lock.json
generated
@@ -25,6 +25,7 @@
|
|||||||
"@smithy/node-http-handler": "^2.5.0",
|
"@smithy/node-http-handler": "^2.5.0",
|
||||||
"archiver": "^5.3.2",
|
"archiver": "^5.3.2",
|
||||||
"bullmq": "^2.4.0",
|
"bullmq": "^2.4.0",
|
||||||
|
"cacheable-lookup": "^5.0.3",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"connect-redis": "^7.0.1",
|
"connect-redis": "^7.0.1",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
"@smithy/node-http-handler": "^2.5.0",
|
"@smithy/node-http-handler": "^2.5.0",
|
||||||
"archiver": "^5.3.2",
|
"archiver": "^5.3.2",
|
||||||
"bullmq": "^2.4.0",
|
"bullmq": "^2.4.0",
|
||||||
|
"cacheable-lookup": "^5.0.3",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"connect-redis": "^7.0.1",
|
"connect-redis": "^7.0.1",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Response } from "express";
|
|||||||
import { Readable } from "stream";
|
import { Readable } from "stream";
|
||||||
import { trace } from "@opentelemetry/api";
|
import { trace } from "@opentelemetry/api";
|
||||||
import { lookup } from "mime-types";
|
import { lookup } from "mime-types";
|
||||||
|
import CacheableLookup from "cacheable-lookup";
|
||||||
|
|
||||||
import Repository from "./Repository";
|
import Repository from "./Repository";
|
||||||
import { RepositoryStatus, Tree, TreeElement, TreeFile } from "./types";
|
import { RepositoryStatus, Tree, TreeElement, TreeFile } from "./types";
|
||||||
@@ -227,9 +228,16 @@ export default class AnonymizedFile {
|
|||||||
span.end();
|
span.end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cacheableLookup = new CacheableLookup();
|
||||||
|
const ipHost = await cacheableLookup.lookupAsync("streamer");
|
||||||
|
|
||||||
// use the streamer service
|
// use the streamer service
|
||||||
return got.stream(join(config.STREAMER_ENTRYPOINT, "api"), {
|
return got.stream(join(config.STREAMER_ENTRYPOINT, "api"), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
lookup: cacheableLookup.lookup,
|
||||||
|
host: ipHost.address,
|
||||||
|
dnsCache: cacheableLookup,
|
||||||
json: {
|
json: {
|
||||||
token: await this.repository.getToken(),
|
token: await this.repository.getToken(),
|
||||||
repoFullName: this.repository.model.source.repositoryName,
|
repoFullName: this.repository.model.source.repositoryName,
|
||||||
@@ -274,9 +282,14 @@ export default class AnonymizedFile {
|
|||||||
this.sha(),
|
this.sha(),
|
||||||
this.repository.getToken(),
|
this.repository.getToken(),
|
||||||
]);
|
]);
|
||||||
|
const cacheableLookup = new CacheableLookup();
|
||||||
|
const ipHost = await cacheableLookup.lookupAsync("streamer");
|
||||||
got
|
got
|
||||||
.stream(join(config.STREAMER_ENTRYPOINT, "api"), {
|
.stream(join(config.STREAMER_ENTRYPOINT, "api"), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
lookup: cacheableLookup.lookup,
|
||||||
|
host: ipHost.address,
|
||||||
|
dnsCache: cacheableLookup,
|
||||||
json: {
|
json: {
|
||||||
sha,
|
sha,
|
||||||
token,
|
token,
|
||||||
|
|||||||
Reference in New Issue
Block a user