===============================================
2018-04-26 08:40:52
===============================================
The user selected throughout the installation is root
Reference article: http://www.cnblogs.com/straycats/p/7671204.html
This article is basically a reprint of Mr. Zong's previous article. If you are interested, you can read Mr. Zong 's original article.
1. Environmental preparation
By default, one server has successfully deployed gitlab.
2. Manually backup gitlab
Very convenient, because gitlab has instructions to directly support manual backup.
gitlab-rake gitlab:backup:create
It should be noted here that if the parameter "backup_path" is configured in /etc/gitlab/gitlab.rb (for example, gitlab_rails['backup_path'] = '/backup'), the backup directory is under this directory (/backup/);
If there is no configuration parameter "backup_path", gitlab generates backup files to the default directory /var/opt/gitlab/backups.
3. Regular automatic backup of gitlab (local)
The idea of timed backup is based on manual operation, and this problem can be solved by adding a timed plan through crontab.
Generally, there are two ways to add a timed plan:
1. Use the command crontab -e to add the scheduled task and save it.
2. Add the scheduled task to the /etc/crontab file.
I take the first one here, using crontab -e.
crontab -e
For example, I plan to back up twice a day, at 12:00 and 19:00 each day, so I add the following content and save it.
0 12 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create 0 19 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
restart crontab
systemctl restart crond
However, it is not enough to realize automatic backup. If the backup cannot be cleaned up in time, the space on the hard disk will soon be insufficient. At the same time, it must be able to automatically clean up without manual time spent in this area.
4. Automatic cleaning
This piece is already supported by gitlab, just follow a simple solution and configure gitlab to realize the automatic cleaning function.
vim /etc/gitlab/gitlab.rb
Uncomment the configuration of backup_keep_time, and set how many days ago the backup is automatically cleaned up as needed. Here, set the backup to be kept for 7 days (7*3600*24=604800) and save it.
gitlab_rails['backup_keep_time'] = 604800
Reload gitlab's configuration file
gitlab-ctl reconfigure
2018-04-26 08:40:52
===============================================
The user selected throughout the installation is root
Reference article: http://www.cnblogs.com/straycats/p/7671204.html
This article is basically a reprint of Mr. Zong's previous article. If you are interested, you can read Mr. Zong 's original article.
1. Environmental preparation
By default, one server has successfully deployed gitlab.
2. Manually backup gitlab
Very convenient, because gitlab has instructions to directly support manual backup.
gitlab-rake gitlab:backup:create
It should be noted here that if the parameter "backup_path" is configured in /etc/gitlab/gitlab.rb (for example, gitlab_rails['backup_path'] = '/backup'), the backup directory is under this directory (/backup/);
If there is no configuration parameter "backup_path", gitlab generates backup files to the default directory /var/opt/gitlab/backups.
3. Regular automatic backup of gitlab (local)
The idea of timed backup is based on manual operation, and this problem can be solved by adding a timed plan through crontab.
Generally, there are two ways to add a timed plan:
1. Use the command crontab -e to add the scheduled task and save it.
2. Add the scheduled task to the /etc/crontab file.
I take the first one here, using crontab -e.
crontab -e
For example, I plan to back up twice a day, at 12:00 and 19:00 each day, so I add the following content and save it.
0 12 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create 0 19 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
restart crontab
systemctl restart crond
However, it is not enough to realize automatic backup. If the backup cannot be cleaned up in time, the space on the hard disk will soon be insufficient. At the same time, it must be able to automatically clean up without manual time spent in this area.
4. Automatic cleaning
This piece is already supported by gitlab, just follow a simple solution and configure gitlab to realize the automatic cleaning function.
vim /etc/gitlab/gitlab.rb
Uncomment the configuration of backup_keep_time, and set how many days ago the backup is automatically cleaned up as needed. Here, set the backup to be kept for 7 days (7*3600*24=604800) and save it.
gitlab_rails['backup_keep_time'] = 604800
Reload gitlab's configuration file
gitlab-ctl reconfigure