Skip to content

The .env file for docker

AdaptAware edited this page Dec 8, 2024 · 2 revisions

Overview

The .env file is crucial for configuring environment-specific variables for the RAGIT application when running inside DOCKER.

This file allows you to manage various settings such as API keys, database credentials, and application ports in a centralized manner. This guide explains the purpose of each variable in the .env file and how to set them up correctly.

Example .env File

Below is an example of a .env file:

OPENAI_API_KEY=<valid-openai-key>
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=mypassword
POSTGRES_PORT=5432
POSTGRES_HOST=db_host
EXTERNAL_FRONT_END_PORT=13133
INTERNAL_FRONT_END_PORT=8789
VECTOR_DB_PROVIDER=<CHROMA or MILVUS>
SHARED_DIR=<path-to-shared-directory>
RAG_COLLECTION=<your-rag-collection-name>

The Configuration Parameters are the following:

OPENAI_API_KEY

  • Description: The API key for accessing OpenAI's services.
  • Format: String
  • Example: OPENAI_API_KEY=sk-xxxxxx

POSTGRES_DB

  • Description: The name of the PostgreSQL database.
  • Format: String
  • Example: POSTGRES_DB=postgres

POSTGRES_USER

  • Description: The username for accessing the PostgreSQL database.
  • Format: String
  • Example: POSTGRES_USER=postgres

POSTGRES_PASSWORD

  • Description: The password for accessing the PostgreSQL database.
  • Format: String
  • Example: POSTGRES_PASSWORD=mypassword

POSTGRES_PORT

  • Description: The port number on which the PostgreSQL database is running.
  • Format: Integer
  • Example: POSTGRES_PORT=5432

POSTGRES_HOST

  • Description: The hostname or IP address where the PostgreSQL database is hosted.
  • Format: String
  • Example: POSTGRES_HOST=db_host

EXTERNAL_FRONT_END_PORT

  • Description: The external port number for accessing the RAGIT web application.
  • Format: Integer
  • Example: EXTERNAL_FRONT_END_PORT=13133

INTERNAL_FRONT_END_PORT

  • Description: The internal port number the frontend service listens on.
  • Format: Integer
  • Example: INTERNAL_FRONT_END_PORT=8789

VECTOR_DB_PROVIDER

  • Description: Specifies the vector database provider to be used.
  • Options: CHROMA or MILVUS
  • Example: VECTOR_DB_PROVIDER=CHROMA

SHARED_DIR

  • Description: The path to the shared directory that holds the data collection.
  • Format: Full path (String)
  • Example: SHARED_DIR=/home/user/ragit-data
  • Note: This path should be accessible by both the host and guest machine/containers.

RAG_COLLECTION

  • Description: The name of the RAG collection to be used.
  • Format: String
  • Example: RAG_COLLECTION=stories
  • Note: This should correspond to the sub-directory under SHARED_DIR where the collection data is stored.

Setting Up the .env File

  1. Create the .env File: In the root directory of the RAGIT repository, create a file named .env.

    touch .env
  2. Add Configuration Parameters: Open the .env file in your preferred text editor and add the configuration parameters as shown in the example above. Replace placeholder values (like <valid-openai-key>, <path-to-shared-directory>, and <your-rag-collection-name>) with actual values appropriate for your environment.

Example:

OPENAI_API_KEY=sk-abcdefghijklmnopqrstuvwxy1234567890
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=secretpassword
POSTGRES_PORT=5432
POSTGRES_HOST=db_host
EXTERNAL_FRONT_END_PORT=13133
INTERNAL_FRONT_END_PORT=8789
VECTOR_DB_PROVIDER=CHROMA
SHARED_DIR=/home/user/ragit-data
RAG_COLLECTION=stories
  1. Save and Close: Save the changes and close the text editor.

Summary

The .env file plays a vital role in configuring the RAGIT application by centralizing critical environment variables. By properly setting up this file, you ensure that all components of the RAGIT application can easily access the necessary configuration settings, leading to a smoother and more efficient deployment process.

Clone this wiki locally