Installation

Bartek Andrzejczak edited this page Aug 10, 2015 · 10 revisions

To install Codebrag follow these 3 steps:

  1. Clone your repository (git or svn) into repos directory
  2. Edit codebrag.conf for custom settings
  3. Run Codebrag!

Prerequisites

Codebrag requires Java 7 installed.

Warning: Codebrag will not (yet :) ) work with Java 8!

For Linux, we recommend you to install Java from OpenJDK package.

For Mac OS X/Windows, or if you don't find a suitable distribution, download Java here.

Questions? Help?

Should you encounter any issues with installation, ping us at ask@codebrag.com. We are here to help.

You may also have a look at FAQ and Codebrag Users group.

Note: Codebrag works on Linux/Mac OS X/Windows, but we recommend installing it on Linux. Commands below assume you are on Linux.

Installation Steps

Before you start

Download Codebrag on your server and unzip the archive:

wget http://codebrag.com/latest/codebrag.zip
unzip codebrag.zip

Step 1. Clone your repository

Since version 2.2 Codebrag supports reviewing code from multiple Git or SVN repositories. Both standalone and in the cloud (e.g. Github, Bitbucket) repositories are supported. SVN repositories are supported with help of git-svn.

Repository clone

Clone your repositories to codebrag-2.3/repos directory. At least one repository must be cloned to run Codebrag. Additional repositories can be addd/removed later on.

Git

cd codebrag-2.3/repos
git clone git://yourcompany.com/path/to/project-abc.git

SVN

cd codebrag-2.3/repos
git svn clone http://yourcompany.com/path/to/svn/project-abc project-abc     # Use 'git svn clone', not 'svn checkout'

Note: You need Git version 1.7 or higher to perform git svn command. Download here or install package for your server's OS.

Note: If you want to checkout only the lastest revision of your SVN repo, you can do it by using --revision=HEAD argument of git svn clone command. Please, find more information about git svn clone in the docs.

Q: Do I need to clone my repository if I have the source code cloned already, in a different directory?

Yes, Codebrag requires separate repository clone to automatically synchronise commits.

Step 2. Edit 'codebrag.conf'

Repository authentication

All repositories use common credentials set if provided.

Username/password

If connecting to the repository requires you to authenticate, in codebrag.conf provide the username/password:

repository {
    username = "johndoe"
    password = "password"
}

Leave empty for public repositories or if you are authenticating using a ssh key.

Passphrase

If you authenticate using a key secured with a passphrase, you need to provide it in the configuration. Leave empty if you have got no passphrase configured.

repository {
    passphrase = "secret_passphrase"
}

Sending anonymous statistics

By default, Codebrag sends anonymous data about its usage (e.g. number of users, number of comments). This information never includes any contents of your repository.

Gathering such anonymous statistics helps us improve Codebrag. Hovewer, if you wish to disable this, set send-anon-usage-data property to false.

Optional settings

If you want to use email notifications or send invitations from Codebrag, you need to configure email server.

All other settings, like port on which Codebrag starts and storage directories are optional and usually you do not need to change them. See sample codebrag.conf for details.

Step 3. Running Codebrag

Start Codebrag

To start Codebrag execute:

./codebrag.sh start         # Unix/OS X
codebrag.bat                # Windows
```

Logs will be written to `logs/codebrag.log`. Codebrag will be available at `http://yourserver:8080`.

To display Codebrag logs execute:
```
tail -n 1000 -f logs/codebrag.log
```

To stop Codebrag execute:
```
./codebrag.sh stop
```

### Create user accounts

#### First user
As the first user who accesses Codebrag after installation you will be asked to register an account.

![Registration screen](http://documentation.codebrag.com/download/thumbnails/1015855/2014-02-18_1217.png?version=1&modificationDate=1392722282217&api=v2)

Either the email address or the name provided have to match corresponding fields in `git log` in order to match commits with a given user.

First user registered gets **"Admin"** rights and is allowed to invite others and manage existing users in Codebrag.

#### Other users
Invite members of your team to join Codebrag by choosing the "Invite team members" link from the menu and manage existing uses by clicking "Manage users".

![Invite members](http://documentation.codebrag.com/download/attachments/1638405/user_mgmt.png?version=1&modificationDate=1403851658163&api=v2)

### Configure watched branches 
Since version 2.3 Codebrag lets you configure **watched branches**, i.e. the branches for which you want to receive notifications.

![Watched branches setup after registration](http://documentation.codebrag.com/download/attachments/1638530/image2014-10-24%2012%3A2%3A55.png?version=1&modificationDate=1414144975097&api=v2)

After a user (either the first one or an invited one) registers their account, they will be asked to configure watched branches for every repository.

To watch or unwatch a branch, click on the bell icon next to the branch name. In the example above, the user has chosen to watch the **jdd** branch (indicated by the filled bell icon) in the **vote-counter** repository, but not to watch the **master** branch (indicated by an empty bell icon).

The watched branches can also be configured later on, in a similar manner, from the branches dropdown list:

![Watched branches setup](http://documentation.codebrag.com/download/attachments/1638530/image2014-10-24%2012%3A15%3A4.png?version=1&modificationDate=1414145704265&api=v2)