Raise your own git server GitBlit hosting Openshift
Hello, Habr!
All programmers are divided into those who use the version control system, and those who still do not use 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 drawback of these hosting services is that they are foreign projects that can cover your account at any time or merge data to the left. And then GitBlit appears on the scene! Git server in Java, completely controlled by you, with lots of goodies and a web interface. Today we will launch it on a free hosting from Redhat.
Preamble, you can not read
Having learned about free hosting from Redhat at the beginning of summer, I immediately wanted to post something there, but there was a problem: I’m not involved in web development, there are no projects and I don’t need any kind of hosting. The most greedy person is 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 tests and introduction into active use, there was a burning desire to tell everyone in the district about it. A half-article was written right away, but suddenly summer came, and, as a result, all projects were frozen until the fall. Autumn has come, I finally finished writing the articles and submit it to your court.
A little theory, the main features.
Description of features honestly stripped from the site and translated into our great and mighty.
Four types of access control configurations for each repository:
- Anonymous browsing, cloning and uploading to the repository
- Authorized upload to repository
- Authorized Cloning and Upload to Repository
- Authorized viewing, cloning and uploading to the repository
- Repository Freeze (read-only)
Basic buns:
- Based on the JGit SmartHTTP Servlet
- Ability to combine with other Gitblit servers
- RSS / JSON RPC Interface
- Cross-platform Java Gitblit Manager
- Web-interface adapted for phones, tablets and ordinary computers
- Using groovy scripts in hooks before uploading to the server and after; you can set the action of hooks for a single repository or globally for all
- Email notifications after uploading to the server (via sendmail.groovy script)
- Indexing Lucene Repository Branches
- Administrators can create, edit, rename or delete repositories, users and groups through the web interface or the RPC interface (manager)
- Repository owners can edit via the web interface
- Administrators and owners of the repository can set the main branch via the web interface or the RPC interface
- LDAP authentication and optional LDAP user list
- Integration with gravatar
- Supported display of git tags
- Supported display of GH pages (Jekyll not supported)
- Markdown file display supported
- Branch statistics (used by Google Charts)
- RSS feeds of branches
- The use of the browser time zone when displaying the date and time is supported
- Supports hiding e-mail addresses of author and committer
- Case insensitive search on commits, authors and commiters
- Source syntax highlighting
- Additional utilities
- Documentation page containing all Markdown repository files
- Ticgit Page (Based on the latest MIT release bf57b032 2009-01-27)
Languages:
- English
- Japanese
- Spanish
- Polish
There is a desire to translate into the Great and the Mighty?
Welcome to www.getlocalization.com/gitblit
Screenshots: gitblit.com/screenshots.html
Demo server: demo-gitblit.rhcloud.com
Now let's get to practice
Installation
Register on 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.
For me, for example, like this:
git clone ssh://461e96291a2d2fb96b4423a0a329c7@habr-dark008.rhcloud.com/~/git/habr.git/
Go to the application folder:
cd habr/
We clear the folder from the standard stub:
rm -R *
Download gitblit:
wget https://gitblit.googlecode.com/files/express-1.1.0.zip
Unzip to the habr folder and delete the archive:
unzip express-1.1.0.zip && rm express-1.1.0.zip
We set up the configuration to the address: habr / deployments / ROOT.war / the WEB-INF / the web.xml
sets the value to true :
web.enableRpcManagement
web.enableRpcAdministration
And web.forwardSlashCharacter on !
As a sensible paranoid, we redirect all traffic through https.
We create the jboss-web.xml file in the same folder (WEB-INF) with the following contents:
jboss-web-policy org.jboss.web.rewrite.RewriteValve
We create the rewrite.properties file 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 setup of the server side.
Fill the data on the server, performing sacred:
git add .
git commit -m 'Init git server'
git push
Now the last step of the setup
Download the manager for remote gitblit administration: gitblit.googlecode.com/files/manager-1.1.0.zip We
connect to our server habr-dark008.rhcloud.com, the username and password are standard: admin, admin.
It is only necessary to change the administrator password, the remaining settings are at your discretion.
The server can also be configured via the web interface, but the author advises using a manager: it has more settings, fewer glitches.
More fine-tuning: gitblit.com/setup.html
References
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.