<commit_before>.. index:: setupdevenv

.. _setupdevenv-chapter:

Setup a development environment
===============================

The best and easiest way to get started with a complete dev environment is to
use Vagrant and our installation script. You can find all the instructions
here: https://github.com/rhelmer/socorro-vagrant

If you don't want to use a virtual machine, you can install everything in your
own development environment. All steps are described in
:ref:`standalone-chapter`.

Use your own git repo
---------------------

If you forked our mozilla/socorro repository, you will want to make your repo
the origin of the repository inside your VM. Once connected through SSH into
the VM, execute the following commands::

    sudo su - socorro
    cd /home/socorro/dev/socorro
    edit .git/config # change `url = <EMAIL>:mozilla/socorro.git` with your repo's URL
    git fetch origin

Apply your changes
------------------

After that, whenever you want to see changes you made in one of your branches,
do the following::

    cd /home/socorro/dev/socorro
    git checkout my-dev-branch
    make install
    sudo /etc/init.d/apache restart
    sudo /etc/init.d/supervisor force-stop && sudo /etc/init.d/supervisor start

And then from your browser access http://crash-stats/ for the UI, or
http://socorro-api/bpapi/ for the middleware API directly.

Use a shared folder
-------------------

If you don't like vim or you want to use your favorite IDE, you can easily
create a shared folder between your OS and your VM. You can then work in your
OS and have all your changes automatically passed to the VM.

The best solution is to use NFS. There is a good documentation on Vagrant's
website that explain it all: http://vagrantup.com/docs/nfs.html


Setting up a new database
----------------
If you do not have an existing production database to import, or wish to 
create a new standalone database for testing, see :ref:`populatepostgres-chapter` 
or :ref:`populateelasticsearch-chapter`.

Pulling crash reports from production
----------------
The Socorro PostgreSQL database only contains a small subset of the information 
about individual crashes (enough to run aggregate reports). For instance the
full stack is only available in long-term storage (such as HBase).
<commit_msg>small edits and fix to use apache2 and not apache<commit_after>.. index:: setupdevenv

.. _setupdevenv-chapter:

Setup a development environment
===============================

The best and easiest way to get started with a complete dev environment is to
use Vagrant and our installation script. You can find all the instructions
here: https://github.com/rhelmer/socorro-vagrant

If you don't want to use a virtual machine, you can install everything in your
own development environment. All steps are described in
:ref:`standalone-chapter`.

Use your own git repo
---------------------

If you forked our mozilla/socorro repository, you will want to make your repo
the origin of the repository inside your VM. Once connected through SSH into
the VM, execute the following commands::

    sudo su - socorro
    cd /home/socorro/dev/socorro
    edit .git/config # change `url = <EMAIL>:mozilla/socorro.git` with your repo's URL
    git fetch origin

Apply your changes
------------------

After that, whenever you want to see changes you made in one of your branches,
do the following::

    cd /home/socorro/dev/socorro
    git checkout my-dev-branch
    make install
    sudo /etc/init.d/apache2 restart
    sudo /etc/init.d/supervisor force-stop && sudo /etc/init.d/supervisor start

And then from your browser access http://crash-stats/ for the UI, or
http://socorro-api/bpapi/ for the middleware API directly.

Use a shared folder
-------------------

If you don't like vim or you want to use your favorite IDE, you can easily
create a shared folder between your OS and your VM. You can then work in your
OS and have all your changes automatically passed to the VM.

The best solution is to use NFS. There is good documentation on the Vagrant
website that explains it all: http://vagrantup.com/docs/nfs.html


Setting up a new database
----------------
If you do not have an existing production database to import, or wish to 
create a new standalone database for testing, see :ref:`populatepostgres-chapter` 
or :ref:`populateelasticsearch-chapter`.

Pulling crash reports from production
----------------
The Socorro PostgreSQL database only contains a small subset of the information 
about individual crashes (enough to run aggregate reports). For instance the
full stack is only available in long-term storage (such as HBase).

{'fraction_non_alphanumeric': 0.10547886108714409, 'fraction_numerical': 0.0004314063848144953, 'mean_word_length': 3.317504655493482, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '7017090', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1183, 'n_words': 619}