Apache Bloodhound Plugins and Customization Tips

Getting Started with Apache Bloodhound — Installation and Setup GuideApache Bloodhound is an open-source issue tracker built on top of Trac, designed to simplify project management and defect tracking for teams of all sizes. This guide walks you through planning, installing, configuring, and performing basic administration tasks so you can get a reliable Bloodhound instance up and running.


What you’ll need (prerequisites)

  • A server (physical or virtual) running a modern Linux distribution (examples below use Ubuntu/Debian). Bloodhound can also run on other Unix-like systems.
  • Root or sudo access on the server.
  • Basic familiarity with the command line, Python packaging, and systemd (for service management).
  • At least 1 GB of RAM and 10 GB of disk space for small teams; allocate more for larger projects.
  • A PostgreSQL or SQLite database (PostgreSQL recommended for production).
  • Python 2.7 or Python 3.x depending on the Bloodhound version (check the specific Bloodhound release notes — many legacy releases require Python 2.7).
  • A reverse proxy (NGINX or Apache HTTPD) if you want to serve Bloodhound over HTTP/HTTPS and host multiple services on one host.
  • Optional: a domain name and TLS certificate (Let’s Encrypt recommended).

Note: Verify the Bloodhound version’s exact dependencies before starting; some Apache Bloodhound releases are older and have strict version requirements.


Architecture overview

Bloodhound is a web application that uses:

  • Trac components for ticketing and timeline functionality.
  • A WSGI application served by a Python web server (for small installs) or behind a reverse proxy + WSGI server for production.
  • A backend database (SQLite for testing; PostgreSQL or MySQL for production).
  • Optional email integration for notifications and ticket creation via email.

Installation approaches

Choose one of the following approaches depending on your needs:

  • Quick local setup (SQLite) — good for evaluation or single-user use.
  • Production setup (PostgreSQL + Gunicorn/WSGI behind NGINX) — recommended for teams.
  • Containerized setup — using Docker for easier deployment and portability.

Below are detailed steps for a production-style installation on Ubuntu (Debian-based) and a brief Docker example.


These steps assume Ubuntu 20.04+ or similar Debian-based system.

1) Update system and install base packages

sudo apt update sudo apt upgrade -y sudo apt install -y build-essential git python3 python3-venv python3-pip                      libpq-dev postgresql postgresql-contrib nginx                      libssl-dev pkg-config 

2) Create a dedicated system user

Create a user to run Bloodhound (do not run as root):

sudo adduser --system --group --no-create-home bloodhound 

3) Install and configure PostgreSQL

Create a PostgreSQL role and database:

sudo -u postgres createuser --pwprompt bloodhound_dbuser # Enter a strong password when prompted sudo -u postgres createdb --owner=bloodhound_dbuser bloodhound_db 

(Optional) Adjust pg_hba.conf if you need remote DB access and restart PostgreSQL:

sudo systemctl restart postgresql 

4) Create a Python virtual environment and install Bloodhound

Create an isolated environment for Python dependencies:

sudo mkdir -p /opt/bloodhound sudo chown $USER:$USER /opt/bloodhound python3 -m venv /opt/bloodhound/venv source /opt/bloodhound/venv/bin/activate 

Install Bloodhound. If Bloodhound is available on PyPI for your chosen version:

pip install --upgrade pip setuptools pip install bloodhound 

If not on PyPI, install from source (example):

git clone https://github.com/apache/bloodhound.git /opt/bloodhound/src cd /opt/bloodhound/src pip install -e . 

5) Initial Bloodhound configuration

Generate a project environment (similar to Trac environments). Choose an environment directory, e.g., /opt/bloodhound/env:

sudo mkdir -p /opt/bloodhound/env sudo chown $USER:$USER /opt/bloodhound/env bh-admin /opt/bloodhound/env deploy 

Edit configuration file (conf/bloodhound.ini inside the environment). Key settings:

  • Set database connection string:
    • For PostgreSQL: sqlalchemy.url = postgresql://bloodhound_dbuser:password@localhost/bloodhound_db
  • Set [project] name, admin user, notification settings, email server details.
  • Configure secret keys and any plugin settings you need.

Example snippet for sqlalchemy.url in bloodhound.ini:

[trac] database = postgresql://bloodhound_dbuser:[email protected]/bloodhound_db 

(Exact keys may vary by Bloodhound version; consult conf file comments.)

6) Initialize the database and create admin user

Run the upgrade or init command that populates DB schema and creates admin accounts:

bh-admin /opt/bloodhound/env upgrade bh-admin /opt/bloodhound/env adduser admin YourAdminPassword [email protected] --permissions=TRAC_ADMIN 

7) Install and configure a WSGI server (Gunicorn example)

Install Gunicorn in the virtualenv:

source /opt/bloodhound/venv/bin/activate pip install gunicorn 

Create a systemd service file /etc/systemd/system/bloodhound.service:

[Unit] Description=Bloodhound WSGI server After=network.target [Service] User=bloodhound Group=bloodhound WorkingDirectory=/opt/bloodhound/env Environment="PATH=/opt/bloodhound/venv/bin" ExecStart=/opt/bloodhound/venv/bin/gunicorn --workers 3 --bind unix:/run/bloodhound.sock bloodhound.wsgi:application [Install] WantedBy=multi-user.target 

Reload systemd and start service:

sudo systemctl daemon-reload sudo systemctl enable --now bloodhound 

8) Configure NGINX as reverse proxy and TLS

Create /etc/nginx/sites-available/bloodhound:

server {     listen 80;     server_name bloodhound.example.com;     location / {         proxy_pass http://unix:/run/bloodhound.sock;         proxy_set_header Host $host;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;     } } 

Enable site and restart NGINX:

sudo ln -s /etc/nginx/sites-available/bloodhound /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx 

For TLS, use Certbot:

sudo apt install -y certbot python3-certbot-nginx sudo certbot --nginx -d bloodhound.example.com 

9) Email integration (optional)

Configure outgoing mail in bloodhound.ini with SMTP settings to enable notifications. For incoming mail-based ticket creation, set up fetchmail/imap forwarding or a mail gateway that pipes messages into Bloodhound’s mail handler (consult the Bloodhound documentation for your version).

10) Plugins and customization

Bloodhound supports Trac plugins and its own extensions. Install plugins into the virtualenv (pip) or into the environment per plugin instructions, then enable them in bloodhound.ini under [components] or plugin-specific sections. Restart Gunicorn after changes.


Quick local setup (SQLite) — testing or single-user

For evaluation, a minimal setup using SQLite:

python3 -m venv bh-venv source bh-venv/bin/activate pip install bloodhound mkdir bh-env bh-admin bh-env deploy # edit bh-env/conf/bloodhound.ini to use sqlite (default), create admin user bh-admin bh-env adduser admin password --permissions=TRAC_ADMIN bh-admin bh-env upgrade # run built-in server for quick testing bh-serve bh-env --port 8000 

Open http://localhost:8000 in your browser.


Docker-based deployment (brief)

Use Docker for easier portability. There’s no official Bloodhound image maintained by Apache, but community images or a simple Dockerfile can be used.

Example Dockerfile (conceptual):

FROM python:3.10-slim RUN apt-get update && apt-get install -y build-essential libpq-dev RUN pip install bloodhound RUN useradd -m bloodhound WORKDIR /home/bloodhound COPY ./entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] 

Compose a stack with Postgres and Nginx reverse proxy. Configure volumes for persistent env and DB backups.


Basic administration tips

  • Backup both the database and the Bloodhound environment directory (especially attachments and conf).
  • Use PostgreSQL for production reliability and backups (pg_dump/pg_restore).
  • Monitor logs: Gunicorn logs, NGINX access/error, and Bloodhound’s own logs inside the environment.
  • Apply security updates to OS packages and Python dependencies regularly.
  • Restrict access to the admin interface and use HTTPS everywhere.
  • Test plugin updates in staging before production.

Troubleshooting common issues

  • “Database connection failed” — verify credentials, host, port, and that PostgreSQL accepts connections from the server.
  • “Missing Python package” errors — ensure the virtualenv is activated for commands and service PATH points to the venv.
  • 502 Bad Gateway from NGINX — confirm Gunicorn/socket is running and permission on the Unix socket allows the nginx user to connect.
  • Email notifications not sent — test SMTP settings with a simple Python script or use swaks to debug.

Useful commands cheat-sheet

  • Activate venv: source /opt/bloodhound/venv/bin/activate
  • Start/stop service: sudo systemctl start|stop|restart bloodhound
  • Check logs: sudo journalctl -u bloodhound -f (or tail -f /var/log/nginx/error.log)
  • DB backup (Postgres): pg_dump -U bloodhound_dbuser -h localhost -Fc bloodhound_db > bloodhound_dump.fc

Closing notes

Bloodhound is a pragmatic, Trac-derived issue tracker suited for teams preferring simple, file- and DB-backed project management. For production, prefer PostgreSQL, a WSGI server, and a reverse proxy with TLS. Always test upgrades and plugin changes on a staging instance before applying to production.

If you want, I can create step-by-step commands tailored to your OS/version, provide a Docker Compose file, or help convert these steps into an automated install script.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *