<commit_before>---
layout:     post
title:      "Setting up Gerrit"
subtitle:   "Initial setup"
date:       2015-05-30 12:35:33
author:     "The Crew"
header-img: "img/post-bg-03.jpg"
tags: [code-review]
---

##Setting up Gerrit

The very first thing you will want to do is creating a new user for running Gerrit. In our case called "gerrit", and log into that user. 

The next thing you will have to do is download the official java package<br>
download gerrit.war from [Official Gerrit page](https://code.google.com/p/gerrit)

execute 
{% highlight bash %}
java -jar gerrit.war init -d path/to/site/folder
{% endhighlight %}

This will create the folder you provide in the "-d" argument and start the initialisation dialog. You can run this command again on an already existing gerrit folder to change its configuration.

Below you can see the configuration dialog in our case. We went with the default options in most cases (except the http port to listen on, which we set to 8081 because 8080 is already used for jenkins. We also didn't install bouncy castle).
{% highlight bash %}
bash-3.2$ java -jar /Applications/Gerrit/gerrit-2.11.war init -d badgeme
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore

*** Gerrit Code Review 2.11
*** 

Create '/Users/gerrit/Documents/gerrit/badgeme' [Y/n]? 

*** Git Repositories
*** 

Location of Git repositories   [git]: 

*** SQL Database
*** 

Database server type           [h2]: <commit_msg>v0.983<commit_after>---
layout:     post
title:      "Setting up Gerrit"
subtitle:   "Initial setup"
date:       2015-05-30 12:35:33
author:     "The Crew"
header-img: "img/post-bg-03.jpg"
tags: [code-review]
---

##Setting up Gerrit

The very first thing you will want to do is creating a new user for running Gerrit. In our case called "gerrit", and log into that user. 

The next thing you will have to do is download the official java package<br>
download gerrit.war from [Official Gerrit page](https://code.google.com/p/gerrit)

execute 
{% highlight bash %}
java -jar gerrit.war init -d path/to/site/folder
{% endhighlight %}

>NOTE: the path/to/site/folder should be a folder you don't need admin access to change (e.g. ~/gerritSite)

This will create the folder you provide in the "-d" argument and start the initialisation dialog. You can run this command again on an already existing gerrit folder to change its configuration.

Below you can see the configuration dialog in our case. We went with the default options in most cases (except the http port to listen on, which we set to 8081 because 8080 is already used for jenkins. We also didn't install bouncy castle).
{% highlight bash %}
bash-3.2$ java -jar /Applications/Gerrit/gerrit-2.11.war init -d badgeme
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore

*** Gerrit Code Review 2.11
*** 

Create '/Users/gerrit/Documents/gerrit/badgeme' [Y/n]? 

*** Git Repositories
*** 

Location of Git repositories   [git]: 

*** SQL Database
*** 

Database server type           [h2]: 
{'fraction_non_alphanumeric': 0.0965721819380356, 'fraction_numerical': 0.023071852340145024, 'mean_word_length': 3.6908809891808345, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2955169', 'n_tokens_mistral': 1010, 'n_tokens_neox': 893, 'n_words': 394}