diff --git a/.dockerignore b/.dockerignore index 6a6d251c1..b4c010395 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,9 @@ -.env -.env.local node_modules test-results e2e helm .next +.env +.env.local +.git +docs \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f0e185b02..b723946cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -39,4 +41,4 @@ USER nextjs EXPOSE 3000 9464 # Start the application -CMD ["/app/startup.sh"] +CMD ["npm", "start", "--", "--keepAliveTimeout", "$KEEP_ALIVE_TIMEOUT"] diff --git a/apps/chat/README.md b/apps/chat/README.md index 8fc1b70ba..86af9faf2 100644 --- a/apps/chat/README.md +++ b/apps/chat/README.md @@ -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. @@ -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.
**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.
This is needed because infrastructures usually have a default keep alive timeout 60 seconds and the Next server should have a larger value.
**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.
**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`.
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.
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.
Refer to [Chat Visualizer](../../libs/chat-visualizer-connector/README.md) to learn more. | [{ title, description, icon, contentType, url }] | | diff --git a/startup.sh b/startup.sh deleted file mode 100755 index 6d42b92a6..000000000 --- a/startup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -KEEP_ALIVE_TIMEOUT="${KEEP_ALIVE_TIMEOUT:-61000}" -MAX_HTTP_HEADERS_SIZE="${MAX_HTTP_HEADERS_SIZE:-32768}" - -export NODE_OPTIONS="--max-http-header-size=$MAX_HTTP_HEADERS_SIZE ${NODE_OPTIONS}" - -exec npm start -- --keepAliveTimeout $KEEP_ALIVE_TIMEOUT \ No newline at end of file