(1)compose方式安装gitlab
1)准备目录
test -d /data/gitlab/{config,logs,data} || mkdir -pv /data/gitlab/{config,logs,data}
2)compose文件内容如下
注意修改 external_url和hostname为自己的url
#cat gitlab-compose.yml
gitlab:
container_name: gitlab
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'www.baidu.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://www.baidu.com
ports:
- '80:80'
- '443:443'
- '2224:22'
volumes:
- '/data/gitlab/config:/etc/gitlab'
- '/data/gitlab/logs:/var/log/gitlab'
- '/data/gitlab/data:/var/opt/gitlab'
3)启动
docker-compose -f gitlab-compose.yml up -d
(2)维护gitlab
1)备份
docker exec -it gitlab gitlab-rake gitlab:backup:create
2)备份恢复
docker exec gitlab gitlab-ctl stop unicorn
docker exec gitlab gitlab-ctl stop sidekiq
chmod -R 777 /data/gitlab/data/backups/
#注意:在 /data/gitlab/data/backups/ 文件名是1540266175_2018_10_23_9.3.4_gitlab_backup.tar 恢复的时候要去掉_gitlab_backup.tar
docker exec -it gitlab bash
gitlab-rake gitlab:backup:restore BACKUP=1540266175_2018_10_23_9.3.4
gitlab-ctl restart
3)gitlab 403问题
参考文档: https://blog.csdn.net/jzd1997/article/details/80253905