Deployment
Deployment and Environment Configuration
This section provides practical instructions for deploying the HackRx 6.0 application using Docker and configuring the necessary environment variables.
Deployment with Docker
The most reliable way to run the application is with Docker and Docker Compose, which ensures a consistent and isolated environment.
Prerequisites:
Docker installed and running.
Docker Compose installed.
Step-by-Step Instructions:
Clone the Repository:
Bash
https://github.com/neutron420/Hack6.0 // steps git clone https://github.com/neutron420/HackRx.6.0.git cd HackRx.6.0Add Documents: Place the PDF or DOCX files you want to query into the
app/data/directory.Configure Environment: Create a
.envfile in the root of the project by copying the development template:Bash
cp .env.dev .envEnsure the variables inside the
.envfile, especially yourGOOGLE_API_KEY, are correct.Build and Run Containers: Execute the following command from the root of the project:
Bash
// to build the container docker-compose up --build // to run the container docker-compose up //to stop the container docker-compose downThis command will first build the Docker image for the FastAPI application based on the
Dockerfile.It will then start two services as defined in
docker-compose.yml:api: The FastAPI application, which will be accessible onhttp://localhost:8000.db: A PostgreSQL 13 database instance.
The
--buildflag ensures that any changes to the code or dependencies are included in a fresh image.


Access the Application:
API:
http://localhost:8000Interactive Docs (Swagger UI):
http://localhost:8000/docs
Environment Variables
The application's configuration is managed through environment variables, which are defined in the .env file and loaded by app/config.py.
API_TOKEN
"1a5b...52ea"
The secret Bearer token required for authenticating with the API endpoints.
GOOGLE_API_KEY
"AIza...4BaI"
Your API key for Google Generative AI, used by the QAService to generate answers.
POSTGRES_DB
"hackrx_db"
The name of the database to be used in the PostgreSQL container.
POSTGRES_USER
"hackrx_user"
The username for the PostgreSQL database.
POSTGRES_PASSWORD
"hackrx_password"
The password for the PostgreSQL database.
DATABASE_URL
"postgresql://.../hackrx_db"
The full connection string used by SQLAlchemy to connect to the database. In the Docker setup, it points to the db service.
FAISS_INDEX_PATH
"./data/faiss_index"
The file path where the FAISS index and its associated text data will be saved.
EMBEDDING_MODEL
"all-MiniLM-L6-v2"
The name of the Sentence Transformer model to be used for generating embeddings.
DEBUG
"True"
If set to True, FastAPI will run in debug mode, providing more detailed error messages and auto-reloading on code changes.
Export to Sheets
Production vs. Development Notes
Security: For a production deployment, you must replace the default
API_TOKENand database credentials with strong, randomly generated secrets.Database: While the
docker-composesetup is excellent for development, a production environment should use a managed database service (like Amazon RDS, Google Cloud SQL, or NeonDB) for better reliability and scalability.Debugging: The
DEBUGflag should always be set toFalsein a production environment to avoid exposing sensitive information in error messages.
Last updated