gitlab-rake常见用法-系统管理

GitLab本身有很多有用的rake命令,可以用于日常维护。

以下GitLab官网上gitlab-rake的常见用法。

1. 收集GitLab和系统信息

sudo gitlab-rake gitlab:env:info

输出:

System information
System:
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.7.5p203
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.6
Redis Version:	6.0.16
Git Version:	2.33.1.
Sidekiq Version:6.3.1
Go Version:	unknown

GitLab information
Version:	14.6.0-jh
Revision:	46d2f0d5677
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.7
URL:		http://43.155.69.97
HTTP Clone URL:	http://43.155.69.97/some-group/some-project.git
SSH Clone URL:	git@43.155.69.97:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	13.22.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

2. 显示GitLab许可证信息

sudo gitlab-rake gitlab:license:info

输出:

Today's Date: 2020-02-29
Current User Count: 30
Max Historical Count: 30
Max Users in License: 40
License valid from: 2019-11-29 to 2020-11-28
Email associated with license: user@example.com

3. 检查GitLab配置

sudo gitlab-rake gitlab:check

上述检查也可以拆分为:

gitlab-rake gitlab:gitlab_shell:check
gitlab-rake gitlab:gitaly:check
gitlab-rake gitlab:sidekiq:check
gitlab-rake gitlab:incoming_email:check
gitlab-rake gitlab:ldap:check
gitlab-rake gitlab:app:check

输出:

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.22.1 ? ... OK (13.22.1)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ...
GitLab Instance / Monitoring ... yes
test / python ... yes
Redis version >= 5.0.0? ... yes
Ruby version >= 2.7.2 ? ... yes (2.7.5)
Git version >= 2.33.0 ? ... yes (2.33.1)
Git user has default SSH configuration? ... yes
Active users: ... 1
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

4. 重建 authorized_keys 密钥索引文件

sudo gitlab-rake gitlab:shell:setup

输出:

This task will now rebuild the authorized_keys file.
You will lose any data stored in the authorized_keys file.
Do you want to continue (yes/no)? yes

5. 清除redis缓存

sudo gitlab-rake cache:clear

正常无输出。

6. 测试TCP连接

sudo gitlab-rake gitlab:tcp_check[gitlab.com,80]

输出:

TCP connection from 172.17.0.2:42370 to 172.65.251.78:80 succeeded

7. 显示 database migrations状态

sudo gitlab-rake db:migrate:status

输出:

database: gitlabhq_production

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20181228175414  Init schema
   up     20201211090634  Schedule populate finding uuid for vulnerability feedback
   up     20201211145950  Add bloat estimate to reindex action
   up     20201214000000  Change mr allow maintainer to push default
   up     20201214032220  Add has external wiki trigger
   up     20201214084105  Add expiration policy completed at to container repositories
   up     20201214111858  Add container registry cleanup tags service max list size to application settings
   up     20201214112752  Add app settings container reg cleanup tags service max list size constraint
   up     20201214113729  Add custom mapping columns to http integrations
   up     20201214184020  Add epic board list
   up     20201215084652  Delete mock deployment service records
   up     20201215132151  Change unique index on security findings
   up     20201215205404  Create namespace package settings
   up     20201216151616  Add squash commit sha index
   up     20201216154457  Add devops adoption snapshot range end
	...........

8. 运行未完成的database migrations

sudo gitlab-rake db:migrate

正常无输出。

9. 重建数据库索引

sudo gitlab-rake gitlab:db:reindex

输出:

This feature (database_reindexing) is currently disabled.

10. 导入 common metrics

sudo gitlab-rake metrics:setup_common_metrics

正常无输出。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值