Manage Mozilla performance alerts generated by talos.
The production alert_manager server is running on Ubuntu, so this is probably the easiest environment in which to get things running, but other distributions of linux should be fine as well. We use Apache on the production server, but alert_manager will run standalone for testing as well.
It's generally a good idea to create new virtual environment for each project that you work on to not mess up with dependencies. You can install virtualenv with pip. Virtualenvwrapper provides nice commandline interface over virtualenv.
For instance, you can create new virtual environment with virtualenvwrapper like this:
mkvirtualenv alert_manager
The easiest way to install all required dependencies is to use pip.
If you don't have pip installed, fix this by issuing following command:
sudo easy_install pip
Now, when you got pip, run this command to get packages:
pip install -r requirements.txt
If you don't want to use pip, you can check list of project dependencies in requirements.txt file and install them in your preferred way.
To enforce Python code style and avoid silly errors in your Python code, you can set up git pre-commit hook, that will run checks on Python code you want to commit.
ln -s ../../pre-commit.sh .git/hooks/pre-commit
In case you won't deal with found errors, you still can commit by issuing:
git commit --no-verify
Alert manager supports environment-based settings. To enable your own development settings you need to:
-
create local_settings/development.py file (just rename template file)
-
populate it with your settings
-
export TARGET_ENVIRONMENT=development
The alert_manager uses a config.ini file to store identification and options. You can create a default config.ini file by running:
python config.py
Change the username and password for the database as required.
You will also either need a subscription to the mozilla.dev.tree-management newsgroup, or make use of the sample data packaged in the sample folder.
Create the MySQL database using the schema.sql script as follows, where the specified username matches the one in config.ini:
mysql --user <username> --password < schema.sql
This will create a database called alerts, with a single table, also called alerts. You can use the parse_news.py script to populate the database if you wish, but sample data is also included in the sample folder. To use it:
cd sample
bunzip2 july_alerts.sql.bz2
mysql --user <username> --password --database alerts < july_alerts.sql
Start the application:
python server.py
You should see alert_manager running at http://localhost:8159/alerts.html.