This guide covers deploying the Vector Bot application in different environments.
The application supports multiple deployment environments with specific configurations:
- Command-line specified:
--env production - Environment variable:
RAG_ENV=production - Local .env file:
.envin current directory - Default:
configs/development.env
- Local development with verbose logging
- Documents in
./docs - Index storage in
./index_storage - Auto-detection enabled
- Optimized for server deployment
- Documents in
/data/documents - Index storage in
/data/index_storage - Reduced logging, improved performance
- Containerized deployment
- Uses Docker-specific paths and networking
- Ollama at
host.docker.internal:11434
This project includes comprehensive GitHub Actions workflows for automated testing, building, and deployment:
- Multi-platform testing: Ubuntu, Windows, macOS
- Python version matrix: 3.10, 3.11, 3.12
- Automated security scanning: CodeQL, Bandit, Safety
- Code quality checks: ruff, mypy, pytest
- Test coverage: 99% code coverage requirement
- Automated releases: Tag-triggered PyPI publishing
- Multi-platform executables: Built for all major platforms
- GitHub Releases: Automatic asset attachment
To enable the CI/CD pipeline in your GitHub repository:
-
Push the code to GitHub:
git init git add . git commit -m "Initial commit with CI/CD setup" git remote add origin https://github.com/joshuaramirez/vector-bot.git git push -u origin main
-
Configure Repository Secrets:
- Go to Settings → Secrets and variables → Actions
- Add
PYPI_API_TOKENfor PyPI publishing - This token is required for the release workflow
-
Enable GitHub Actions:
- Actions should be enabled by default
- First push will trigger the CI workflow
- Check Actions tab to see workflow runs
-
Configure Branch Protection (Optional):
- Go to Settings → Branches
- Add rule for
mainbranch - Enable "Require status checks to pass"
- Select CI workflow checks
-
Create a Release:
git tag v1.0.1 git push origin v1.0.1
This triggers the release workflow which:
- Publishes to PyPI
- Builds executables for all platforms
- Creates GitHub release with assets
See .github/workflows/ for workflow configurations.
Build a single executable with all dependencies:
# Build executable
make build-exe
# Deploy executable with configs
cp dist/vector-bot /usr/local/bin/
cp -r configs /usr/local/share/vector-bot/Usage:
# Use specific environment
vector-bot --env production doctor
vector-bot --env production ingest
vector-bot --env production query "What are the requirements?"
# Check configuration
vector-bot --config-info --env production# Install from PyPI
pip install local-ollama-vector-bot
# Set environment
export RAG_ENV=production
export DOCS_DIR=/data/documents
export INDEX_DIR=/data/index_storage
# Run commands
vector-bot doctor
vector-bot ingest
vector-bot query "your question"# Install in production environment
pip install -e .
# Set environment
export RAG_ENV=production
export DOCS_DIR=/data/documents
export INDEX_DIR=/data/index_storage
# Run commands
python -m vector-bot.cli doctorFROM python:3.10-slim
WORKDIR /app
COPY . .
RUN pip install -e .
# Create data directories
RUN mkdir -p /app/docs /app/index_storage
# Set environment
ENV RAG_ENV=docker
ENTRYPOINT ["python", "-m", "vector-bot.cli"]
CMD ["--help"]Build and run:
docker build -t vector-bot-local .
# Run with volume mounts
docker run -v /host/docs:/app/docs \
-v /host/index:/app/index_storage \
vector-bot-local --env docker doctorCreate a systemd service for production deployment:
# /etc/systemd/system/vector-bot-indexer.service
[Unit]
Description=RAG Document Indexer
After=network.target
[Service]
Type=oneshot
User=vector-bot
Group=vector-bot
Environment=RAG_ENV=production
Environment=DOCS_DIR=/data/documents
Environment=INDEX_DIR=/data/index_storage
ExecStart=/usr/local/bin/vector-bot ingest
WorkingDirectory=/opt/vector-bot
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable vector-bot-indexer.service
sudo systemctl start vector-bot-indexer.service# Override any setting via environment
export OLLAMA_BASE_URL="http://remote-ollama:11434"
export DOCS_DIR="/custom/path/docs"
export SIMILARITY_TOP_K=6The application validates all configuration on startup:
- Checks directory permissions
- Validates URL formats
- Confirms numeric values are valid
- Creates missing directories
The application intelligently resolves paths:
- Absolute paths: Used as-is
- Relative paths: Resolved relative to executable location
- Executable bundled: Works with PyInstaller bundles
# Show current configuration
vector-bot --config-info --env production
# Show verbose config loading
RAG_VERBOSE=true vector-bot doctor --env production- Ollama installed and running on target system
- Required models pulled (
ollama pull llama3.1,ollama pull nomic-embed-text) - Data directories created with proper permissions
- Network connectivity to Ollama verified
- Copy executable to target location
- Copy configuration files
- Set appropriate environment variables
- Test with
vector-bot --config-info --env production - Run health check:
vector-bot --env production doctor
- Initial document ingestion:
vector-bot --env production ingest - Test querying:
vector-bot --env production query "test question" - Set up monitoring/logging as needed
- Configure automated document updates
- Uses local paths for easy iteration
- Verbose logging enabled
- Auto-detection of models
- Uses absolute paths for stability
- Optimized timeouts and batch sizes
- Reduced logging for performance
- Configurable resource limits
- Special networking for Ollama connectivity
- Container-specific paths
- Volume mount support for persistence
- Uses Windows-style paths automatically
- Service deployment via NSSM or similar
- Batch file wrappers if needed
- Run with dedicated user account (not root)
- Restrict file permissions on data directories
- Consider network security for Ollama access
- Validate input document sources
- Monitor resource usage
# Debug configuration loading
RAG_VERBOSE=true vector-bot --config-info --env production# Check executable location detection
python -c "from vector-bot.config import get_executable_dir; print(get_executable_dir())"# Test specific environment
vector-bot --env production --config-info# Test Ollama connection
curl http://localhost:11434/api/tags
vector-bot --env production doctor