I recommend the latest versions for Supervisor and uwsgi. I am using nginx 1.4.7 as that is the latest available on Gentoo (unmasked for ~amd64
).
Unmask app-admin/supervisor
and www-servers/uwsgi
. In the case of x86-64:
app-admin/supervisor ~amd64
www-servers/uwsgi ~amd64
www-servers/uwsgi python
NGINX_MODULES="uwsgi"
I recommend many more such as gzip
, gzip_static
, etc.
emerge -av uwsgi nginx supervisor virtualenv dev-db/postgresql-server
cd # at $HOME
virtualenv -p python2.7 bloodhound
Cloning latest stable here:
cd bloodhound
git clone -b 0.7 git://git.apache.org/bloodhound.git app
cd app/installer
pip install -r requirements-dev.txt
pip install -r pgrequirements.txt
Follow steps from Portage to install and enable PostgreSQL server.
You can use createdb
and createuser
commands but I kind of prefer using psql
directly:
CREATE USER bloodhound WITH PASSWORD 'somepass';
CREATE DATABASE bloodhound;
GRANT ALL PRIVILEGES ON DATABASE bloodhound TO bloodhound;
Enter the virtualenv, get into the correct directory and install it:
cd ~/bloodhound
source bin/activate
cd app/installer
mkdir ~/bloodhound-envs
python bloodhound_setup.py \
-d postgres \
--database-name=bloodhound \
-u bloodhound \
-p somepass \
--admin-user=admin \
--admin-password='your_admin_pass' \
--environments_directory=~/bloodhound-envs
Still in the virtualenv in this step:
cd ~/bloodhound
trac-admin ~/bloodhound-envs/main deploy ~/bloodhound-envs/main/site
cd ~/bloodhound-envs/main/site/cgi-bin
cp trac.wsgi bh_wsgi.py
Get out the virtualenv since it's not longer necessary:
deactivate
Replace nginx
with the user nginx runs as. This should not be root.
Replace /home/me/
with your real $HOME
.
Adjust options as you like. Note that --http-socket
is very important to use (and not --socket
).
[program:bloodhound]
killasgroup = true
command = uwsgi
--plugin python27
--enable-threads
--processes 2
--http-socket /var/run/bloodhound.sock
--chown-socket nginx:nginx
--chmod=770
--chdir /home/me/bloodhound-envs/main/site/cgi-bin
--virtualenv /home/me/bloodhound
--module=bh_wsgi:application
user = nginx
Start supervisord
as a user with proper privileges (can be root). Gentoo has /etc/init.d/supervisord
which reads /etc/supervisord.conf
. My file has this (note how you can include files):
[unix_http_server]
file=/var/run/supervisor.sock
[supervisord]
; logfile_backups=1
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[include]
files = /etc/supervisor.d/*.conf
upstream bloodhound_uwsgi {
server unix:/var/run/bloodhound.sock;
}
server {
# server_name localhost;
root /home/me/bloodhound-envs/main/site/cgi-bin;
access_log /var/log/nginx/bh.access_log;
error_log /var/log/nginx/bh.error_log info;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location @proxy {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://bloodhound_uwsgi;
}
location /chrome {
alias /home/me/bloodhound-envs/main/site/htdocs;
}
location / {
try_files $uri @proxy;
}
}
Put this in a file nginx will load.
Restart nginx.