gitlab6 配置的几个问题说明
gitlab6 配置的几个问题说明
按照gitlab的网站的详细步骤,终于把gitlab 6.1 stable安装到2台虚拟机上了。由于gitlab6运行于虚拟机上,所以配置这个虚拟机的hostname与提供最终对外服务的机器的hostname一致,可以减少很多不必要的麻烦,例如我的对外服务的host为www.cheungmine.org,则我的gitlab6的虚拟机的hostname也为www.cheungmine.org。本文中为:vm-gitlab。
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md
但是随之而来的问题一堆一堆的。首先是我的架构是一台有固定IP的物理主机A作为唯一入口点,子网中的2台虚拟机B,C提供gitlab服务。B与C是通过A的网桥通过NAT外部联网,A与B中间用nginx联系,之间走https协议。A对外的服务也是nginx。参考:
http://blog.csdn.net/cheungmine/article/details/12340297
clients......https......A(nginx) <=https=> [ B(nginx) <-> C(mysqldb) ]
1)每次克隆代码都需要输入用户名和密码问题的解决
这样的结构就导致ssh协议不能用。也就是下面的语句失效:
$ git clone git@vm-gitlab:zhangliang/abc.git
因为对于用户电脑clients,只能看到主机A。但是下面的语句可用:
$ git clone https://vm-gitlab/zhangliang/abc.git
但是每次都提示输出用户名和密码。这个可以在用户的电脑(Ubuntu)上,修改~/.netrc:
machine code.google.com login cheungmine@gmail.com password wK6xZwgxfuZ2
machine vm-gitlab login zhangliang password a3B6TdfH
把红色部分更改为你的配置。
用户还需要把类似下面的条目加入到/etc/hosts中。这样方便每次访问:https://vm-gitlab。否则只能用IP地址访问。
192.168.1.8 vm-gitlab
2)qq邮箱不能收到gitlab发的邮件的问题解决
默认配置后, qq邮箱不能收到gitlab发的邮件,而gmail的可以。这个需要更改qq邮箱的设置。进入qq邮箱,按设置,反垃圾,设置邮件地址白名单,把gitlab@vm-gitlab.com加入到白名里。也可以把vm-gitlab.com加入到域名的白名单里。qq就不拦截邮件了。
3)设置https后,证书校验问题的解决
$ git clone https://vm-gitlab/zhangliang/abc.git
报错:
fatal: Unable to find remote helper for 'https'
原因是git没装好。按下面的步骤重装git,第1行尤其重要:
$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential $ wget https://git-core.googlecode.com/files/git-1.8.1.2.tar.gz $ tar -zxf git-1.8.1.2.tar.gz $ cd git-1.8.1.2 $ make prefix=/usr/local all $ sudo make prefix=/usr/local install
$ git clone https://vm-gitlab/zhangliang/abc.git
报错,说证书校验有问题:
error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
最简单的解决方法是调用前加一个环境变量:
$ export GIT_SSL_NO_VERIFY=1
$ git clone https://vm-gitlab/zhangliang/abc.git
但是这个方法肯定不方便,更好的方法是:
$ git config --global http.sslverify false
4)关于生成ssl证书的问题
既然我在A和B都设置成了https访问,所以需要在A和B上都生成ssl证书: ssl.key, ssl.crt。都放在/etc/nginx/sites-available下面(A和B都安装了nginx)。下面以 A 为例说明证书的生成过程。B的过程也是一样的。
Linux 通过openssl命令生成证书: $ cd /etc/nginx/sites-available/ 首先执行如下命令生成一个key $ sudo openssl genrsa -des3 -out ssl.key 1024 然后他会要求你输入这个key文件的密码。不推荐输入。因为以后要给nginx使用。每次reload nginx配置时候都要你验证这个PAM密码的。 由于生成时候必须输入密码。你可以输入后1234, 再删掉。 $ sudo mv ssl.key xxx.key $ sudo openssl rsa -in xxx.key -out ssl.key 输入1234 $ sudo rm xxx.key 然后根据这个key文件生成证书请求文件: $ sudo openssl req -new -key ssl.key -out ssl.csr 以上命令生成时候要填很多东西 一个个看着写吧(可以随便,毕竟这是自己生成的证书) 最后根据这2个文件生成crt证书文件: $ sudo openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt 这里365是证书有效期。这个大家随意。最后使用到的文件是key和crt文件。 如果需要用pfx 可以用以下命令生成: $ sudo openssl pkcs12 -export -inkey ssl.key -in ssl.crt -out ssl.pfx
5) git push 的错误解决
411错误:
error: RPC failed; result=22, HTTP code = 411 fatal: The remote end hung up unexpectedly Writing objects: 100% (1967/1967), 1.99 MiB | 3.61 MiB/s, done. Total 1967 (delta 183), reused 0 (delta 0) fatal: The remote end hung up unexpectedly Everything up-to-date
解决办法:
$ git config http.postBuffer 100m
413错误:
error: RPC failed; result=22, HTTP code = 413 fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date
解决办法:
在所有 /etc/nginx/nginx.conf 文件中加入下面这句:
client_max_body_size 50m;
然后重启nginx服务:
$ sudo /etc/init.d/nginx restart
6) A上的nginx配置文件 /etc/nginx/sites-available/gitlab-ssl
# GITLAB-SSL
# Maintainer: @randx
# App Version: 5.0
#upstream gitlab {
# server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
#}
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/sites-available/ssl.crt;
ssl_certificate_key /etc/nginx/sites-available/ssl.key;
ssl_session_timeout 10m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
##listen 80; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
#server_name vm-gitlab; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass https://192.168.122.24;
}
}
7) B(192.168.122.24)上的nginx配置文件 /etc/nginx/sites-available/gitlab-ssl
# GITLAB-SSL
# Maintainer: @randx
# App Version: 5.0
upstream gitlab-ssl {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen *:443 default_server;
ssl on;
ssl_certificate /etc/nginx/sites-available/ssl.crt;
ssl_certificate_key /etc/nginx/sites-available/ssl.key;
ssl_session_timeout 10m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
##listen 80; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name 192.168.122.24 vm-gitlab; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://gitlab-ssl;
}
}
8) B(192.168.122.24)上的gitlab配置文件(前面部分):
# # # # # # # # # # # # # # # # # #
# GitLab application config file #
# # # # # # # # # # # # # # # # # #
#
# How to use:
# 1. copy file as gitlab.yml
# 2. Replace gitlab -> host with your domain
# 3. Replace gitlab -> email_from
production: &base
#
# 1. GitLab app settings
# ==========================
## GitLab settings
gitlab:
## Web server settings
host: vm-gitlab
port: 80
https: true
# Uncomment and customize the last line to run in a non-root path
# WARNING: This feature is no longer supported
# Note that three settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT']
#
# relative_url_root: /gitlab
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
# user: git
## Email settings
# Email address used in the "From" field in mails sent by GitLab
##email_from: gitlab@vm-gitlab
email_from: gitlab@vm-gitlab.com
# Email address of your support contact (default: same as email_from)
##support_email: support@vm-gitlab
support_email: support@vm-gitlab.com
## User settings
default_projects_limit: 10
# default_can_create_group: false # default: true
# username_changing_enabled: false # default: true - User can change her username/namespace
......
gitlab6 配置的几个问题说明的更多相关文章
- gitlab6 nginx配置和启动脚本
gitlab6 nginx配置和启动脚本 cheungmine 2013-10 最近把gitlab安装到了ubuntu12.04.3的虚拟机上了.参考: https://github.com/gitl ...
- Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】
摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ...
- gitlab配置邮件通知
配置用户提交评论.添加issue等的邮件通知: Gitlab邮件提醒方便跟踪项目进度,在这里介绍两种方式,一种是用系统的sendmail发送邮件,另一种是GMAIL的stmp来发送邮件 第一种 用系统 ...
- 配置android sdk 环境
1:下载adnroid sdk安装包 官方下载地址无法打开,没有vpn,使用下面这个地址下载,地址:http://www.android-studio.org/
- Android Studio配置 AndroidAnnotations——Hi_博客 Android App 开发笔记
以前用Eclicps 用习惯了现在 想学学 用Android Studio 两天的钻研终于 在我电脑上装了一个Android Studio 并完成了AndroidAnnotations 的配置. An ...
- react-router 组件式配置与对象式配置小区别
1. react-router 对象式配置 和 组件式配置 组件式配置(Redirect) ----对应---- 对象式配置(onEnter钩子) IndexRedirect -----对应-- ...
- 总结:Mac前端开发环境的搭建(配置)
新年新气象,在2016年的第一天,我入手了人生中第一台自己的电脑(大一时好友赠送的电脑在一次无意中烧坏了主板,此后便不断借用别人的或者网站的).macbook air,身上已无分文...接下来半年的房 ...
- Android Studio 多个编译环境配置 多渠道打包 APK输出配置
看完这篇你学到什么: 熟悉gradle的构建配置 熟悉代码构建环境的目录结构,你知道的不仅仅是只有src/main 开发.生成环境等等环境可以任意切换打包 多渠道打包 APK输出文件配置 需求 一般我 ...
- Virtual Box配置CentOS7网络(图文教程)
之前很多次安装CentOS7虚拟机,每次配置网络在网上找教程,今天总结一下,全图文配置,方便以后查看. Virtual Box可选的网络接入方式包括: NAT 网络地址转换模式(NAT,Network ...
随机推荐
- TortiseGit 添加SSH-Key
TortoiseGit 使用扩展名为ppk的密钥,而不是ssh-keygen生成的rsa密钥.使用命令ssh-keygen -C "邮箱地址" -t rsa产生的密钥在Tortoi ...
- JavaScript正则表达式模式匹配(4)——使用exec返回数组、捕获性分组和非捕获性分组、嵌套分组
使用exec返回数组 var pattern=/^[a-z]+\s[0-9]{4}$/; var str='google 2012'; alert(pattern.exec(str)); //返回一个 ...
- electron应用以管理员权限启动
最近在用electron开发PC桌面应用,其中有个需求就是整个应用以管理员权限启动.很头痛,各种google,baidu. 最后终于解决了,可以分为三个步骤,做个总结分享. 一.如果没有manifes ...
- 如何搭建lamp(CentOS7+Apache+MySQL+PHP)环境
我的环境:虚拟机是:VMware-workstation-full-8.0.0-471780.exe:Linux系统用的是:CentOS-7-x86_64-Minimal-1503-01.ios;(阿 ...
- admin的配置
当我们访问http://127.0.0.1:8080/admin/时,会出现: 执行命令: 生成同步数据库的脚本:python manage.py makemigrations ...
- windows curl命令详解
概述 Curl命令可以通过命令行的方式,执行Http请求.在Elasticsearch中有使用的场景,因此这里研究下如何在windows下执行curl命令. 软件下载 下载地址:https://cur ...
- 两个无序数组分别叫A和B,长度分别是m和n,求中位数,要求时间复杂度O(m+n),空间复杂度O(1) 。
#include <iostream> using namespace std; /*函数作用:取待排序序列中low.mid.high三个位置上数据,选取他们中间的那个数据作为枢轴*/ i ...
- named let 递归和闭包的利器
named let和递归,闭包联系十分密切.而且还是提高性能的重要手段.先来看一个make-list函数的模拟,最原始的写法大概是: (define (imake-list n member) ( n ...
- ORACLE EBS 表空间控制
--1G=1024MB --1M=1024KB --1K=1024Bytes --1M=11048576Bytes --1G=1024*11048576Bytes=11313741824Bytes S ...
- 全文检索Lucene (2)
接着全文检索Lucene (1) . 下面我们来深入的研究一下,如何使用Lucene! 从全文检索Lucene (1)中我们可以看出,Lucene就好比一个双向的工作流,一方面是对索引库的维护,另一方 ...