为gitlab配置自签证书

前面有讲过基于ip地址通过openssl生成自签名证书的操作,本篇为大家介绍下为gitlab配置自签证书。

gitlab的部署和配置

这里是通过docker-dompose拉取的一套服务,需要需要提前安装docker-compose和docker。

docker-compose的yml文件

cat gitlab.yml

version: '3'
services:
  gitlab:
    image: registry.gitlab.cn/omnibus/gitlab-jh:15.5.9
    restart: always
    hostname: '192.168.31.40'
    container_name: gitlab
    environment:
        GITLAB_OMNIBUS_CONFIG: |
            external_url 'https://192.168.31.40:19090'
            nginx['redirect_http_to_https'] = true
            letsencrypt['enable'] = false
            nginx['ssl_certificate'] = "/etc/gitlab/ssl/server.crt"
            nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/server.key"
            # 配置ssh协议所使用的访问地址和端口
            gitlab_rails['gitlab_ssh_host'] = '192.168.31.40'
            gitlab_rails['gitlab_shell_ssh_port'] = 2022 # 此端口是run时22端口映射的8090端口
            #禁用不需要的服务
            node_exporter['enable'] = false
            redis_exporter['enable'] = false
            postgres_exporter['enable'] = false
            gitlab_exporter['enable'] = false
            prometheus['enable'] = false
            gitlab_kas['enable'] = false
            alertmanager['enable'] = false
    ports:
        - '19090:19090'
        - '2022:22'
    volumes:
        - /root/gitlab/data:/var/opt/gitlab
        - /root/gitlab/logs:/var/log/gitlab
        - /root/gitlab/config:/etc/gitlab
        - /etc/localtime:/etc/localtime

运行gitlab

docker-compose -f gitlab.yml up -d

访问测试

你可能感兴趣的:(gitlab,gitlab)