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.0
Add Documents: Place the PDF or DOCX files you want to query into the
app/data/
directory.Configure Environment: Create a
.env
file in the root of the project by copying the development template:Bash
cp .env.dev .env
Ensure the variables inside the
.env
file, 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 down
This 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
--build
flag ensures that any changes to the code or dependencies are included in a fresh image.


Access the Application:
API:
http://localhost:8000
Interactive 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_TOKEN
and database credentials with strong, randomly generated secrets.Database: While the
docker-compose
setup 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
DEBUG
flag should always be set toFalse
in a production environment to avoid exposing sensitive information in error messages.
Last updated