GitLab 安裝相關紀錄

  • 安裝環境 : Alpine 3.20 + docker compose
  • docker-compose.yml

    services:
      gitlab:
        image: gitlab/gitlab-ce
        container_name: gitlab
        restart: always
        hostname: 'git-demo.ichiayi.com'
        environment:
          GITLAB_OMNIBUS_CONFIG: |
            # Add any other gitlab.rb configuration here, each on its own line
            external_url 'https://git-demo.ichiayi.com'
        ports:
          - '80:80'
          - '443:443'
          - '22:22'
        volumes:
          - './config:/etc/gitlab'
          - './logs:/var/log/gitlab'
          - './data:/var/opt/gitlab'
        shm_size: '256m'

  • 啟動服務

    docker compose up -d
    docker compose logs -f

  • 查看自動產生的 root 密碼

    cat config/initial_root_password

  • 採用 Gitlab 官方 docker image 最新版
    • gitlab/gitlab-ce:latest
  • GITLAB_OMNIBUS_CONFIG 可設定
    • gitlab 網址 : external_url 'http://git-demo.ichiayi.com'
    • Prometheus 監控 : prometheus_monitoring['enable'] = false
    • Container Registry : gitlab_rails['gitlab_default_projects_features_container_registry'] = false;
    • 預設的 root 密碼 : gitlab_rails['initial_root_password'] = '«Passwd_Is_Here»'
    • CI/CD Pipeline : gitlab_rails['gitlab_default_projects_features_builds'] = 'false'
  • Docker
    • port : 80 / 443
    • name : gitlab
    • restart : 每次開機都自動啟動
    • Volume 掛載 :
      • /etc/gitlab → ./config
      • /var/log/gitlab → ./logs
      • /var/opt/gitlab → ./data
  • 實際執行的語法:

    sudo docker run --env GITLAB_OMNIBUS_CONFIG="external_url 'http://git-demo.ichiayi.com'; \
        prometheus_monitoring['enable'] = false; \
        gitlab_rails['gitlab_default_projects_features_container_registry'] = false; \
        gitlab_rails['initial_root_password'] = '<<Passwd_Is_Here>>'; \
        gitlab_rails['gitlab_default_projects_features_builds'] = 'false'" \
      --detach --publish 443:443 --publish 80:80 --name gitlab --restart always \
      --volume /NAS_dir/gitlab/config:/etc/gitlab \
      --volume /NAS_dir/gitlab/logs:/var/log/gitlab \
      --volume /NAS_dir/gitlab/data:/var/opt/gitlab \
      gitlab/gitlab-ce

  • tech/gitlabtips.txt
  • 上一次變更: 2024/08/15 18:56
  • jonathan