gitlab-development-kit部署gitlab

马寒
2023-12-01

环境

  • mac 12.6.4
  • xcode 13.4
  • gdk 0.2.10
  • gitlab-foss 13.7

安装

  • 依赖
    # install ohmyzsh
    $ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    # 安装homebrew
    $ xcode-select --install
    $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    $ brew update
    # 安装依赖 https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/v0.2.10/doc/advanced.md#macos
    $ git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git
    $ cd gitlab-development-kit
    $ git checkout v0.2.10
    
    $ brew bundle
    $ brew link pkg-config
    $ brew pin libffi icu4c readline re2
    $ if [ ${ZSH_VERSION} ]; then shell_file="${HOME}/.zshrc"; else shell_file="${HOME}/.bash_profile"; fi
    $ echo 'export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ${shell_file}
    $ source ${shell_file}
    $ brew install chromedriver --cask
    
  • install and set up GDK
    $ rm Gemfile.lock
    $ make bootstrap
    # gdk install gitlab_repo= 依赖ruby 3.0.5 所以直接clone
    # gdk install gitlab_repo=git@gitlab.com:gitlab-org/gitlab-foss.git
    $ git clone git@gitlab.com:gitlab-org/gitlab-foss.git gitlab
    $ cd gitlab; git checkout v13.7.0; cd -
    $ make install
    
  • 配置nginx
    $ echo '127.0.0.1 gdk.test' | sudo tee -a /etc/hosts
    $ brew install nginx
    # vim gdk.yml
    hostname: gdk.test
    port: 3443
    https:
      enabled: true
    nginx:
      enabled: true
      http2:
        enabled: true
      ssl:
        certificate: gdk.test.pem
        key: gdk.test-key.pem
    
    $ gdk reconfigure
    $ gdk restart
    # HTTP: http://gdk.test:8080
    # HTTPS: https://gdk.test:3443
    
  • goproxy 配置https 80
    $ git clone https://gitlab.com/firelizzard/super-simple-proxy
    $ cd super-simple-proxy;
    $ go run . -netrc -secure gdk.test:443 -key /path/to/gdk.test-key.pem -cert /path/to/gdk.test.pem -insecure gdk.test:80 -forward gdk.test,gdk.test:3443
    # https://gdk.test (port 443 is default for HTTPS).
    # entirely disable downloading checksums for all Go modules
    export GOSUMDB=off
    # disable checksum downloads for all projects
    export GONOSUMDB=gdk.test
    # disable checksum downloads for projects within a namespace
    export GONOSUMDB=gdk.test/namespace
    # disable checksum downloads for a specific project
    export GONOSUMDB=gdk.test/namepsace/project
    
  • 遇到问题
    • openssl
      # vim ~/.zshrc 修改openssl@3 -> openssl@1.1 
      # Added by GDK bootstrap
      export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl@1.1 --with-readline-dir=/usr/local/opt/readline"
      
    • thrift
      # gem install thrift -v '0.16.0'  -- --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value"
      $ gem install thrift -v 0.16.0 -- --with-cppflags="-Wno-compound-token-split-by-macro"
      
    • goproxy
      $ go env -w GOPROXY=https://goproxy.cn,direct
      # vim Makefile
      export GOPROXY ?= https://goproxy.cn
      
    • brew services
      $ sudo rm -rf /Library/Developer/CommandLineTools
      $ xcode-select --install
      
    • jaeger-all-in-one: truncated gzip input tar: Error exit delayed from previous errors.
      # https://github.com/bytedeco/javacpp-presets/issues/150
      $ rm -rf jaeger*
      
    • undefinded URI
      # vim lib/gdk/config.rb
      $ require 'uri'
      
    • gdk reconfigure remember!
      # vim lib/gdk.rb 从gem/bin/gdk 复制
      def self.remember!(directory)
      	File.open("#{directory}/#{ROOT_CHECK_FILE}", 'w') do |f|
        		f.puts File.realpath(directory)
      	end
      	true
      rescue StandardError => e
      	warn e
      	false
      end
      
 类似资料: