Skip to content

Commit

Permalink
Update and optimize use of ws library in socks (#1409)
Browse files Browse the repository at this point in the history
Co-authored-by: jiajames <james@dydx.exchange>
Co-authored-by: Will Liu <will@dydx.exchange>
  • Loading branch information
3 people authored Jun 14, 2024
1 parent f3b6fd7 commit 5141daf
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 48 deletions.
5 changes: 4 additions & 1 deletion indexer/Dockerfile.auxo.remote
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ WORKDIR /usr/app
# Copy pnpm lock and workspace and package.json from base directory
COPY ./pnpm-lock.yaml ./pnpm-workspace.yaml ./package.json ./

# Copy patches
COPY ./patches ./patches

# Copy auxo and imported packages
COPY ./packages/base/ ./packages/base/
COPY ./packages/v4-protos/ ./packages/v4-protos/
Expand All @@ -19,7 +22,7 @@ COPY tsconfig.json ./
RUN npm install -g pnpm@6

# Install npm modules using pnpm
RUN pnpm install --loglevel warn --frozen-lockfile
RUN pnpm install --loglevel warn --frozen-lockfile --unsafe-perm
RUN pnpm run build:prod:all

FROM public.ecr.aws/lambda/nodejs:16
Expand Down
7 changes: 5 additions & 2 deletions indexer/Dockerfile.bazooka.remote
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ FROM public.ecr.aws/lambda/nodejs:16 as builder
WORKDIR /usr/app

# Copy pnpm lock and workspace and package.json from base directory
COPY ./pnpm-lock.yaml ./pnpm-workspace.yaml ./package.json ./
COPY ./pnpm-lock.yaml ./pnpm-workspace.yaml ./package.json ./patches ./

# Copy patches
COPY ./patches ./patches

# Copy bazooka and imported packages
COPY ./packages/base/ ./packages/base/
Expand All @@ -22,7 +25,7 @@ COPY tsconfig.json ./
RUN npm install -g pnpm@6

# Install npm modules using pnpm
RUN pnpm install --loglevel warn --frozen-lockfile
RUN pnpm install --loglevel warn --frozen-lockfile --unsafe-perm
RUN pnpm run build:prod:all

FROM public.ecr.aws/lambda/nodejs:16
Expand Down
5 changes: 4 additions & 1 deletion indexer/Dockerfile.postgres-package.local
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ WORKDIR /home/dydx/app
# Copy pnpm lock and workspace and package.json from base directory
COPY ./pnpm-lock.yaml ./pnpm-workspace.yaml ./package.json ./

# Copy patches
COPY ./patches ./patches

# Copy package.json from postgres and imported packages being run
COPY ./packages/base/package.json ./packages/base/
COPY ./packages/postgres/package.json ./packages/postgres/
Expand All @@ -37,7 +40,7 @@ RUN chown dydx -R /home/dydx/app
USER dydx

# Install npm modules using pnpm
RUN pnpm i --loglevel warn --production --frozen-lockfile
RUN pnpm i --loglevel warn --production --frozen-lockfile --unsafe-perm

WORKDIR /home/dydx/app/packages/postgres

Expand Down
5 changes: 4 additions & 1 deletion indexer/Dockerfile.service.local
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ WORKDIR /home/dydx/app
# Copy pnpm lock and workspace and package.json from base directory
COPY ./pnpm-lock.yaml ./pnpm-workspace.yaml ./package.json ./

# Copy patches
COPY ./patches ./patches

# Copy package.json from all packages being run
COPY ./packages/base/package.json ./packages/base/
COPY ./packages/kafka/package.json ./packages/kafka/
Expand Down Expand Up @@ -42,7 +45,7 @@ COPY ./scripts/container-run.sh /home/dydx/app/services/$service/scripts/
RUN chown dydx -R /home/dydx/app

USER dydx
RUN pnpm i --loglevel warn --production --frozen-lockfile
RUN pnpm i --loglevel warn --production --frozen-lockfile --unsafe-perm

WORKDIR /home/dydx/app/services/$service

Expand Down
5 changes: 4 additions & 1 deletion indexer/Dockerfile.service.remote
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ WORKDIR /home/dydx/app
# Copy pnpm lock and workspace and package.json from base directory
COPY ./pnpm-lock.yaml ./pnpm-workspace.yaml ./package.json ./

# Copy patches
COPY ./patches ./patches

# Copy package.json from all packages being run
COPY ./packages/base/package.json ./packages/base/
COPY ./packages/kafka/package.json ./packages/kafka/
Expand Down Expand Up @@ -42,7 +45,7 @@ COPY ./scripts/container-run.sh /home/dydx/app/services/$service/scripts/
RUN chown dydx -R /home/dydx/app

# Install npm modules using pnpm
RUN pnpm i --loglevel warn --production --frozen-lockfile
RUN pnpm i --loglevel warn --production --frozen-lockfile --unsafe-perm

USER dydx

Expand Down
11 changes: 9 additions & 2 deletions indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@
"lint:all": "pnpm run --parallel lint",
"lint:fix:all": "pnpm run --parallel lint:fix",
"coverage:all": "pnpm recursive run --workspace-concurrency=1 coverage",
"test:all": "pnpm recursive run --workspace-concurrency=1 test"
"test:all": "pnpm recursive run --workspace-concurrency=1 test",
"postinstall": "patch-package"
},
"author": "",
"license": "AGPL-3.0"
"license": "AGPL-3.0",
"dependencies": {
"@milahu/patch-package": "6.4.14"
},
"devDependencies": {
"@types/ws": "8.5.10"
}
}
22 changes: 22 additions & 0 deletions indexer/patches/@types+ws+8.5.10.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# generated by patch-package 6.4.14
#
# declared package:
# @types/ws: 8.5.10
#
diff --git a/node_modules/@types/ws/index.d.ts b/node_modules/@types/ws/index.d.ts
index 94d1dca..d9abf0b 100644
--- a/node_modules/@types/ws/index.d.ts
+++ b/node_modules/@types/ws/index.d.ts
@@ -318,7 +318,11 @@ declare namespace WebSocket {
host?: string | undefined;
port?: number | undefined;
backlog?: number | undefined;
- server?: HTTPServer<V> | HTTPSServer<V> | undefined;
+ // LOCAL DYDX PATCH
+ allowSynchronousEvents?: boolean;
+ autoPong?: boolean;
+ server?: HTTPServer | HTTPSServer | undefined;
+ // END LOCAL DYDX PATCH
verifyClient?:
| VerifyClientCallbackAsync<InstanceType<V>>
| VerifyClientCallbackSync<InstanceType<V>>
Loading

0 comments on commit 5141daf

Please sign in to comment.