Gogs: Probably a better choice than Gitlab.

Source: Internet
Author: User
Tags ldap hosting ssh server git hooks docker run
This is a creation in Article, where the information may have evolved or changed.

Gitlab is a great git hosting service, almost as powerful as GitHub. But are there any projects that can rival Gitlab/github but operate more easily? I think Gogs is a good choice.

Brief introduction

Now, GitHub has become the preferred code hosting platform. Because it's a lot of great features, it's easy to operate, and almost all developers like it.

Meanwhile, Google's code hosting project is ready to close and you can move the project here.

But what if you're writing an Android app, or are creating the next great iOS game, or don't want someone to see your code?

Of course you can buy a private GitHub library, but you're definitely more interested in investing money in more pressing things.

This is the reason why software such as Gitlab and Gogs is born.

The services they offer are very similar to GitHub, and the difference is that you can put the project on your own server or even on your own workstation.

Here's a more in-depth look.

Gitlab

Gitlab is a powerful git service that has the same basic features as the rival GitHub. This is a mature project and is constantly being updated.

They recently acquired Gitorius (another GitHub-like service), so features are expected to be expanded (see news clips about acquisitions).

It used to be manually installed, it was time consuming, and there were many problems. The recent installation process has improved.

The installation package for Linux deb/rpm is now available (called omnibus), which solves all dependencies and simplifies the installation process.

Upgrading is a complex thing, especially from an earlier version to the latest edition, but it's not that complicated.

However, you can feel that a lot of things are done in the background. You can run Sidekiq, Unicorn, Nginx, Ruby (including gems) and Gitlab itself.

Custom installation is not so simple, there are many uncertainties, if anything goes wrong, you have to troubleshoot.

Input binary Package

Now, we have the gogs. All you have to do is run one binary package.

It is written in the go language and can be compatible with every system.

It can run on windows,mac,linux,arm and so on.

You only need to extract the compressed package to the selected folder when you install it. That's it. The same is true for upgrades: just unzip the package.

This is the beauty of the binary development of the Go language, which you can easily develop under multiple platforms.

Gogs consumes less resources, so it is easy to run on system resources (it can run at Raspberry Pi).

You can run with the default configuration, or make some minor tweaks.

The default configuration file is located in the installation folder, and the /conf/app.ini document recommends that you write the custom configuration so that the /custom/conf/app.ini upgrade does not overwrite the configuration.

There are three things that can be customized:

    • Location of the Library

      [repository]ROOT = !! 库的地址 !!
    • Database location

      [database]PATH = !! 数据库地址 !!
    • Public

Note: Currently, you need to run an SSH server (OpenSSH is also good), which is the same as Gitlab.

Comparison

Let's compare these two products. I'll take GitHub as a reference.

features Gogs Gitlab Github
Dashboard & File Browser Y Y Y
Issue Tracking, Milestones & Commit Keywords Y Y Y
Organizations support N Y Y
Wiki N Y Y
Code Review N Y Y
Code Snippets N Y Y
Web Hooks Y Y Y
Git Hooks Y * Enterprise * Enterprise
LDAP Login Y Y Y
LDAP Group Sync N * Enterprise * Enterprise
Branded Login Page N * Enterprise * Enterprise
Language Go Ruby Ruby
Platform Cross-platform Linux * Virtual Machine
License MIT MIT Proprietary
Resource Usage Low Medium/high Medium/high

Code review (pull request) can be said to be the most important feature of the missing. This is Gogs's primary problem in GitHub issues, and the main developer of Gogs is trying to develop it.

But all in all, it's a feature-rich, private git hosting service.

Run a gogs Docker

I used to describe how I docker my server environment, so I'll also run Gogs as a Docker container

Let's do it one step at a pace.

Suppose I have an application file at the root of my server /home/kayak/apps and create subdirectories for each application that is a Docker container.

Download and unzip the latest version of Gogs.

$ cd /home/kayak/apps$ wget http://gogs.dn.qbox.me/gogs_v0.5.13_linux_amd64.zip$ unzip gogs_v0.5.13_linux_amd64.zip$ rm gogs_v0.5.13_linux_amd64.zip

Custom Configuration

this is the location where you want to keep the repositories !![database]PATH = !! this is the location of your database (sqlite3 by default) !!

Note: You can also run directly without gogs as a Docker container.

Now let's create Dockerfile

$ cd /home/kayak/apps/gogs$ nano DockerfileFROM ubuntu:14.04ENV DEBIAN_FRONTEND noninteractiveRUN sed 's/main$/main universe multiverse/' -i /etc/apt/sources.list && \    update && apt-mark hold initscripts && \    apt-get install -y sudo openssh-server git && \ apt-get cleanEXPOSE 22 3000RUN addgroup --gid 501 kayak && adduser --uid 501 --gid 501 --disabled-password --gecos 'kayak' kayak && adduser kayak sudoWORKDIR /home/kayakENV HOME /home/kayakENTRYPOINT ["/home/kayak/boot"]

Dockerfile is based on the latest Ubuntu Lts Edition Server (14.04).

Then install sudo, openssh and git, exposing Port 22 (for SSH) and 3000 (to Gogs's web interface).

In addition, I usually create a user (here with kayak), which has the same uid/gid as my max box user to prevent access issues.

Finally, start the shell script to run.

$ touch boot$ chmod +x boot$ nano boot#!/bin/bashsudo -u kayak -H touch /home/kayak/.ssh/authorized_keyschmod 700 /home/kayak/.ssh && chmod 600 /home/kayak/.ssh/authorized_keys# start openssh servermkdir /var/run/sshd/usr/sbin/sshd -D &exec sudo -u kayak /home/kayak/gogs web

This runs the SSH daemon and gogs. It is now run as a kayak user, which is better than the default root user.

Create a mirror

$ cd /home/kayak/apps/gogs$ docker build --rm -t apertoire/gogs .

The image is set up and ready to run.

$ docker run -d --name gogs \-v /etc/localtime:/etc/localtime:ro \-v /home/kayak/apps/gogs:/home/kayak \-p 62723:22 \-p 3000:3000 \apertoire/gogs

You can view the run condition at the command line.

You can now open the Web interface, which displays an installation page (first run).

After the installation is complete, the good one feature-rich gogs is built.

Summarize

Gogs is a lightweight, easy-to-set, cross-platform git hosting service that is not inferior to Gitlab and GitHub.

Although it is no more mature than the two, it has great potential.

It is open source, so you can help improve it.

I used gogs to replace Gitlab for a few months and felt good.

I created 42 libraries and I felt that it was very good performance.

I definitely recommend Gogs as your git self-hosting service.

4 developers attached to the project on GitHub:

No smell UNK Nwon Liu Peng lunny Xiao Fu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.