gitlab warehouse

1. This chapter outlines the course content

1.Gitlab a basic overview of the repository
  1. What is gitlab?

  2.gitlab and github different?
  3. Why gitlab advantages and usage scenarios?
2.Gitlab service composition?
3.gitlab installation configuration?
  1. Install gitlab
  2. Configure gitlab access domain
  3. Configure gitlab mailbox information
4.gitlab Chinese finished?
5.gitlab everyday use?
  The relationship between 1.Gitlab users, user groups, projects warehouse?
  2. Create groups, create users, create projects?
  3. Verify users, groups, permissions related projects?
  3. How will this push data to the local gitlab warehouse? http way, ssh way?
  4. If you need to add new members how to do this project?
6.gitlab operation and maintenance, how to back up, restore, upgrade?

  1. gitlab Description: code hosting warehouses, and so on gitee github

2.gitlab difference with github

github for private warehouse charges, foreign card (open source projects)

gitlab self-built self-maintenance, and create a public warehouse private warehouse (company use)

Small teams: domestic code to create a private cloud repository

Offline sync branch management rights management

2.gitlab installation

1. dependent on the environment

yum install -y curl openssh-server postfix wget

2.gitlab installation

yum localinstall gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm 

2.1 Configuring the url gitlab

vim /etc/gitlab/gitlab.rb

external_url 'http://gitlab.oldxu.com'

2.2 Configuring gitlab mailbox

gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = "[email protected]"  # 发件邮箱
gitlab_rails['gitlab_email_display_name'] = 'OldXu-GitLab' # 发件人显示名称

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]" #发件人邮箱账户
gitlab_rails['smtp_password'] = ""  #发件人邮箱客户端授权码
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true

2.3 Close programs

#关闭或不关闭不重要,取决于你的内存

1385 prometheus['enable'] = false
1474 node_exporter['enable'] = fals
1493 redis_exporter['enable'] = false
1511 postgres_exporter['enable'] = false
1560 grafana['enable'] = false

2.4 gitlab initialization

#第一次初始化时间较长,后期修改配置文件也需要初始化

[root@git ~]# gitlab-ctl reconfigure
[root@git ~]# gitlab-ctl status
[root@git ~]# gitlab-ctl start
[root@git ~]# gitlab-ctl stop
[root@git ~]# gitlab-ctl restart
[root@git ~]# gitlab-ctl stop nginx

2.5 Access gitlab Service

1573527203762

1573527263759

2.6 Verify mail feature is available

5. Check whether reinitialization mailbox can be used normally gitlab

[root@gitlab ~]# gitlab-rails console
Notify.test_email('接收方邮件地址','邮件标题','邮件内容').deliver_now

Notify.test_email('[email protected]','gitlab-test','测试').deliver_now

1573527431183

Speaking 3.gitlab

1. native finished, but incomplete

1573528793027

2. Speaking of third-party patches https://gitlab.com/xhang/gitlab

gitlab-ctl stop
\cp -r gitlab-12-0-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/

gitlab-ctl reconfigure
gitlab-ctl start

4.gitlab daily use

  The relationship between 1.Gitlab users, user groups, projects warehouse?
  2. Create groups, create users, create projects?
  3. Verify users, groups, permissions related projects?
  3. How will this push data to the local gitlab warehouse? http way, ssh way?
  4. If you need to add new members how to do this project?

1. How to import an existing project

1573531830876

1573532020094

2. Project User Group relationship?

img

1573544156506

1. Create a project based on group
2. Create two user linux windows dev join the group, assign permissions linux is the owner of the windows is to develop
3. Use linux system associated with linux user, cloning project, and then to submit code master test or dev branch respectively
4 using windows system associated with windows users, cloning projects
try to modify the dev branch content, test submission.
Attempt to modify the contents of the master branch. Try to submit, if not
1. attempt to initiate a request for approval of the merger linux user, the combined effect after checking
2. Direct close protection branch of the project, and then test again.

AB user

User rights

1.git modify connection ssh

[root@git gdx]# git remote -v
origin  http://gitlab.oldxu.com/dev/gdx.git (fetch)
origin  http://gitlab.oldxu.com/dev/gdx.git (push)

[root@git gdx]# git remote remove origin 
[root@git gdx]# git remote add origin [email protected]:dev/gdx.git

[root@git gdx]# git remote -v
origin  [email protected]:dev/gdx.git (fetch)
origin  [email protected]:dev/gdx.git (push)

2.gitlab backup

gitlab backup is very simple, it is a command

gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab_rails['backup_keep_time'] = 604800



gitlab-ctl reconfigure

Perform a backup command (if you want to perform daily tasks using shell scripts or timing are ok)

gitlab-rake gitlab:backup:create


默认路径
[root@git ~]# ls /var/opt/gitlab/backups/
1573549930_2019_11_12_12.0.3_gitlab_backup.tar

3.gitlab recovery

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

Be recovered by gitlab-rake command, specify the name of the previous backup recovery (but do not need to write git_lab_backup.tar suffix)

gitlab-rake gitlab:backup:restore BACKUP=1573549930_2019_11_12_12.0.3

Finally, start the assembly of all gitlab

gitlab-ctl start

4.gitlab upgrade

Do not cross large version

12.0.3 --> 12.1.xx

12.1 finished package

5.gitlab migration

https://www.xuliangwei.com/bgx/803.html#toc_4

5.gitlab summary

  • 1.gitlab Introduction
  • 2.gitlab installation
  • 3.gitlab Configuration
    • 1. E-mail
    • 2. Domain Name
    • 3. Close useless service (do not need)
  • Speaking 4.gitlab
  • 5.gitlagb basic use
    • 1. The relationship between users and user groups and permissions?
    • 2. Demonstration of users and user group permissions configuration?
  • 6.gitlab backup
  • 7.gitlab recovery
  • 8.JOB: gitlab upgrade migration
  • 9. Extended:
    • 1.gitlab request merge (merging several ways to achieve)
    • 2.gitlab branch protection mechanism (adjustment branch protection mechanisms)
    • 3.gitlab close the main page of the registration function (because the default registration you can log in)
    • 4.gitlab free-tight manner,
      • http way: the need for frequent password is not too convenient
      • ssh manner: a public key corresponding to the user system placed ssh, density log can be realized free.
    • 5.gitlab modify the backup path (self completion) / data / gitlab / backups

1573551926584

Guess you like

Origin www.cnblogs.com/baozexu/p/11846207.html