How to backup and restore Gerrit server?

How to backup and restore gerrit server?

There are 3 coponent which should be backed up in gerrit

  1. Repository – According to me best way to backup the repository is to setup a replication with other gerrit hosting tools using gerrit replication plugins. The steps can be find as below;
  2. Gerrit Database
    Depends on the database, you should take the database backup. It can be H2 or mysql….
  3. Gerrit Config
    Rysnc is the best tools to take the entire gerrit site backup.

How to replicate Gerrit repository using replication plugins?

Step 1- Setup Gerrit Server
http://www.devopsschool.com/tutorial/gerrit/gerrit-install-and-configuration.html

Step 2 – Create a Project in Gerrit

Step 3 – Setup a Developement Machine
git clone http://admin@35.154.81.167:8080/a/prj1 && (cd prj1 && curl -kLo `git rev-parse –git-dir`/hooks/commit-msg http://admin@35.154.81.167:8080/tools/hooks/commit-msg; chmod +x `git rev-parse –git-dir`/hooks/commit-msg)

Step 4: Sample Commits to be done
> touch file1.txt;git add .;git commit -m”adding first version”

Step 5: Sample push and submit it
> git push origin HEAD:refs/for/master

Step 6: create it $site_path/etc/replication.config

Content of the files is –
[remote “github”]
url = git@github.com:scmgalaxy/${name}.git

Within each URL value the magic placeholder `${name}` is replaced with the Gerrit project name.

Step 7: Generate a public/private key

> ssh-keygen -t rsa

Step 8: create a “config” under /root/.ssh

Host github.com
User git
IdentityFile /root/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null

Step 9: Update the public key to github

Step 10: Create a repo in Github.com with same name.

Tagged : / / /

How Gerrit Works?

When Gerrit is configured as the central source repository, all code changes are sent to Pending Changes for others to review and discuss. When enough reviewers have approved a code change, you can submit the change to the code base.

In addition to the store of Pending Changes, Gerrit captures notes and comments made about each change. This enables you to review changes at your convenience or when a conversation about a change can’t happen in person. In addition, notes and comments provide a history of each change (what was changed and why and who reviewed the change).

Gerrit project is a workspace consisting of the following elements:

  • Git repository: It is used to store the merged code base and the changes under review that have not being merged yet. Gerrit has the limitation of a single repository per project. There can also be projects without any code repository associated at all (that is, Security-only projects)
  • Changes references under review: Git commit-id (expressed as SHA-1 Hexadecimal alphanumeric string) stored in the Gerrit DB and pointing to the corresponding changes stored in the Git repository. A Gerrit change is a Git commit object uploaded for review and associated to its comments and scores. It is stored in the project’s Git repository but it is not visible/accessible from the normal Git graph of commits, even it does start from a point on the commits graph.
  • Access Control Lists (ACLs): It contains the list of roles defined for the Gerrit project and the associated access permissions to the Git repository branches.
  • Prolog rules: It is the set of rules that govern the Code Review process for the project. 0 Additional metadata: All the extra settings such as description, merge strategy, contributor agreements, and accessory metadata needed in order to manage the project.

We have to make and review a change through these stages in Gerrit:

  1. Making the change.
  2. Creating the review.
  3. Reviewing the change.
  4. Reworking the change.
  5. Verifying the change.
  6. Submitting the change.

Tagged : /

How to Install and Configure Gerrit2 in CentOs and Ubantu ?

gerrit2-installation-configuration
Step 1:  Update System
> yum update
> apt-get update
Step 2: Install git
Step 3: Install screen
Step 4: Install screen
Step 5: Install Java
Step 6: MySQL
Step 7: Install Gerrit
1. Create a Database
2. Initialize the site
3. Download Gerrit
wget https://gerrit-releases.storage.googleapis.com/gerrit-2.9.1.war
4. Start Gerrit Setup
5. Restart / Stop / Start gerrit
5. Access Gerrit
Step 8: Install Apache
Step 9: Configure Apache Proxy to Gerrit
Step 10: Verify
Some important Tools
Screen
Reference
https://gerrit.googlecode.com/svn/documentation/2.0/install.html
http://dachary.org/?p=1716
https://www.rosehosting.com/blog/how-to-install-gerrit2-on-a-centos-7-linux-vps/
https://www.digitalocean.com/community/tutorials/how-to-install-gerrit-on-an-ubuntu-cloud-server
Tagged : / / / / / / / / / / / / / / /

Gerrit useful website reference | Gerrit Performance CheatSheet

gerrit-performance-cheatsheet

Gerrit Performance CheatSheet

Tagged : / / / / / / / / /

Basics of Git and Gerrit | Git & Gerrit Overview | Git and Gerrit Concept

basics-of-git-and-gerrit

Git & Gerrit

  • As per British English, Git means “unpleasant person”. The inspiration of designing Git is taken from “BitKeeper” and “Monotone”. 
  • Both are distributed revision control system. Git was originally designed as a low level version control system engine and on top of this Cogito and StGIT(Stacked Git) is developed. StGIT is a Python application that provides functionality similar to quilt
  • Git is a highly performant free and open source distributed version control system as compare and contrast to other centralized version control systems such as CVS, SVN, ClearCase, and Perforce. 
  • It was initially designed and developed by Linus Torvalds for Linux kernel development in 2005.
  • As per the analysis corresponding to Eclipse IDE users, Git has reported 30% adoption as of 2013 in software industry for VCS(Version Control System)/RCS(Revision Control System)/SCM(Source code management).
  • The Stable release of Git is released on August 23, 2013 which is of version 1.8.4. Its Initial release was introduced in the 7th april 2005 . Originally Git is developed in “C”.

Gerrit

  • Gerrit is a free, web-based review tool developed by Google for Android. 
  • It is developed with a git based workflow in mind. It acts as a firewall in front of a Git repository. 
  • Software developers working in a team can review each other’s changes/modifications on their source code using a web browser and approve or reject those changes. 
  • Gerrit works on “Change”s. A change is a set of modifications to various files in your repository to accomplish a task. It is essentially one large git commit with all the necessary changes which can be both built and tested. 
  • It integrates closely with Git, a distributed version control system. 
  • It was developed at Google by Shawn Pearce (founder of JGit) for the development of the Android project. Gerrit uses Google Web Toolkit to generate front-end JavaScript code from Java source. 
  • It is a SSH server. 
  • Gerrit centralizes the distributed nature of Git, while maintaining the advantages of a DVCS, by imposing a centralized workflow. 
  • Large corporations such as SAP, Sony Mobile, Qualcomm and many other enterprises, organisations and non affiliated individuals/volunteers contributed to the review and development of the code-base.
  • The Stable release of Gerrit is released on September 18, 2013 which is of version 2.7.   
  • Originally this tool was written in Python and now this tool is written in Java, Servlet and GWT. 
  • This is a code review tool and now Apache is having its license.
Tagged : / / / / / / / / / / / / / / /

How to use Gerrit to enhance your Code Analysis?

gerrit-to-enhance-your-git/

Check the video at the bottom of the page.

Click here

Tagged : / / / / / / / / / / / / / /