gitlab-ee deployment and backup

gitlab-ee installation and deployment

##################################
1. Deploy the environment and install the necessary dependencies

 yum install -y curl policycoreutils-python openssh-server
 systemctl enable sshd
 systemctl start sshd
 firewall-cmd --permanent --add-service=http
 systemctl reload firewalld

2. Install a mail server to send mail notifications. If there are other solutions, you can skip this step without installing it

yum install postfix
systemctl enable postfix
systemctl start postfix

##############################################

3. Configure the yum source to download and install the Gitlab package

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

(1) You can set EXTERNAL_URL=http://gitlab.example.com to access gitlab after installation and startup. If you use https, you need to do some additional configuration after installation
sudo EXTERNAL_URL="http://gitlab.example.com .com” yum install -y gitlab-ee
(2) If you do not set EXTERNAL_URL=http://gitlab.example.com, you can install it directly. After installation, you can edit the access url and install it directly:

sudo yum install -y gitlab-ee

(3) You can directly access domestic resources to download the rpm package https://www.shcsinfo.com/china/gitlabeedownload.html
4. After the installation is complete, modify the file /etc/gitlab/gitlab.rb and set the access url

GitLab URL

##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url ‘http://10.10.10.43:80/gitlab’
###################################################
4、重载、启动

gitlab-ctl reconfigure
gitlab-ctl restart

#################################################### #
5. Set password
Change account password

注:在第一次访问的时候会提示输入新密码,此时该密码为最初的密码,可以在页面设置新密码或者通过下面的方式重置密码
Gitlab 修改root用户密码

Log into the server with root privileges and start the Ruby on Rails console.

[root@localhost ~]# gitlab-rails console production
Loading production environment (Rails 4.2.8)
irb(main):001:0>
或者

irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0>user.password = 'secret_pass'
irb(main):002:0>user.password_confirmation = 'secret_pass'
irb(main):002:0>user.save

or

irb(main):001:0> user = User.find_by(email: '[email protected]')
=> #<User id:1 @root>
irb(main):002:0>user.password = 'secret_pass'
irb(main):002:0>user.password_confirmation = 'secret_pass'
irb(main):002:0>user.save

#################################################### #####
6. Login
ip: port/gitlab
####################################### ########################################################################################################################################################################################################################################
_
_ You can create a complete Gitlab backup:
1. Backup: gitlab-rake gitlab:backup:create
Using the above command will create a compressed package with a name similar to 1393513186_gitlab_backup.tar in the /var/opt/gitlab/backups directory. This compressed package is The complete part of Gitlab, where 1393513186 at the beginning is the date when the backup was created.
(1) Gitlab modify the default directory of backup files
You can also modify the default directory for storing backup files by modifying /etc/gitlab/gitlab.rb:
gitlab_rails[' backup_path'] = '/mnt/backups'
/mnt/backups can be changed to the directory you want to store the backup. After the modification is complete, use the gitlab-ctl reconfigure command to reload the configuration file.
Second, Gitlab automatic backup
can also be done through crontab Use the backup command to implement automatic backups:

crontab -e

Add the following to realize an automatic backup every day at 2 am:

0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create 分时日月周的格式

#################################################### ########3
8. Gitlab data recovery

Stop related data connection services

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

Restoring from backup numbered 1393513186

gitlab-rake gitlab:backup:restore BACKUP=1393513186

Start Gitlab

sudo gitlab-ctl start

#################################################### ########3
9. Gitlab Migration

Migration is the same as the steps of backup and recovery,
just copy the backup files in the /var/opt/gitlab/backups directory of the old server to /var/opt/gitlab/backups on the new server (if you have not modified the default backup directory).
However, it should be noted that the version of Gitlab on the new server must be the same as the version number of Gitlab when the backup was created.
For example, if the new server is installed with the latest version 7.60 of Gitlab, it is best to replace the old server with Gitlab is upgraded to 7.60 for backup.

Guess you like

Origin blog.csdn.net/Chen118222/article/details/119888816