Skip to content

Commit

Permalink
chore: optimize NODE_OPTIONS, KEEP_ALIVE_TIMEOUT env var delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
nepalevov committed Jan 21, 2025
1 parent a6ef2ea commit 9f22c76
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.env
.env.local
node_modules
test-results
e2e
helm
.next
.env
.env.local
.git
docs
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ COPY --from=run_dependencies /app/startup.sh ./startup.sh

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_OPTIONS="${NODE_OPTIONS} --max-http-header-size=32768"
ENV KEEP_ALIVE_TIMEOUT=61000

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
Expand All @@ -39,4 +41,4 @@ USER nextjs
EXPOSE 3000 9464

# Start the application
CMD ["/app/startup.sh"]
CMD ["npm", "start", "--", "--keepAliveTimeout", "$KEEP_ALIVE_TIMEOUT"]
35 changes: 17 additions & 18 deletions apps/chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ Once you have Node.js and npm installed, follow these steps to set up your devel

1. Clone the AI DIAL Chat repository:

```
git clone https://github.com/epam/ai-dial-chat.git
```
```bash
git clone https://github.com/epam/ai-dial-chat.git
```

2. Install project dependencies:
1. Install project dependencies:

```bash
npm install
```
```bash
npm install
```

3. Create `.env.local` file in the `\apps\chat` project directory and add the required variables with appropriate values. These three are the only required environment variables. Refer to [Environment Variables](#environment-variables) to learn more.
1. Create `.env.local` file in the `\apps\chat` project directory and add the required variables with appropriate values. These three are the only required environment variables. Refer to [Environment Variables](#environment-variables) to learn more.

```
DIAL_API_HOST="ADD_VALUE_HERE"
DIAL_API_KEY="ADD_VALUE_HERE"
NEXTAUTH_SECRET="ADD_VALUE_HERE"
```
```bash
DIAL_API_HOST="ADD_VALUE_HERE"
DIAL_API_KEY="ADD_VALUE_HERE"
NEXTAUTH_SECRET="ADD_VALUE_HERE"
```

4. To start the development server, run:
1. To start the development server, run:

```bash
npm run nx serve chat
```
```bash
npm run nx serve chat
```

Once the server is up and running, open `http://localhost:3000` in your browser to view the AI DIAL Chat application.

Expand Down Expand Up @@ -132,7 +132,6 @@ AI DIAL Chat uses environment variables for configuration. All environment varia
| `SHOW_TOKEN_SUB` | No | Show token sub in refresh login error logs | `true`, `false` | `false` |
| `STORAGE_TYPE` | No | Type of storage used for getting and saving information generated by a user.<br />**Note**: currently, `api` is the only supported value. | `browserStorage`, `api` | `api` |
| `KEEP_ALIVE_TIMEOUT` | No | Determines the maximum time in milliseconds for an idle connection before it is closed by the server.<br />This is needed because infrastructures usually have a default keep alive timeout 60 seconds and the Next server should have a larger value.<br />**Note**: this variable is used only when running a `dockerfile`. | Any number string | `61000` |
| `MAX_HTTP_HEADERS_SIZE` | No | Defines the maximum size of headers for Next.js server. <br />**Note**: this variable is used only when running a `dockerfile`. | `32768` |
| `MAX_PROMPT_TOKENS_DEFAULT_PERCENT` | No | A share in percent of `MAX_PROMPT_TOKENS_DEFAULT_VALUE`.<br />If not set, the value of `MAX_PROMPT_TOKENS_DEFAULT_VALUE` applies. | Any string | `75` |
| `MAX_PROMPT_TOKENS_DEFAULT_VALUE` | No | The default maximum limit of tokens permissible for any model.<br />Applies if a limit is not defined in the [AI DIAL Core](https://github.com/epam/ai-dial-core?tab=readme-ov-file#dynamic-settings) configuration. | Any string | `2000` |
| `CUSTOM_VISUALIZERS` | No | A list of configurations of custom visualizers.<br />Refer to [Chat Visualizer](../../libs/chat-visualizer-connector/README.md) to learn more. | [{ title, description, icon, contentType, url }] | |
Expand Down
8 changes: 0 additions & 8 deletions startup.sh

This file was deleted.

0 comments on commit 9f22c76

Please sign in to comment.