Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
[fix bug 766074] Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
glogiotatidis committed Jun 21, 2012
1 parent f773ee5 commit b659fe4
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/components.rst
Expand Up @@ -4,5 +4,5 @@ Components

.. toctree::
profiles
mentorship
reports
events
6 changes: 3 additions & 3 deletions docs/conf.py
Expand Up @@ -41,16 +41,16 @@

# General information about the project.
project = u'ReMo Portal'
copyright = u'2011, ReMo Team'
copyright = u'2011-2012, ReMo Team'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
version = '0.2.5'
# The full version, including alpha/beta/rc tags.
release = '0.1'
release = '0.2.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
5 changes: 4 additions & 1 deletion docs/index.rst
Expand Up @@ -17,14 +17,17 @@ practices and tools of mozillians around the world.
To learn more about it and the release schedule visit `ReMo Portal project page
<https://wiki.mozilla.org/ReMo/Website>`_.

For comments and/or questions about ReMo Portal or this documentation
please ping us on `#remo-dev
<http://mibbit.com/?channel=%23remo-dev&server=irc.mozilla.org>`_.

Contents
--------

.. toctree::
:maxdepth: 2

installation
components

Indices and tables
------------------
Expand Down
186 changes: 186 additions & 0 deletions docs/installation.rst
Expand Up @@ -2,4 +2,190 @@
Installation
============

Getting our own development environment.

Preparing Your System
---------------------

#. **Install Vagrant.**

Vagrant is a manager of VMs for development. It streamlines and
simplifies the procedure to get your own development environment
for each project you are working on.

Based on a configuration file, it creates Virtual Machines based on
VirtualBox and configures folder and port sharing among your host
machine and guest machine for easier access. It works nicely along
with tools like puppet and automatically install and configures all
the required programs and services (e.g. MySQL, Apache, etc) needed
for development.

This way all developers of a single project share the same
environment.

Most Linux distributions come with vagrant packaged, so probably
you need to just install the package.

- For Debian based systems::

~$ sudo apt-get install vagrant

For other Linux distributions or operating systems visit `Vagrant's
download page <http://downloads.vagrantup.com/>`_.


#. **Install git.**

Our code is revisioned using `git <http://git-scm.org>`. You can
install it on your Linux machine through your package manager.

- For Debian based systems::

~$ sudo apt-get install git

For other Linux distributions or operating systems visit `Git's
download page <http://git-scm.com/downloads>`_.



Build The Environment
---------------------

#. **Clone ReMo repository.**

Mozilla Reps Portal is hosted on `<http://github.com/mozilla/remo>`_.

Clone the repository locally::

~$ git clone --recursive http://github.com/mozilla/remo

.. note::

Note the `--recursive` flag in the clone command. We make heavy
use of *git submodules* and this flag clones the required
submodules along with remo code.

#. **Fire up vagrant.**

Now you need to build the virtual machine where ReMo portal will
live. Change into the cloned directory and run vagrant::

~$ cd remo
~/remo$ vagrant up

.. note::

The first time you run vagrant an VM image will be downloaded
and the guest machine will be configured. You will be
downloading more than 300Mb. A (decent) internet connection is
required.


#. **Connect to your vagrant machine.**

You can connect to your vagrant machine, when it's running, using::

~/remo$ vagrant ssh


#. **Create an admin account.**

Within your vagrant machine, create your own admin account::

~/project$ ./manage.py createsuperuser


.. note::

We are using `BrowserID <http://browserid.org>`_, so a valid
email address is required for your admin account.


#. **Choose a HMAC_KEY.**

For development purposes you can uncomment the key '2012-06-15'
with HMAC_KEYS dictionary in your local.py::

HMAC_KEYS = {
'2012-06-15': 'some key',
}



#. **Activate MailHide.**

We use `MailHide
<https://developers.google.com/recaptcha/docs/mailhideapi>`_ to
protect our users from spam. Open `local.py` under `settings`
directory and uncomment the following lines::

# MAILHIDE_PUB_KEY = '02Ni54q--g1yltekhaSmPYHQ=='
# MAILHIDE_PRIV_KEY = 'fe55a9921917184732077e3fed19d0be'

These keys are `demo` keys and will not decrypt emails on your
local installation but that's OK if you are not working on a
related bug.

If you are to work on a MailHide related bug, register on
`MailHide's website
<http://www.google.com/recaptcha/mailhide/apikey>`_ for a valid
pair of keys.


#. **Update product_details package.**

Package `product_details` provides information about countries. We
use it in Country selection lists. The information get pulled form
mozilla's SVN, so we need to fetch it at least once. To update run::

~/project$ ./manage.py update_product_details


#. **Load demo data (optional).**

Depending on what you are going to develop you may need to have
some demo data.

To load *demo users* run (within your VM)::

~/project$ ./manage.py loaddata demo_users

To load *demo reports* run::

~/project$ ./manage.py loaddata demo_reports

To fetch *bugzilla bugs* run::

~/project$ ./manage.py fetch_bugs

.. note::

Fetching bugzilla bug requires a Mozilla Reps Admin account on
Bugzilla. Ping `giorgos` on #remo-dev to give you access if
your project requires it.

#. **Start django devserver.**

Within your vagrant machine you can start django devserver by
running::

$ cd project
~/project$ ./manage.py runserver 0.0.0.0:8000

.. note::

The `~/project` directory within the VM mirrors the contents of
the `~/remo/` directory in you machine. So you can hack on your
machine, using your favorite editor and your changes get
reflected to the VM immediately.

.. note::

Since we are running the django webserver inside a VM it's
required that bind the server on all network interfaces, so it's
accessible from the host machine. Thus the use of *0.0.0.0:8000*
in the command.

#. **Visit our local installation of the ReMo Portal.**

You are done! Point Firefox to `<http://127.0.0.1:8000>`_.
File renamed without changes.
10 changes: 10 additions & 0 deletions puppet/manifests/classes/python.pp
Expand Up @@ -17,6 +17,11 @@
command => "pip install -r $PROJ_DIR/requirements/compiled.txt",
require => Exec['pip-install']
}

exec { "pip-install-dev":
command => "pip install -r $PROJ_DIR/requirements/dev.txt",
require => Exec['pip-install']
}
}

ubuntu: {
Expand All @@ -29,6 +34,11 @@
command => "pip install -r $PROJ_DIR/requirements/compiled.txt",
require => Package['python-pip']
}

exec { "pip-install-dev":
command => "pip install -r $PROJ_DIR/requirements/dev.txt",
require => Package['python-pip']
}
}
}
}
10 changes: 10 additions & 0 deletions remo/base/tests.py
@@ -1,9 +1,11 @@
import base64

from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import Client
from jinja2 import Markup
from nose.exc import SkipTest
from nose.tools import eq_
from test_utils import TestCase

Expand Down Expand Up @@ -96,6 +98,10 @@ def test_view_faq_page(self):

def test_mailhide_encryption(self):
"""Test email encryption function."""
if (getattr(settings, 'MAILHIDE_PUB_KEY', None) !=
'01Ni54q--g1yltekhaSmPYHQ=='):
raise SkipTest('Skipping test due to different MailHide pub key.')

test_strings = [('foo@example.com', '3m5HgumLI4YSLSY-YP9HQA=='),
('bar@example.net', '9o38o8PEvGrP6V5HSDg_FA=='),
('test@mozilla.org', ('ABBkk5Aj2-PJ_izt9yU8pMzt'
Expand All @@ -109,6 +115,10 @@ def test_mailhide_encryption(self):

def test_mailhide_helper(self):
"""Test mailhide helper."""
if (getattr(settings, 'MAILHIDE_PUB_KEY', None) !=
'01Ni54q--g1yltekhaSmPYHQ=='):
raise SkipTest('Skipping test due to different MailHide pub key.')

m1 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
'tekhaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==" onclick="window'
'.open(\'http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte'
Expand Down
14 changes: 14 additions & 0 deletions remo/remozilla/tests/test_tasks.py
@@ -1,5 +1,7 @@
import json

from django.conf import settings
from nose.exc import SkipTest
from nose.tools import eq_, raises
from test_utils import TestCase

Expand All @@ -19,13 +21,21 @@ class FetchBugsTest(TestCase):
@fudge.patch('requests.get')
def test_connection_error(self, fake_requests_obj):
"""Test fetch_bugs connection error exception."""
if (not getattr(settings, 'REMOZILLA_USERNAME', None) or
not getattr(settings, 'REMOZILLA_PASSWORD', None)):
raise SkipTest('Skipping test due to unset REMOZILLA_USERNAME '
'or REMOZILLA_PASSWORD.')
(fake_requests_obj.expects_call().raises(requests.ConnectionError))
fetch_bugs()

@raises(ValueError)
@fudge.patch('requests.get')
def test_invalid_return_code(self, fake_requests_obj):
"""Test fetch_bugs invalid status code exception."""
if (not getattr(settings, 'REMOZILLA_USERNAME', None) or
not getattr(settings, 'REMOZILLA_PASSWORD', None)):
raise SkipTest('Skipping test due to unset REMOZILLA_USERNAME '
'or REMOZILLA_PASSWORD.')
request = requests.Request()
request.status_code = 500
request.text = 'Foobar'
Expand All @@ -35,6 +45,10 @@ def test_invalid_return_code(self, fake_requests_obj):
@fudge.patch('requests.get')
def test_with_valid_data(self, fake_requests_obj):
"""Test fetch_bugs valid bug data processing."""
if (not getattr(settings, 'REMOZILLA_USERNAME', None) or
not getattr(settings, 'REMOZILLA_PASSWORD', None)):
raise SkipTest('Skipping test due to unset REMOZILLA_USERNAME.')

previous_last_updated_time = get_last_updated_date()

request = requests.Request()
Expand Down
7 changes: 4 additions & 3 deletions remo/settings/local.py-dist
Expand Up @@ -55,7 +55,7 @@ from django_sha2 import get_password_hashers
PASSWORD_HASHERS = get_password_hashers(base.BASE_PASSWORD_HASHERS, HMAC_KEYS)

# Make this unique, and don't share it with anybody. It cannot be blank.
SECRET_KEY = ''
SECRET_KEY = 'some secret'

# Uncomment these to activate and customize Celery:
# CELERY_ALWAYS_EAGER = False # required to activate celeryd
Expand Down Expand Up @@ -84,8 +84,9 @@ SECRET_KEY = ''
# REMOZILLA_PASSWORD = ''

# Mailhide configuration
# MAILHIDE_PUB_KEY = ''
# MAILHIDE_PRIV_KEY = ''
# Demo keys, replace with valid ones.
# MAILHIDE_PUB_KEY = '02Ni54q--g1yltekhaSmPYHQ=='
# MAILHIDE_PRIV_KEY = 'fe55a9921917184732077e3fed19d0be'

# Arecibo
# ARECIBO_PUBLIC_ACCOUNT_NUMBER = ''
Expand Down
5 changes: 4 additions & 1 deletion requirements/dev.txt
Expand Up @@ -3,6 +3,9 @@
# package for developers (testing, docs, etc.), it goes in this file.

-r ../vendor/src/funfactory/funfactory/requirements/compiled.txt
-r ../vendor/src/funfactory/funfactory/requirements/dev.txt

# Commenting dev.txt from functory because it brings in prod.txt
# -r ../vendor/src/funfactory/funfactory/requirements/dev.txt

fudge
pyquery

0 comments on commit b659fe4

Please sign in to comment.