<commit_before>
Install Packages
=================

Servers
-------
httpd
mysql-server
redis

Other
-----
gitolite3
cgit
mod_wsgi

Python Stuff
------------
Django
Django-south
MySQL-python
python-requests
python-markdown
python-redis


Misc
=====

You may have to disable SELinux for ssh keys to work right. You do this in
/etc/sysconfig/selinux. You can also go ahead and chkconfig redis on, as
we'll need it running, and we don't need to adjust it's config at all.


Configure gitolite
==================

We don't like gitolite3 as the username. Add a 'git' user

# adduser -d /srv/git -u <uid> -g <gid> git


Next we need to set up gitolite. Have the public key of the user you want
to be able to administer gitolite on hand, and save it under /tmp

for instance:

$ cd
$ cp .ssh/id_rsa.pub /tmp/mgabed.pub

Now we can set up gitolite under the git account

# su - git
# cd
# gitolite setup -pk /tmp/mgabed.pub

Now change in .gitolite.rc (in git's home) UMASK to be 0027. This will let
group members read files, which will let cgit do its thing later. Also
change GIT_CONFIG_KEYS to 'gitweb\.(owner|description|category)'. This will
allow nice descriptions on cgit. You should also be able to search the file
for 'cgit'.  This should find a single line for you to uncomment.

Now the user whose public key you used can run

$ git clone git@<host>:gitolite-admin

and get a copy of the config repo

They should be able to make any changes they want and push them back. Go
ahead and delete the test repo from conf/gitolite.conf in the repo you
cloned.


Commit your changes and push them back. If you get prompted for git's
password, something is wrong with your public key setup. You may want to
look at permissions, SELinux, the firewall, or hosts.allow.


Mysql
======

First start the mysql server

# service mysqld start

You should see a bunch of information about it setting stuff up, and it
will tell you to secure your installation. Do this by running

# mysql_secure_installation

This will walk you through setting up and securing the database. Make sure
you set a good password for the root user and write it down somewhere.


Now we'll setup mysql for running our git application

mysql> CREATE DATABASE bugit;
mysql> CREATE USER 'bugit'@'localhost' IDENTIFIED BY '<A GOOD PASSWORD>';
mysql> GRANT ALL PRIVILEGES ON bugit.* TO 'bugit'@'localhost';
mysql> FLUSH PRIVILEGES;

Make a note of what password you setup.

The user you set up and the password will be used in django.


BU Git Django Application
==========================

Before we can run the App, there are a couple of things to do.

First we need a user for the app's config builder to run as.

# groupadd -g <gid> bugit_worker
# adduser -d /srv/git -u <uid> -g <gid> bugit_worker
# su - bugit_worker
# ssh-keygen

This will create a new user, and create an ssh key for it. It should be
okay to leave the ssh key passwordless, as it's only going to be used for
pushing to the local gitolite-admin repo. (Which somebody who is able to
break into the user account will be able to do anyway).

Now copy this public key and give it RW permissions to gitolite-admin. The
repo in gitolite.conf should look something like this (RW+ name will be
different). We'll also go ahead and configure the includes we need for the
backend to work.


include "groups/*.conf"
include "users/*.conf"

repo gitolite-admin
    RW+     =   mgabed
    RW      =   bugit_worker


Commit and push this back, and clone it as the bugit_worker user.

Make a copy of the 'bugit' folder under bugit_worker's home directory. As
the bugit_worker user copy bugit/settings.py.sample to as 'settings.py' to
bugit_worker's home folder. Symlink this config file into the bugit folder.

Now edit settings.py. Fill in you databse credentials, and add your hostname<commit_msg>Fix inaccuracy<commit_after>
Install Packages
=================

Servers
-------
httpd
mysql-server
redis

Other
-----
gitolite3
cgit
mod_wsgi

Python Stuff
------------
Django14
Django-south
MySQL-python
python-requests
python-markdown
python-redis


Misc
=====

You may have to disable SELinux for ssh keys to work right. You do this in
/etc/sysconfig/selinux. You can also go ahead and chkconfig redis on, as
we'll need it running, and we don't need to adjust it's config at all.


Configure gitolite
==================

We don't like gitolite3 as the username. Add a 'git' user

# adduser -d /srv/git -u <uid> -g <gid> git


Next we need to set up gitolite. Have the public key of the user you want
to be able to administer gitolite on hand, and save it under /tmp

for instance:

$ cd
$ cp .ssh/id_rsa.pub /tmp/mgabed.pub

Now we can set up gitolite under the git account

# su - git
# cd
# gitolite setup -pk /tmp/mgabed.pub

Now change in .gitolite.rc (in git's home) UMASK to be 0027. This will let
group members read files, which will let cgit do its thing later. Also
change GIT_CONFIG_KEYS to 'gitweb\.(owner|description|category)'. This will
allow nice descriptions on cgit. You should also be able to search the file
for 'cgit'.  This should find a single line for you to uncomment.

Now the user whose public key you used can run

$ git clone git@<host>:gitolite-admin

and get a copy of the config repo

They should be able to make any changes they want and push them back. Go
ahead and delete the test repo from conf/gitolite.conf in the repo you
cloned.


Commit your changes and push them back. If you get prompted for git's
password, something is wrong with your public key setup. You may want to
look at permissions, SELinux, the firewall, or hosts.allow.


Mysql
======

First start the mysql server

# service mysqld start

You should see a bunch of information about it setting stuff up, and it
will tell you to secure your installation. Do this by running

# mysql_secure_installation

This will walk you through setting up and securing the database. Make sure
you set a good password for the root user and write it down somewhere.


Now we'll setup mysql for running our git application

mysql> CREATE DATABASE bugit;
mysql> CREATE USER 'bugit'@'localhost' IDENTIFIED BY '<A GOOD PASSWORD>';
mysql> GRANT ALL PRIVILEGES ON bugit.* TO 'bugit'@'localhost';
mysql> FLUSH PRIVILEGES;

Make a note of what password you setup.

The user you set up and the password will be used in django.


BU Git Django Application
==========================

Before we can run the App, there are a couple of things to do.

First we need a user for the app's config builder to run as.

# groupadd -g <gid> bugit_worker
# adduser -d /srv/bugit -u <uid> -g <gid> bugit_worker
# su - bugit_worker
# ssh-keygen

This will create a new user, and create an ssh key for it. It should be
okay to leave the ssh key passwordless, as it's only going to be used for
pushing to the local gitolite-admin repo. (Which somebody who is able to
break into the user account will be able to do anyway).

Now copy this public key and give it RW permissions to gitolite-admin. The
repo in gitolite.conf should look something like this (RW+ name will be
different). We'll also go ahead and configure the includes we need for the
backend to work.


include "groups/*.conf"
include "users/*.conf"

repo gitolite-admin
    RW+     =   mgabed
    RW      =   bugit_worker


Commit and push this back, and clone it as the bugit_worker user.

Make a copy of the 'bugit' folder under bugit_worker's home directory. As
the bugit_worker user copy bugit/settings.py.sample to as 'settings.py' to
bugit_worker's home folder. Symlink this config file into the bugit folder.

Now edit settings.py. Fill in you databse credentials, and add your hostname
{'fraction_non_alphanumeric': 0.07753765553372625, 'fraction_numerical': 0.00183366077275704, 'mean_word_length': 3.719406674907293, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4242807', 'n_tokens_mistral': 2383, 'n_tokens_neox': 2256, 'n_words': 1198}