3

使用 Gogs 轻松搭建可能比 GitLab 更好用的 Git 服务平台

 2 years ago
source link: https://wsgzao.github.io/post/gogs/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
使用 Gogs 轻松搭建可能比 GitLab 更好用的 Git 服务平台

GitHub 已经成为首选的代码托管平台,因为它又很多很棒的功能,操作简单,几乎所有的开发者都喜欢它。但是搭建 GitLab 过程并没有想象中的简单,利用 Bitnami 当然也是一种偷懒的好选择。Gogs (Go Git Service) 是一款极易搭建的自助 Git 服务,Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自助 Git 服务。使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 所有平台,包括 Linux、Mac OS X、Windows 以及 ARM 平台。

Gogs 可能是比 GitLab 更好的选择

2016 年 03 月 31 日 - 初稿

阅读原文 - https://wsgzao.github.io/post/gogs/

扩展阅读

Gogs - https://gogs.io/
GitLab - https://about.gitlab.com/
Bitnami GitLab Stack - https://bitnami.com/stack/gitlab

Bitnami GitLab Stack

Bitnami GitLab Stack ships with the following software versions

  • GitLab 8.5.7
  • Apache 2.4.18
  • ImageMagick 6.7.5
  • PostgreSQL 9.4.6
  • Git 2.7.4
  • Ruby 2.1.8
  • Rails 4.2.5.1
  • RubyGems 1.8.12

Btinami GitLab Stack 安装真心简单,爽

chmod 755 bitnami-gitlab-8.5.7-0-linux.run

https://bitnami.com/stack/gitlab/README.txt

Gogs 功能特性

  • 支持活动时间线
  • 支持 SSH 以及 HTTP/HTTPS 协议
  • 支持 SMTP、LDAP 和反向代理的用户认证
  • 支持反向代理子路径
  • 支持用户、组织和仓库管理系统
  • 支持仓库和组织级别 Web 钩子(包括 Slack 集成)
  • 支持仓库 Git 钩子和部署密钥
  • 支持仓库工单(Issue)、合并请求(Pull Request)和 Wiki
  • 支持添加和删除仓库协作者
  • 支持 Gravatar 以及自定义源
  • 支持邮件服务
  • 支持后台管理面板
  • 支持 MySQL、PostgreSQL、SQLite3 和 TiDB(实验性支持) 数据库
  • 支持多语言本地化(15 种语言)

以 GitHub 作为参考比较对象

特性 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

Gogs 环境要求

我以 rhel6.3 为例,已经属于生命周期边缘了

# 安装 git
yum install -y git
git --version
git version 1.7.1

# 安装 mysql-server
yum install -y mysql-server
mysql --version
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

# 启动数据库
service mysqld start
chkconfig mysqld on

# 创建 gogs 数据库
cd /home/git/gogs/scripts
#mysql -u root -p < mysql.sql
mysql -u root -p
# (输入密码,无密码直接跳过)
set global storage_engine = 'InnoDB';
create database gogs character set utf8 collate utf8_bin;
create user 'gogs'@'localhost' identified by 'gogs';
grant all privileges on gogs.* to 'gogs'@'localhost';
flush privileges;
exit;

部署 Gogs

Gogs 是一款极易搭建的自助 Git 服务

https://gogs.io/docs

# 创建 git 用户 
sudo adduser git
su - git

# 解压 gogs
cd /home/git
unzip gogs_v0.9.13_linux_amd64.zip
ls /home/git/gogs/
gogs LICENSE public README.md README_ZH.md scripts templates

# 启动 gogs
cd /home/git/gogs
./gogs web

2016/03/31 16:23:53 [W] Custom config '/home/git/gogs/custom/conf/app.ini' not found, ignore this if you're running first time
2016/03/31 16:23:53 [T] Custom path: /home/git/gogs/custom
2016/03/31 16:23:53 [T] Log path: /home/git/gogs/log
2016/03/31 16:23:53 [I] Gogs: Go Git Service 0.9.13.0318
2016/03/31 16:23:53 [I] Log Mode: Console(Trace)
2016/03/31 16:23:53 [I] Cache Service Enabled
2016/03/31 16:23:53 [I] Session Service Enabled
2016/03/31 16:23:53 [I] SQLite3 Supported
2016/03/31 16:23:53 [I] Run Mode: Development
2016/03/31 16:23:54 [I] Listen: http://0.0.0.0:3000

# 后台运行
nohup ./gogs web &
tail -f nohup.out

app.ini 配置文件

注意 DOMAIN 和 ROOT_URL 这两个参数

https://gogs.io/docs/advanced/configuration_cheat_sheet

# 首次安装可以打开浏览器完成剩余配置 
http://ip:3000/install

# 通过修改 app.ini 也可以
vi /home/git/gogs/custom/conf/app.ini

APP_NAME = Gogs: Go Git Service
RUN_USER = git
RUN_MODE = prod

[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gogs
USER = gogs
PASSWD = gogs
SSL_MODE = disable
PATH = data/gogs.db

[repository]
ROOT = /home/git/gogs-repositories

[server]
DOMAIN = 172.28.70.134
HTTP_PORT = 3000
ROOT_URL = http://172.28.70.134:3000/
DISABLE_SSH = false
SSH_PORT = 22
OFFLINE_MODE = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ENABLE_CAPTCHA = true
REQUIRE_SIGNIN_VIEW = false

[picture]
DISABLE_GRAVATAR = false

[session]
PROVIDER = file

[log]
MODE = file
LEVEL = Info
ROOT_PATH = /home/git/gogs/log

[security]
INSTALL_LOCK = true
SECRET_KEY = i4B7R55aRaFdw8j

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK