docs(platform): add

This commit is contained in:
zjkjzj
2021-03-19 12:00:46 +08:00
parent 94ae562830
commit 5b0902542d
19 changed files with 405 additions and 344 deletions

View File

@@ -1,91 +0,0 @@
# GitLab导致8080端口冲突
## 问题复现
安装完`GitLab`后,修改配置文件`/etc/gitlab/gitlab.rb`
```
##external_url 'http://gitlab.example.com'
external_url 'http://localhost:8800'
```
本以为这样就能修改`GitLab`端口号为`8800`了,没想到再次登录`8080`仍旧出现了`GitLab`页面
![](./imgs/8080.png)
## 问题解析
查询哪个程序监听了`8080`端口
```
# netstat -lnp | grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 26436/config.ru
```
查询相应的进程
```
# netstat -lnp | grep 26436
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 26436/config.ru
unix 2 [ ACC ] STREAM LISTENING 343538 26436/config.ru /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
```
仍然是`GitLab`在监听`8080`端口,参考[gitlab 8.13 80 8080端口冲突问题](https://blog.csdn.net/vbaspdelphi/article/details/52979836),查看配置文件`unicorn.rb`
```
# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.
# What ports/sockets to listen on, and what options for them.
listen "127.0.0.1:8080", :tcp_nopush => true
```
默认情况下`unicorn`同样监听`8080`端口,查询`/etc/gitlab/gitlab.rb`中相应的设置
```
# cat gitlab.rb | grep unicorn
#unicorn['port'] = 8800
```
## 解决方案
需要在`gitlab.rb`上同时修改`unicorn`监听端口号,修改配置文件`/etc/gitlab/gitlab.rb`如下
```
##external_url 'http://gitlab.example.com'
external_url 'http://localhost:8800'
unicorn['port'] = 8801
```
重新启动`GitLab`
```
# gitlab-ctl reconfigure
# gitlab-ctl restart
```
查询配置文件`/var/opt/gitlab/gitlab-rails/etc/unicorn.rb`
```
# cat unicorn.rb | grep listen
# What ports/sockets to listen on, and what options for them.
listen "127.0.0.1:8801", :tcp_nopush => true
```
测试端口号
```
$ curl localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused
$ curl localhost:8800
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
...
...
# curl localhost:8801
<html><body>You are being <a href="http://localhost:8801/users/sign_in">redirected</a>.</body></html>
```

View File

@@ -1,24 +0,0 @@
# Prometheus吃磁盘空间
在云服务器上部署`Gitlab`,今天发现无法登录了。登上云服务器后发现磁盘容量没有了,通过查找发现`Prometheus`目录下占据了`30GB`的空间(总共`50GB`
参考:
[Monitoring GitLab with Prometheus](https://docs.gitlab.com/ee/administration/monitoring/prometheus/)
[Prometheus eats disk space in /var/opt/gitlab/prometheus/data](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4166)
[GitLab 官方镜像内部集成 Prometheus 历史数据过大的问题处理](https://lakelight.net/2020/03/24/GitLab-Prometheus-clean.html)
`Prometheus`是一个监控服务,会保存历史监控数据,下面尝试关闭该服务并删除之前的数据(在`Docker Gitlab`上操作)
1. 修改配置文件`/srv/gitlab/config/gitlab.rb`,添加
```
prometheus_monitoring['enable'] = false
```
2. 关闭`gitlab`并删除`/srv/gitlab/data/prometheus`文件夹数据
3. 重启`gitlab`,问题解决

View File

@@ -1,9 +1,7 @@
# [github][gitee]SSH公钥设置
# SSH公钥设置
## [github]公钥设置
参考:[Adding a new SSH key to your GitHub account](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/)
## Github公钥设置
登录`github`,进入个人主页,选择`Settings->SSH and GPG keys->New SSH key`
@@ -16,19 +14,11 @@
### 密钥失效
参考:[About SSH](https://help.github.com/articles/about-ssh/)
If you haven't used your SSH key for a year, then GitHub will automatically delete your inactive SSH key as a security precaution. For more information, see "Deleted or missing SSH keys."
`github`规定自动删除一年内未使用的`SSH`密钥
[Github About SSH](https://help.github.com/articles/about-ssh/)规定自动删除一年内未使用的`SSH`密钥
## [gitee]公钥设置
参考:
[公钥管理](https://gitee.com/help/articles/4180)
[SSH 公钥设置](https://gitee.com/help/articles/4191#article-header0)
## Gitee公钥设置
码云可以在个人主页上设置公钥,也可以在个人仓库上设置公钥,这两个地方的读写权限不一致
@@ -46,8 +36,6 @@
## 测试
参考:[Testing your SSH connection](https://help.github.com/articles/testing-your-ssh-connection/)
`github`上设置好公钥之后
SSH
@@ -67,4 +55,11 @@
$ git clone git@github.com:zjZSTU/git-guide.git
这一次会要求你输入设置好的密码(`passphrase`),之后的拉取代码操作都可以自动认证完成
这一次会要求你输入设置好的密码(`passphrase`),之后的拉取代码操作都可以自动认证完成
## 相关阅读
* [GitHub Adding a new SSH key to your GitHub account](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/)
* [GitHub Testing your SSH connection](https://help.github.com/articles/testing-your-ssh-connection/)
* [Gitee 公钥管理](https://gitee.com/help/articles/4180)
* [Gitee SSH 公钥设置](https://gitee.com/help/articles/4191#article-header0)

View File

@@ -1,18 +0,0 @@
# [GitLab][Webhook]不允许本地连接
`gitlab`仓库中设置`Webhook`,使用本地连接出现如下错误:
```
Url is blocked: Requests to the local network are not allowed
```
参考:[gitlab使用webhook向jenkins发送请求报错 Requests to the local network are not allowed](https://blog.csdn.net/xukangkang1hao/article/details/80756085)
登录`root`账户,点击`Configure Gitlab`选项
![](./imgs/configure-gitlab.png)
进入`Settings -> Network`,展开`Outbound requests`,选中`Allow requests to the local network from web hooks and services`
![](./imgs/allow-local-request.png)

View File

@@ -1,16 +0,0 @@
# [GitLab]受保护分支
强制上传代码到`Gitlab`仓库的`dev`分支出错,提示如下:
```
GitLab: You are not allowed to force push code to a protected branch on this project
```
参考:[解决 GitLab: You are not allowed to force push code to a protected branch on this project问题](https://blog.csdn.net/mqdxiaoxiao/article/details/95794053)
是由于分支保护的原因,需要进入仓库`setting -> Repository -> Protected Branches`
![](./imgs/protected-branches.png)
允许`dev`分支能够强制推送

View File

@@ -1,26 +0,0 @@
# Access deined: You do not have permission push to this repository
在gitee上新建了一个账户在上面新建一个仓库将其ssh链接设置到本地已存在的仓库上想要把本地仓库推送到远程仓库出现如下错误
```
$ git push origin master
Access deined: You do not have permission push to this repository
fatal: 无法读取远程仓库。
请确认您有正确的访问权限并且仓库存在。
```
其原因在于本地新建了两个`ssh`密钥,设置在`gitee`的不同账户上ssh使用之前的密钥读取gitee远程仓库导致出错。参考[如何使用特定的SSH Key提交GIT](https://www.jianshu.com/p/82aa1678411e)
`~/.ssh/config`文件上添加如下内容
```
Host gitee.com
HostName gitee.com
User git
IdentityFile 私钥文件路径
IdentitiesOnly yes
```
重新提交即可

319
docs/platform/error.md Normal file
View File

@@ -0,0 +1,319 @@
# ERROR
## 问题一GitLab容器一直重启
使用`docker logs`命令查询
```
$ docker log CONTAINER_ID
...
...
System Info:
------------
chef_version=14.13.11
platform=ubuntu
platform_version=16.04
ruby=ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/chef-client
executable=/opt/gitlab/embedded/bin/chef-client
Running handlers:
There was an error running gitlab-ctl reconfigure:
/etc/gitlab/gitlab.rb:1: unexpected fraction part after numeric literal
external_url = 192.168.0.144:7002
^~~~~~~
/etc/gitlab/gitlab.rb:1: syntax error, unexpected tINTEGER, expecting end-of-input
external_url = 192.168.0.144:7002
^~~
Running handlers complete
Chef Client failed. 0 resources updated in 01 seconds
```
发现是`external_url`配置失误导致。解决方法如下:
1. 停止`gitlab`容器
2. 修改配置文件(在主机中)`/srv/gitlab/config/gitlab.rb`
3. 重新启动容器
## 问题二GitLab导致8080端口冲突
### 问题复现
安装完`GitLab`后,修改配置文件`/etc/gitlab/gitlab.rb`
```
##external_url 'http://gitlab.example.com'
external_url 'http://localhost:8800'
```
本以为这样就能修改`GitLab`端口号为`8800`了,没想到再次登录`8080`仍旧出现了`GitLab`页面
![](./imgs/8080.png)
### 问题解析
查询哪个程序监听了`8080`端口
```
# netstat -lnp | grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 26436/config.ru
```
查询相应的进程
```
# netstat -lnp | grep 26436
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 26436/config.ru
unix 2 [ ACC ] STREAM LISTENING 343538 26436/config.ru /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
```
仍然是`GitLab`在监听`8080`端口,参考[gitlab 8.13 80 8080端口冲突问题](https://blog.csdn.net/vbaspdelphi/article/details/52979836),查看配置文件`unicorn.rb`
```
# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.
# What ports/sockets to listen on, and what options for them.
listen "127.0.0.1:8080", :tcp_nopush => true
```
默认情况下`unicorn`同样监听`8080`端口,查询`/etc/gitlab/gitlab.rb`中相应的设置
```
# cat gitlab.rb | grep unicorn
#unicorn['port'] = 8800
```
### 解决方案
需要在`gitlab.rb`上同时修改`unicorn`监听端口号,修改配置文件`/etc/gitlab/gitlab.rb`如下
```
##external_url 'http://gitlab.example.com'
external_url 'http://localhost:8800'
unicorn['port'] = 8801
```
重新启动`GitLab`
```
# gitlab-ctl reconfigure
# gitlab-ctl restart
```
查询配置文件`/var/opt/gitlab/gitlab-rails/etc/unicorn.rb`
```
# cat unicorn.rb | grep listen
# What ports/sockets to listen on, and what options for them.
listen "127.0.0.1:8801", :tcp_nopush => true
```
测试端口号
```
$ curl localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused
$ curl localhost:8800
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
...
...
# curl localhost:8801
<html><body>You are being <a href="http://localhost:8801/users/sign_in">redirected</a>.</body></html>
```
## 问题三: [GitLab][Webhook]不允许本地连接
`gitlab`仓库中设置`Webhook`,使用本地连接出现如下错误:
```
Url is blocked: Requests to the local network are not allowed
```
参考:[gitlab使用webhook向jenkins发送请求报错 Requests to the local network are not allowed](https://blog.csdn.net/xukangkang1hao/article/details/80756085)
登录`root`账户,点击`Configure Gitlab`选项
![](./imgs/configure-gitlab.png)
进入`Settings -> Network`,展开`Outbound requests`,选中`Allow requests to the local network from web hooks and services`
![](./imgs/allow-local-request.png)
## 问题四GitLab: You are not allowed to force push code to a protected branch on this project
强制上传代码到`Gitlab`仓库的`dev`分支出错,提示如下:
```
GitLab: You are not allowed to force push code to a protected branch on this project
```
参考:[解决 GitLab: You are not allowed to force push code to a protected branch on this project问题](https://blog.csdn.net/mqdxiaoxiao/article/details/95794053)
是由于分支保护的原因,需要进入仓库`setting -> Repository -> Protected Branches`
![](./imgs/protected-branches.png)
允许`dev`分支能够强制推送
## 问题五unicorn出错
### 问题描述
通过`docker`部署`gitlab`一段时间后,突然出现`502`错误
查看容器状态,显示不健康
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
89481faa2ed1 gitlab/gitlab-ce:latest "/assets/wrapper" 2 weeks ago Up 7 hours (unhealthy)
```
浏览容器日志,发现如下错误:
```
==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)
==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:460 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid='
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/bin/unicorn:126:in `<top (required)>'
/opt/gitlab/embedded/bin/unicorn:23:in `load'
/opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'
==> /var/log/gitlab/unicorn/current <==
2019-12-18_12:27:47.34406 failed to start a new unicorn master
2019-12-18_12:27:47.35882 starting new unicorn master
2019-12-18_12:27:47.91735 master failed to start, check stderr log for details
```
### 问题解析
看样子是`unicorn`的问题,参考:
[gitlab服务器502恢复过程](https://blog.csdn.net/zhouchuan152/article/details/95871798)
[gitlab docker Web界面打开反应迟钝的解决办法](https://blog.csdn.net/happyfreeangel/article/details/88653846)
进入容器内部,查看`unicorn`状态
```
$ docker exec -it xxxx bash
# gitlab-ctl tail unicorn
```
发现每次`unicorn`显示的`PID`都不同,修改`/etc/gitlab/gitlab.rb`,添加
```
unicorn['listen'] = 'localhost'
unicorn['port'] = 8999
```
更新并重启后,`gitlab`服务恢复正常
```
# gitlab-ctl reconfigure
# gitlab-ctl restart
```
## 问题六版本更新后database出错
### 问题描述
拉取了最新的`Docker Gitlab`镜像,部署时发现了如下错误:
```
gitlab | System Info:
gitlab | ------------
gitlab | chef_version=14.14.29
gitlab | platform=ubuntu
gitlab | platform_version=16.04
gitlab | ruby=ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
gitlab | program_name=/opt/gitlab/embedded/bin/chef-client
gitlab | executable=/opt/gitlab/embedded/bin/chef-client
gitlab |
gitlab |
gitlab | Running handlers:
gitlab | There was an error running gitlab-ctl reconfigure:
gitlab |
gitlab | bash[migrate gitlab-rails database] (gitlab::database_migrations line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
gitlab | ---- Begin output of "bash" "/tmp/chef-script20200618-23-sfpkhu" ----
gitlab | STDOUT: rake aborted!
gitlab | PG::ConnectionBad: could not connect to server: No such file or directory
gitlab | Is the server running locally and accepting
gitlab | connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
gitlab | /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:48:in `block (3 levels) in <top (required)>'
gitlab | /opt/gitlab/embedded/bin/bundle:23:in `load'
gitlab | /opt/gitlab/embedded/bin/bundle:23:in `<main>'
gitlab | Tasks: TOP => gitlab:db:configure
gitlab | (See full trace by running task with --trace)
gitlab | STDERR:
gitlab | ---- End output of "bash" "/tmp/chef-script20200618-23-sfpkhu" ----
gitlab | Ran "bash" "/tmp/chef-script20200618-23-sfpkhu" returned 1
```
### 问题解决
在网上查了一些资料,说是新旧版本的配置格式不一致,需要删除之前的配置数据。幸好在本地保存了之前使用的镜像,打包该镜像后上传到服务器重新加载即可
## 问题七Prometheus吃磁盘空间
在云服务器上部署`Gitlab`,今天发现无法登录了。登上云服务器后发现磁盘容量没有了,通过查找发现`Prometheus`目录下占据了`30GB`的空间(总共`50GB`
参考:
[Monitoring GitLab with Prometheus](https://docs.gitlab.com/ee/administration/monitoring/prometheus/)
[Prometheus eats disk space in /var/opt/gitlab/prometheus/data](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4166)
[GitLab 官方镜像内部集成 Prometheus 历史数据过大的问题处理](https://lakelight.net/2020/03/24/GitLab-Prometheus-clean.html)
`Prometheus`是一个监控服务,会保存历史监控数据,下面尝试关闭该服务并删除之前的数据(在`Docker Gitlab`上操作)
1. 修改配置文件`/srv/gitlab/config/gitlab.rb`,添加
```
prometheus_monitoring['enable'] = false
```
2. 关闭`gitlab`并删除`/srv/gitlab/data/prometheus`文件夹数据
3. 重启`gitlab`,问题解决
## 问题八Access deined: You do not have permission push to this repository
在gitee上新建了一个账户在上面新建一个仓库将其ssh链接设置到本地已存在的仓库上想要把本地仓库推送到远程仓库出现如下错误
```
$ git push origin master
Access deined: You do not have permission push to this repository
fatal: 无法读取远程仓库。
请确认您有正确的访问权限并且仓库存在。
```
其原因在于本地新建了两个`ssh`密钥,设置在`gitee`的不同账户上ssh使用之前的密钥读取gitee远程仓库导致出错。参考[如何使用特定的SSH Key提交GIT](https://www.jianshu.com/p/82aa1678411e)
`~/.ssh/config`文件上添加如下内容
```
Host gitee.com
HostName gitee.com
User git
IdentityFile 私钥文件路径
IdentitiesOnly yes
```
重新提交即可

View File

@@ -1,5 +1,5 @@
# [github]DNS加速
# DNS加速
## 加速原理
@@ -7,8 +7,6 @@
## 方式一
参考:[加快国内访问Github网站的速度](https://aoenian.github.io/2018/05/12/github-access-fast/)
登录[DNS查询](http://tool.chinaz.com/dns/?type=1&host=github.com&ip=)网站进行查询
![](./imgs/github-dns.png)
@@ -35,4 +33,9 @@ $ cat /etc/hosts
## 方式二(推荐)
配置公`DNS`参考[[Ubuntu 18.04][resolv.conf]公共DNS设置](https://zj-network-guide.readthedocs.io/zh_CN/latest/advanced/[Ubuntu%2018.04][resolv.conf]%E5%85%AC%E5%85%B1DNS%E8%AE%BE%E7%BD%AE/)
配置公`DNS`比如`DNSPod、阿里云DNS、Google DNS`
## 相关阅读
* [加快国内访问Github网站的速度](https://aoenian.github.io/2018/05/12/github-access-fast/)
* [[Ubuntu 18.04][resolv.conf]公共DNS设置](https://zj-network-guide.readthedocs.io/zh_CN/latest/advanced/[Ubuntu%2018.04][resolv.conf]%E5%85%AC%E5%85%B1DNS%E8%AE%BE%E7%BD%AE/)

View File

@@ -1,5 +1,5 @@
# [Github]主页美化
# 主页美化
看到有些人的主页有一些自定义的样式,在网上找了一些资料,主要修改两方面:
@@ -8,8 +8,6 @@
## 自定义README
参考:[Github 美化设置个人主页 ](https://www.cnblogs.com/Cl0ud/p/13764921.html)
创建一个同名仓库,即可启动`Github`隐藏功能:编辑这个仓库的`README`文件可以展示在公共`profile`
找到一些好用的工具和资料:
@@ -20,10 +18,10 @@
## 启动Activity View
参考:
在主页的`Contribution settings`下拉框中选中`Activity overview`选项即可
[Viewing contributions on your profile](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/viewing-contributions-on-your-profile)
## 相关阅读
[Showing an overview of your activity on your profile](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/showing-an-overview-of-your-activity-on-your-profile)
在主页的`Contribution settings`下拉框中选中`Activity overview`选项即可
* [Github 美化设置个人主页 ](https://www.cnblogs.com/Cl0ud/p/13764921.html)
* [Viewing contributions on your profile](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/viewing-contributions-on-your-profile)
* [Showing an overview of your activity on your profile](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/showing-an-overview-of-your-activity-on-your-profile)

View File

@@ -1,6 +1,8 @@
# [GitHub]版本发布
## 在线发布
之前通过本地进行版本标记,然后上传到`github`,在`release`页面能够查询到相应的版本。参考[标签设置](https://zj-git-guide.readthedocs.io/zh_CN/latest/basic/%E6%A0%87%E7%AD%BE%E8%AE%BE%E7%BD%AE.html)
![](./imgs/release/local-release.png)
@@ -9,4 +11,9 @@
![](./imgs/release/remote-release.png)
学习`GitHub`文档[About releases](https://help.github.com/en/github/administering-a-repository/about-releases)和[Creating releases](https://help.github.com/en/github/administering-a-repository/creating-releases)后发现必须通过**在线标签设置**的方式才能额外上传单独的压缩文件
发现必须通过**在线标签设置**的方式才能额外上传单独的压缩文件
## 相关阅读
* [About releases](https://help.github.com/en/github/administering-a-repository/about-releases)
* [Creating releases](https://help.github.com/en/github/administering-a-repository/creating-releases)

View File

@@ -1,15 +1,5 @@
# [Docker]GitLab使用
参考:
[GitLab Docker images](https://docs.gitlab.com/omnibus/docker/)
[gitlab docker Web界面打开反应迟钝的解决办法](https://blog.csdn.net/happyfreeangel/article/details/88653846)
[GitLab Docker 容器的内存优化之路](https://www.imooc.com/article/48668)
[gitlab的docker安装,非标准端口,如何处理?](https://www.cnblogs.com/aguncn/p/10336175.html)
# Docker部署
`gitlab`提供了官方镜像 - [gitlab/gitlab-ce](https://hub.docker.com/r/gitlab/gitlab-ce/)
@@ -109,4 +99,14 @@ Chef Client failed. 0 resources updated in 01 seconds
1. 停止`gitlab`容器
2. 修改配置文件(在主机中)`/srv/gitlab/config/gitlab.rb`
3. 重新启动容器
3. 重新启动容器
## 相关阅读
[GitLab Docker images](https://docs.gitlab.com/omnibus/docker/)
[gitlab docker Web界面打开反应迟钝的解决办法](https://blog.csdn.net/happyfreeangel/article/details/88653846)
[GitLab Docker 容器的内存优化之路](https://www.imooc.com/article/48668)
[gitlab的docker安装,非标准端口,如何处理?](https://www.cnblogs.com/aguncn/p/10336175.html)

View File

@@ -1,5 +1,5 @@
# [GitLab][nginx]反向代理
# Nginx反向代理
当前`gitlab`登录路径是`localhost:8080`

View File

@@ -3,9 +3,7 @@
## 硬件配置
参考:[Requirements](https://docs.gitlab.com/ce/install/requirements.html#hardware-requirements)
官方推荐的硬件配置为:
[官方推荐]((https://docs.gitlab.com/ce/install/requirements.html#hardware-requirements))的硬件配置为:
1. `2 cores CPU`
2. `8GB RAM`
@@ -85,7 +83,7 @@ https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
## 系统配置
打开文件`/etc/gitlab/gitlab.rb`修改external_url为自己的地址
打开文件`/etc/gitlab/gitlab.rb`,修改`external_url`为自己的地址
```
$ sudo cat /etc/gitlab/gitlab.rb | grep external_url
@@ -99,7 +97,7 @@ external_url 'http://localhost:8800'
...
```
重新进行gitlab配置
重新进行`gitlab`配置
```
$ sudo gitlab-ctl reconfigure

View File

@@ -1,11 +1,7 @@
# [GitLab]重置密码
# 重置密码
昨天新建的账户,今天突然等不上去了,参考以下文章重置密码
[gitlab 重置用户密码](https://blog.csdn.net/shanpenghui/article/details/89195511)
[gitlab管理员密码忘记如何强制重置找回](https://jingyan.baidu.com/article/6525d4b181bd41ac7d2e94af.html)
昨天新建的账户,今天突然等不上去了,重置密码
进入`gitlab`管理后台。当前使用`docker`版本`gitlab`,所以先进入容器
@@ -60,4 +56,10 @@ irb(main):007:0> user.save
Enqueued ActionMailer::DeliveryJob (Job ID: 2b220e18-d0ac-415e-a1cc-52f31069d3be) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f4e84a25510 @uri=#<URI::GID gid://gitlab/User/2>>
=> true
irb(main):008:0> quit
```
```
## 相关阅读
* [gitlab 重置用户密码](https://blog.csdn.net/shanpenghui/article/details/89195511)
* [gitlab管理员密码忘记如何强制重置找回](https://jingyan.baidu.com/article/6525d4b181bd41ac7d2e94af.html)

View File

@@ -1,62 +0,0 @@
# unicorn出错
## 问题描述
通过`docker`部署`gitlab`一段时间后,突然出现`502`错误
查看容器状态,显示不健康
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
89481faa2ed1 gitlab/gitlab-ce:latest "/assets/wrapper" 2 weeks ago Up 7 hours (unhealthy)
```
浏览容器日志,发现如下错误:
```
==> /var/log/gitlab/unicorn/unicorn_stdout.log <==
bundler: failed to load command: unicorn (/opt/gitlab/embedded/bin/unicorn)
==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
ArgumentError: Already running on PID:460 (or pid=/opt/gitlab/var/unicorn/unicorn.pid is stale)
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:205:in `pid='
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:137:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/bin/unicorn:126:in `<top (required)>'
/opt/gitlab/embedded/bin/unicorn:23:in `load'
/opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'
==> /var/log/gitlab/unicorn/current <==
2019-12-18_12:27:47.34406 failed to start a new unicorn master
2019-12-18_12:27:47.35882 starting new unicorn master
2019-12-18_12:27:47.91735 master failed to start, check stderr log for details
```
## 问题解析
看样子是`unicorn`的问题,参考:
[gitlab服务器502恢复过程](https://blog.csdn.net/zhouchuan152/article/details/95871798)
[gitlab docker Web界面打开反应迟钝的解决办法](https://blog.csdn.net/happyfreeangel/article/details/88653846)
进入容器内部,查看`unicorn`状态
```
$ docker exec -it xxxx bash
# gitlab-ctl tail unicorn
```
发现每次`unicorn`显示的`PID`都不同,修改`/etc/gitlab/gitlab.rb`,添加
```
unicorn['listen'] = 'localhost'
unicorn['port'] = 8999
```
更新并重启后,`gitlab`服务恢复正常
```
# gitlab-ctl reconfigure
# gitlab-ctl restart
```

View File

@@ -14,23 +14,25 @@ remote: HelpLink: https://gitee.com/help/articles/4232
To gitee.com:zjZSTU/xx.xxx.git
```
在网上查询发现是因为单个仓库大小超出了限制(`500MB`),经过一番查询发现`Gitee``Coding`的个人仓库都限制在`500MB`
参考:
[仓库体积过大,如何减小? ](https://gitee.com/help/articles/4232#article-header0)
[仓库大小限制吗?](https://cloud.tencent.com/developer/ask/197652)
`Github`对单个仓库大小的限制为`1GB`。参考:[File and repository size limitations](https://help.github.com/en/github/managing-large-files/what-is-my-disk-quota#file-and-repository-size-limitations)
在网上查询发现是因为单个仓库大小超出了限制(`500MB`),经过一番查询发现`Gitee``Coding`的个人仓库都限制在`500MB``Github`对单个仓库大小的限制为`1GB`
## 问题解决
阿里云的单个仓库限制为`2GB`,能够满足当前需求。参考:[代码库对文件大小是否有限制?](https://help.aliyun.com/document_detail/153791.html?spm=5176.11065259.1996646101.searchclickresult.30c1183bbCmNS7)
阿里云的单个仓库限制为`2GB`,能够满足当前需求。
各个远程`Git`仓库服务器的官网地址如下:
1. [Gitee](https://gitee.com/)
2. [Coding](https://coding.net/)
3. [Github](https://github.com/)
4. [Aliyun Code](https://code.aliyun.com)
4. [Aliyun Code](https://code.aliyun.com)
## 相关阅读
* [Gitee 仓库体积过大,如何减小? ](https://gitee.com/help/articles/4232#article-header0)
* [Tencent 仓库大小限制吗?](https://cloud.tencent.com/developer/ask/197652)
* [GitHub File and repository size limitations](https://help.github.com/en/github/managing-large-files/what-is-my-disk-quota#file-and-repository-size-limitations)
* [Aliyun代码库对文件大小是否有限制](https://help.aliyun.com/document_detail/153791.html?spm=5176.11065259.1996646101.searchclickresult.30c1183bbCmNS7)

View File

@@ -1,40 +0,0 @@
# 版本更新后database出错
### 问题描述
拉取了最新的`Docker Gitlab`镜像,部署时发现了如下错误:
```
gitlab | System Info:
gitlab | ------------
gitlab | chef_version=14.14.29
gitlab | platform=ubuntu
gitlab | platform_version=16.04
gitlab | ruby=ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
gitlab | program_name=/opt/gitlab/embedded/bin/chef-client
gitlab | executable=/opt/gitlab/embedded/bin/chef-client
gitlab |
gitlab |
gitlab | Running handlers:
gitlab | There was an error running gitlab-ctl reconfigure:
gitlab |
gitlab | bash[migrate gitlab-rails database] (gitlab::database_migrations line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
gitlab | ---- Begin output of "bash" "/tmp/chef-script20200618-23-sfpkhu" ----
gitlab | STDOUT: rake aborted!
gitlab | PG::ConnectionBad: could not connect to server: No such file or directory
gitlab | Is the server running locally and accepting
gitlab | connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
gitlab | /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:48:in `block (3 levels) in <top (required)>'
gitlab | /opt/gitlab/embedded/bin/bundle:23:in `load'
gitlab | /opt/gitlab/embedded/bin/bundle:23:in `<main>'
gitlab | Tasks: TOP => gitlab:db:configure
gitlab | (See full trace by running task with --trace)
gitlab | STDERR:
gitlab | ---- End output of "bash" "/tmp/chef-script20200618-23-sfpkhu" ----
gitlab | Ran "bash" "/tmp/chef-script20200618-23-sfpkhu" returned 1
```
### 问题解决
在网上查了一些资料,说是新旧版本的配置格式不一致,需要删除之前的配置数据。幸好在本地保存了之前使用的镜像,打包该镜像后上传到服务器重新加载即可

View File

@@ -80,4 +80,18 @@ nav:
- '[Commitizen]消息提交': tool/commitizen.md
- '[CommitLint][Husky]消息校验': tool/commitlint-husky.md
- README生成器: tool/generator-standard-readme.md
- '版本自动化及CHANGELOG生成': tool/standard-version.md
- '版本自动化及CHANGELOG生成': tool/standard-version.md
- 平台:
- 代码库大小限制: platform/代码库大小限制.md
- SSH公钥设置: platform/SSH公钥设置.md
- GitLab:
- 安装: platform/gitlab-安装.md
- 命令行操作: platform/gitlab-命令行操作.md
- Docker部署: platform/gitlab-docker部署.md
- Nginx反向代理: platform/gitlab-nginx反向代理.md
- 重置密码: platform/gitlab-重置密码.md
- GitHub:
- 版本发布: platform/github-版本发布.md
- DNS加速: platform/github-DNS加速.md
- 主页美化: platform/github-主页美化.md
- ERROR: platform/error.md