Sign inSign up

jackios/gitlab-ce

By jackios

•Updated over 3 years ago

Image
0

46

jackios/gitlab-ce repository overview

version: '3'

services: gitlab: image: 'gitlab/gitlab-ce:14.10.2-ce.0' restart: always hostname: 'www.mygitlab.com⁠' environment: TZ: 'Asia/Shanghai' GITLAB_OMNIBUS_CONFIG: | external_url 'http://192.168.55.225:3000⁠' # web站点访问地址 gitlab_rails['gitlab_shell_ssh_port'] = 2222 ports: - '3000:3000' # 注意宿主机和容器内部的端口要一致,否则external_url无法访问 - '8443:443' - '2222:22' volumes: - ./config:/etc/gitlab - ./data:/var/opt/gitlab - ./logs:/var/log/gitlab logging: driver: "json-file" options: max-size: "2g" max-file: "2"

容器起来之后,默认用户是root,要登录web界面需要先进入容器的这个文件获取密码: /etc/gitlab/initial_root_password 3.1 备份 在容器内可以执行一下命令进行备份 /usr/bin/gitlab-rake gitlab:backup:create

如果想实现定时备份,可以在宿主机上结合crontab 和 docker命令进行备份。 docker exec -t CONTAINER_ID gitlab-rake gitlab:backup:create 其中:CONTAINER_ID 为gitlab的容器ID。

3.2 恢复 Gitlab的恢复操作会先将当前所有的数据清空,然后再根据备份数据进行恢复. 注意:在指定备份文件恢复时,gitlab会自动补全后面的文件名。

⁠停止unicorn和sidekiq,保证数据库没有新的连接,不会有写数据情况

gitlab-ctl stop unicorn gitlab-ctl stop sidekiq

⁠进入备份目录进行恢复,1476900742为备份文件的时间戳

cd /var/opt/gitlab/backups gitlab-rake gitlab:backup:restore BACKUP=1553965778_2019_03_31_10.7.3

⁠启动unicorn和sidekiq

gitlab-ctl start unicorn gitlab-ctl start sidekiq

常用命令

⁠启动所有 gitlab 组件;

gitlab-ctl start

⁠停止所有 gitlab 组件;

gitlab-ctl stop

⁠重启所有 gitlab 组件;

gitlab-ctl restart

⁠查看服务状态;

gitlab-ctl status

⁠修改gitlab配置文件;

vim /etc/gitlab/gitlab.rb

⁠重新编译gitlab的配置;

gitlab-ctl reconfigure

⁠检查gitlab;

gitlab-rake gitlab:check SANITIZE=true --trace

⁠查看日志;

gitlab-ctl tail
gitlab-ctl tail nginx/gitlab_access.log

⁠解决方法:

1) 修改postgresql配置 $ vim /var/opt/gitlab/postgresql/data/postgresql.conf listen_addresses = '*'

⁠最下面新增两行

$ vim /var/opt/gitlab/postgresql/data/pg_hba.conf local all all trust host all all 127.0.0.1/32 trust

2)重启gitlab服务 $ gitlab-ctl restart ok: run: logrotate: (pid 29367) 1s ok: run: nginx: (pid 29371) 0s ok: run: postgresql: (pid 29389) 0s ok: run: redis: (pid 29391) 0s ok: run: sidekiq: (pid 29404) 0s ok: run: unicorn: (pid 29413) 0s

Tag summary

Content type

Image

Digest

sha256:0a94acab8…

Size

1 GB

Last updated

over 3 years ago

docker pull jackios/gitlab-ce:14.10.2-ce.0