gitlab安装配置
1、docker-compose安装gitlab
[root@JD gitlab]# cat docker-compose.yml
version: '3'
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab01
restart: always
hostname: '114.67.93.184'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://114.67.93.184:82'
gitlab_rails['gitlab_shell_ssh_port'] = 1222
gitlab_rails['backup_path'] = "/data/gitlab-backup"
gitlab_rails['backup_keep_time'] = 1296000
gitlab_rails['backup_archive_permissions'] = 0644
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "*************@163.com"
gitlab_rails['smtp_password'] = "*************" #客户端授权码
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '***********@163.com'
gitlab_rails['smtp_domain'] = "smtp.163.com"
ports:
- '82:82'
- '3443:443'
- '1222:22'
volumes:
- /root/gitlab/data:/var/opt/gitlab
- /root/gitlab/logs:/var/log/gitlab
- /root/gitlab/config:/etc/gitlab
- /root/gitlab/gitlab-backup:/data/gitlab-backup
privileged: true
2、备份
1.备份
通过gitlab-rake命令备份gitlab,该命令会备份gitlab仓库、数据库、用户、用户组、用户密钥、权限等信息。 备份完成后备份文件会出现在/var/opt/gitlab/backups/
gitlab-rake gitlab:backup:create
2.恢复
2.1 停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
2.2 恢复gitlab仓库
gitlab-rake gitlab:backup:restore BACKUP=1537261122_2018_09_18_9.2.5
2.3 启动gitlab服务
gitlab-ctl start