-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgitlab.sh
executable file
·45 lines (34 loc) · 1.81 KB
/
gitlab.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
docker run --detach \
--hostname zzcnt.top:10288 \
--publish 443:443 --publish 8888:10288 --publish 23:22 \
--name gitlab \
--restart always \
--volume /home/cliff/workspace/gitlab_workspace/config:/etc/gitlab \
--volume /home/cliff/workspace/gitlab_workspace/logs:/var/log/gitlab \
--volume /home/cliff/workspace/gitlab_workspace/data:/var/opt/gitlab \
gitlab/gitlab-ce:10.6.2-ce.0
exit 0
#--hostname gitlab.lixf.ink \
docker exec -it gitlab /bin/bash
gitlab-rails console
user=User.find_by_username 'root'
user.password="88888888" #这里请换成一个复杂的密码
user.save!
gitlab内部集成了letsencrypt,因此,这里只需要启用letsencrypt,并进行一些必要的配置
用vim打开/data/gitlab/config/gitlab.rb,修改以下内容
在32行左右,将external_url前面的#删掉,并在单引号中填写gitlab服务器的https地址,例如https://gitlab.lixf.ink
在2235行左右,修改下面几项
letsencrypt['enable'] = true #删除前面的#号,并将值修改为true
letsencrypt['contact_emails'] = ['[email protected]'] #删除前面的#号,修改为自己的邮箱
letsencrypt['auto_renew'] = true #删除前面的#号
然后,执行下面命令重启gitlab容器
docker restart gitlab
等容器重启之后,gitlab就会通过letsencrypt自动签发免费的HTTPS证书,等证书签发成功(大概3分钟左右),就可以通过https://gitlab.lixf.ink访问我们的代码仓库了
#delete some files and regen commit id
git filter-repo --invert-paths --path PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA
chmod 777 /var/opt/gitlab/backups/1530156812_2018_06_28_10.8.4_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1530156812_2018_06_28_10.8.4
crontab -e
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_keep_time'] = 604800