This guide provides step-by-step instructions for setting up PrivacyChatBoX using the automated setup script.
Before running the setup script, make sure you have the following prerequisites installed:
- Python 3.10 or higher: Required to run the application
- PostgreSQL (optional but recommended): Required for the database
- git: Required to clone the repository
PrivacyChatBoX provides an automated setup script that handles the following:
- Creating a Python virtual environment
- Installing required dependencies
- Setting up the PostgreSQL database
- Creating necessary directories
- Running database migrations
- Configuring environment variables
git clone https://github.com/yourusername/PrivacyChatBoX.git
cd PrivacyChatBoX./setup.shThe script will guide you through the setup process with interactive prompts.
After the setup is complete, you can start the application with:
# Activate the virtual environment (if not already activated)
source venv/bin/activate
# Start the application
streamlit run app.pyThe application will be available at http://localhost:5000
Log in with the bootstrap admin account:
- Username: admin (or
DEFAULT_ADMIN_USERNAME) - Password: a random temporary password printed in the server log on first start (
docker-compose logs appfor Docker), orDEFAULT_ADMIN_PASSWORDif you set a strong one. You must change it at first login.
If you prefer to set up the application manually or if the automated script doesn't work for your environment, follow these steps:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install .Create a PostgreSQL database:
createdb privacychatboxSet the DATABASE_URL environment variable:
export DATABASE_URL="postgresql://username:password@localhost:5432/privacychatbox"Or create a .env file with this content:
DATABASE_URL=postgresql://username:password@localhost:5432/privacychatbox
Create the following directories if they don't exist:
.streamlit: For Streamlit configurationmodels: For local LLM modelsassets: For static assets
Create a .streamlit/config.toml file with:
[server]
headless = true
address = "0.0.0.0"
port = 5000Run the database migrations:
python database_check.py
python migration_add_dlp_columns.py
python migration_add_local_llm_columns.pystreamlit run app.pyLog in with the bootstrap admin account:
- Username: admin (or
DEFAULT_ADMIN_USERNAME) - Password: a random temporary password printed in the server log on first start (
docker-compose logs appfor Docker), orDEFAULT_ADMIN_PASSWORDif you set a strong one. You must change it at first login.
PrivacyChatBoX uses environment variables for configuration. You can set these in a .env file or directly in your environment.
DATABASE_URL: PostgreSQL connection string (required)
OPENAI_API_KEY: OpenAI API keyANTHROPIC_API_KEY: Anthropic Claude API keyGOOGLE_API_KEY: Google Gemini API keySERPAPI_KEY: SerpAPI key for web search
AZURE_CLIENT_ID: Azure AD application client IDAZURE_CLIENT_SECRET: Azure AD application client secretAZURE_TENANT_ID: Azure AD tenant IDAZURE_REDIRECT_URI: Redirect URI after authentication
MS_CLIENT_ID: Microsoft application client IDMS_CLIENT_SECRET: Microsoft application client secretMS_TENANT_ID: Microsoft tenant ID
If you're having trouble connecting to the database:
- Verify that PostgreSQL is running
- Check that the DATABASE_URL is correct
- Ensure the database exists and is accessible
If you encounter errors about missing dependencies:
- Make sure you've activated the virtual environment
- Try reinstalling the dependencies:
pip install --upgrade .
If you encounter database schema errors:
-
Run the migration scripts:
python migration_add_dlp_columns.py python migration_add_local_llm_columns.py
-
Or run the database check script:
python database_check.py
If you're unable to log in with the default admin credentials:
- Check the application logs to see if the admin user was created
- You may need to manually create the admin user:
from auth import create_user create_user("admin", "admin", "admin")
PrivacyChatBoX can be easily deployed using Docker and Docker Compose, which simplifies setup and ensures consistent environments.
- Docker Engine (version 20.10.0 or higher)
- Docker Compose (version 2.0.0 or higher)
- Git (optional, for cloning the repository)
git clone https://github.com/yourusername/PrivacyChatBoX.git
cd PrivacyChatBoXYou can set up environment variables by:
- Creating a
.envfile in the project root with your API keys and settings, or - Editing the
docker-compose.ymlfile directly to add your environment variables
# For production
docker-compose up -d
# For development (includes Adminer database management tool)
docker-compose -f docker-compose.yml -f docker-compose.override.yml upThe application will be available at http://localhost:5000. If you're using the development configuration, the Adminer database management tool will be available at http://localhost:8080.
Log in with the bootstrap admin account:
- Username: admin (or
DEFAULT_ADMIN_USERNAME) - Password: a random temporary password printed in the server log on first start (
docker-compose logs appfor Docker), orDEFAULT_ADMIN_PASSWORDif you set a strong one. You must change it at first login.
docker-compose downThe Docker setup includes:
Dockerfile: Defines the application containerdocker-compose.yml: Defines the production stack with PostgreSQLdocker-compose.override.yml: Development overridesdocker-entrypoint.sh: Handles database migrations during startup
Two persistent volumes are configured:
postgres_data: Stores the database datamodels_data: Stores downloaded local LLM models
For more detailed information on Docker deployment, see the Docker Guide.
For more detailed information, check out these additional documentation files:
- Database Documentation: Details about the database schema and operations
- Local LLM Integration: Information about using local language models
- Troubleshooting Guide: Solutions for common issues
- Conversation Data Formatting: How conversation data is formatted and handled
- Docker Guide: Detailed guide on Docker deployment and configuration