欠伸展肢体,吟咏心自愉。这篇文章主要讲述gitlab安装与使用相关的知识,希望能为你提供帮助。
简介:【gitlab安装与使用】GitLab是利用Ruby on Rails一个开源的版本管理系统,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目,与Github类似。
基本服务构成
nginx
:静态web服务器。gitlab-shell
:用于处理Git命令和修改authorized keys列表。gitlab-workhorse
: 轻量级的反向代理服务器。logrotate
:日志文件管理工具。postgresql
:数据库。redis
:缓存数据库。sidekiq
:用于在后台执行队列任务(异步执行)。unicorn
:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的 yum安装- 配置Yum源
vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever
gpgcheck=0
enabled=1
- 更新Yum缓存
yum makecache
安装Gitlab社区版
yum intall gitlab-ce#自动安装最新版 yum install gitlab-ce-x.x.x#安装指定版本
Gitlab常用命令gitlab-ctl start# 启动所有 gitlab 组件; gitlab-ctl stop# 停止所有 gitlab 组件; gitlab-ctl restart# 重启所有 gitlab 组件; gitlab-ctl status# 查看服务状态; gitlab-ctl reconfigure# 启动服务; vim /etc/gitlab/gitlab.rb# 修改默认的配置文件; gitlab-rake gitlab:check SANITIZE=true --trace# 检查gitlab; gitlab-ctl tail# 查看日志;
Gitlab配置vi /etc/gitlab/gitlab
# 登陆URL external_url http://10.10.30.109 # 时区 gitlab_rails[time_zone] = Asia/Shanghai # smtp发件服务器 gitlab_rails[smtp_enable] = true gitlab_rails[smtp_address] = "smtp.xxx.com" gitlab_rails[smtp_port] = 465 gitlab_rails[smtp_user_name] = "xxx@xxx.com" gitlab_rails[smtp_password] = "xxx" gitlab_rails[smtp_domain] = "smtp.xxx.com" gitlab_rails[smtp_authentication] = "login" gitlab_rails[smtp_enable_starttls_auto] = true gitlab_rails[smtp_tls] = true gitlab_rails[gitlab_email_enabled] = true gitlab_rails[gitlab_email_from] = xxx@xxx.com gitlab_rails[gitlab_email_display_name] = gitlab # gitlab 自动备份 gitlab_rails[manage_backup_path] = true gitlab_rails[backup_path] = "/data/backups/gitlab" gitlab_rails[backup_archive_permissions] = 0644 gitlab_rails[backup_keep_time] = 7776000 # gitlab数据存储目录 git_data_dirs( "default" => "path" => "/data/git-data") # gitlab_shell ssh端口 gitlab_rails[gitlab_shell_ssh_port] = 22
Gitlab 使用 - Gitlab自动备份脚本
[root@gitlab-30 ~]# cat /data/backups/gitlab/gitlab_backup.sh #/bin/sh /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
- 每天凌晨两点自动备份
0 2 * * * /bin/bash -x /data/backups/gitlab/gitlab_backup.sh> /dev/null 2> & 1
- Gitlab默认密码:
[root@gitlab-30 ~]# cat /etc/gitlab/initial_root_password # WARNING: This value is valid only in the following conditions #1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails[initial_root_password]` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run). #2. Password hasnt been changed manually, either via UI or via command line. # #If the password shown here doesnt work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
推荐阅读
- 看电影也可以学点什么
- MYSQL怎么发现处理没有commit 留下的“大”麻烦()
- PostgreSQL 一个可以调整查询代价的数据库
- 可曾听闻大话二字—统计学R语言
- MYSQL performance_schema 监控系统更容易与慢查询DUMP SLOW LOG
- Zookeeper - 数据处理/存储
- SQL SERVER时间换空间,空间换时间 以及什么是好SQL
- MYSQL性能优化-- index 使用方法公式
- 尽一份孝心,为家人做一个老人防摔报警系统