Skip to content

Commit

Permalink
chore: fix issues with openai-connector docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Nov 7, 2023
1 parent a89c6cf commit 46e2190
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ services:
build:
dockerfile: docker/Dockerfile.ts-services
context: .
target: install
# target: install
args:
BUILD_TARGET: openai-connector
ports:
Expand All @@ -110,7 +110,7 @@ services:
GRPC_TRACE: channel,subchannel,call_stream
SERVER_PORT: 8000
working_dir: /app/services/openai-connector
command: ['pnpm', 'run', 'dev']
command: ['node', 'run', 'dev']
env_file: '.secrets/.env.openai-connector'
frontend:
build:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.ts-services
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ RUN pnpm install -r --prod

WORKDIR /app/services/${BUILD_TARGET}/dist
USER app
CMD ["index.js"]
CMD ["node", "main.js"]
21 changes: 17 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions services/openai-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@grpc/grpc-js": "^1.9.9",
"@protobuf-ts/runtime": "^2.9.1",
"@protobuf-ts/runtime-rpc": "^2.9.1",
"grpc-health-check": "^2.0.0",
"openai": "^4.16.1",
"pino": "^8.16.1"
}
Expand Down
7 changes: 7 additions & 0 deletions services/openai-connector/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ import {
IOpenAIService,
openAIServiceDefinition,
} from 'gen/openai/v1/openai.grpc-server';
import { HealthImplementation } from 'grpc-health-check';
import { createServer } from 'shared/grpc';
import logger from 'shared/logger';

import { openAIPrompt, openAIStream } from '@/handlers';

const healthImpl = new HealthImplementation({
'': 'SERVING',
});

const port = process.env.SERVER_PORT ?? 50_051;

const implementation = {
Expand All @@ -22,6 +27,8 @@ const server = createServer({
implementation,
});

healthImpl.addToServer(server);

server.bindAsync(
`0.0.0.0:${port}`,
ServerCredentials.createInsecure(),
Expand Down
2 changes: 1 addition & 1 deletion services/openai-connector/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config: Configuration = {
exclude: [
(issue: Issue) => {
return !!issue.file?.includes(
'/app/node_modules/.pnpm/openai',
'/node_modules/.pnpm/openai',
);
},
],
Expand Down

0 comments on commit 46e2190

Please sign in to comment.