📜 ⬆️ ⬇️

We raise our own Git GitBlit server on Openshift hosting



Hi, Habr!
All programmers are divided into those who use the version control system, and those who are not yet using it. One of the most popular today is git. And although its structure is aimed at decentralized data storage, we all use github, assembla, bitbucket, or githost. The main disadvantage of these hosting sites is that they are foreign projects that at any time can cover your account or merge data to the left. And then GitBlit appears on the scene! Git server in Java, completely controlled by you, with a lot of buns and a web interface. Today we will launch it on a free hosting from Redhat.


')

Preamble, you can not read


When I learned about free hosting from Redhat at the beginning of summer, I immediately wanted to post something there, but there was a problem: I don’t do web development, I don’t have any projects and I don’t need any hosting. The man is the most cold-blooded person for free, and it was just a freebie, so my brain gave the idea: “Let's make our own git server!”. After googling, I found only one git server in Java, which was not only actively developed, but could, according to the author, work on openshift hosting. After the tests and the introduction of active use, a burning desire to tell about it to everyone in the district appeared. Half a year was written, but suddenly it was summer, and, as a result, all projects were frozen until autumn. Autumn has come, I finally finished the articles and submit it to your judgment.

A bit of theory, the main features.


The description of the possibilities is honestly torn off the site and translated into our great and mighty one.

Four types of access control configurations for each storage:


Main buns:


Languages:
There is a desire to translate into the Great and Mighty?
Welcome to www.getlocalization.com/gitblit

Screenshots: gitblit.com/screenshots.html
Demo server: demo-gitblit.rhcloud.com

Now go to practice


Installation


Register for openshift
Create a JBoss Application Server https://openshift.redhat.com/app/console/application_types/jbossas-7
Next, following the instructions, add your ssh-key and execute git clone.
In my case, for example:
git clone ssh://461e96291a2d2fb96b4423a0a329c7@habr-dark008.rhcloud.com/~/git/habr.git/ 

Go to the application folder:
 cd habr/ 

Clear the folder from the standard stub:
 rm -R * 

Download gitblit:
 wget https://gitblit.googlecode.com/files/express-1.1.0.zip 

Unzip the habr folder and delete the archive:
 unzip express-1.1.0.zip && rm express-1.1.0.zip 


We configure a config to the address: habr / deployments / ROOT.war / WEB-INF / web.xml
Set to true :
web.enableRpcManagement
web.enableRpcAdministration
And web.forwardSlashCharacter is on !

As sensible paranoids, we redirect all traffic via https.
Create a jboss-web.xml file in the same folder (WEB-INF) with the following content:

 <jboss-web> <security-domain>jboss-web-policy</security-domain> <valve> <class-name>org.jboss.web.rewrite.RewriteValve</class-name> </valve> </jboss-web> 


Create a file rewrite.properties in the same folder (WEB-INF) with the following redirection rules:

 RewriteCond %{HTTP:X-Forwarded-Proto} http RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 


This completes the server side configuration.
Fill the data on the server by performing the sacred:

 git add . git commit -m 'Init git server' git push 


Now the last step is setting.


Download the manager for remote administration gitblit: gitblit.googlecode.com/files/manager-1.1.0.zip

Connect to our server habr-dark008.rhcloud.com, login and password are standard: admin, admin.
You only need to change the administrator password, the rest of the settings at your discretion.

The server can also be configured via the web interface, but the author advises to use the manager: it has more settings, fewer glitches.
More fine-tuning: gitblit.com/setup.html

Links


Sources: github.com/gitblit or code.google.com/p/gitblit/source/list
Bug Tracker: code.google.com/p/gitblit/issues/list
Discussion: groups.google.com/group/gitblit
Google+: plus.google.com/114464678392593421684

Thanks to Andrey Suvorov for reviewing the text.

Source: https://habr.com/ru/post/151646/


All Articles