part 0 准备一个自己的域名
代码语言:txt
复制比如 xxxx.org,如果开启邮件功能,可以选择腾讯云的企业邮箱,建立专属自己的邮件名称
part 1 gitlab拉取镜像
代码语言:txt
复制docker pull gitlab/gitlab-ce
启动
代码语言:txt
复制docker run --detach
--hostname gitlab.xxxx.org
--publish 22443:443 --publish 8083:80 --publish 2222:22
--name gitlab
--memory 4g
--restart always
--volume ~/dockerfile/gitlab/config:/etc/gitlab
--volume ~/dockerfile/gitlab/logs:/var/log/gitlab
--volume ~/dockerfile/gitlab/data:/var/opt/gitlab
gitlab/gitlab-ce:latest
docker exec -it gitlab bash
gitlab-ctl reconfigure
修改配置
代码语言:txt
复制添加外部请求的域名(如果不支持https, 可以改成http)
external_url 'http://gitlab.xxxx.org'
# 修改gitlab对应的时区
gitlab_rails['time_zone'] = 'PRC'
# 开启邮件支持
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab@xxxx.org'
gitlab_rails['gitlab_email_display_name'] = 'xxxx GitLab'
# 配置邮件参数
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "gitlab@xxxx.org"
gitlab_rails['smtp_password'] = "xx"
gitlab_rails['smtp_domain'] = "smtp.qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
user['git_user_email'] = "gitlab@xxxx.org"
重新启动
代码语言:txt
复制gitlab-ctl reconfigure
gitlab-ctl restart
part 2 gogs docker 安装
代码语言:txt
复制# Pull image from Docker Hub.
$ docker pull gogs/gogs
# Create local directory for volume.
$ mkdir -p /var/gogs
# Use `docker run` for the first time.
$ sudo docker run --detach --name=gogs -p 10022:22 -p 10080:3000 -v ~/dockerfile/gogs/data/:/data gogs/gogs
# Use `docker start` if you have stopped it.
$ docker start gogs
nginx config
代码语言:txt
复制server {
listen 443 ssl;
server_name gogs.xxxx.org;
ssl_certificate ~/Nginx/1_gogs.xxxx.org_bundle.crt;
ssl_certificate_key ~/Nginx/2_gogs.xxxx.org.key;
server_tokens off;
location /{
proxy_pass http://127.0.0.1:10080/;
proxy_redirect default;
}
}
server {
listen 80;
server_name gogs.xxxx.org;
return 301 https://$host$request_uri;
}
check nginx config
代码语言:txt
复制sudo nginx -s reload
sudo service nginx stop
sudo service nginx start