• gitlab8.2->8.16->8.17->9.0升级


    注:不要跨过8.16升级至8.17,这样做升级过程会报错

    ###################################8.2升级至8.16###########################

    一,停止服务:

    service gitlab stop

    二,备份

    cd /home/git/gitlab

    sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production

    三,更新ruby

    mkdir /tmp/ruby && cd /tmp/ruby
    curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.gz
    echo '1014ee699071aa2ddd501907d18cbe15399c997d ruby-2.3.3.tar.gz' | shasum -c - && tar xzf ruby-2.3.3.tar.gz
    cd ruby-2.3.3
    ./configure --disable-install-rdoc
    make
    sudo make install

    sudo gem install bundler --no-ri --no-rdoc

    //四,更新&安装node

    五,获取最新代码

    cd /home/git/gitlab

    sudo -u git -H git fetch --all
    sudo -u git -H git checkout -- db/schema.rb

    sudo -u git -H git checkout 8-16-stable

    六,更新数据库等

    登陆MySQL修改权限:

    GRANT REFERENCES ON `gitlabhq_production`.* TO 'git'@'localhost';

    cd /home/git/gitlab

    sudo -u git -H bundle install --without postgres development test --deployment

    sudo -u git -H bundle clean

    sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production

    sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production

    七,更新workhorse

    cd /home/git/gitlab

    sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production

    八,更新gitlab-shell

    cd /home/git/gitlab-shell

    sudo -u git -H git fetch --all --tags
    sudo -u git -H git checkout v4.1.1

    九,更新配置文件

    cp config/gitlab.yml.example config/gitlab.yml

    vim config/gitlab.yml

    sudo -u git -H git config --global repack.writeBitmaps true

    十,更新nginx文件

    vim  lib/support/nginx/gitlab-ssl

    vim  lib/support/nginx/gitlab 

    cp lib/support/nginx/gitlab /etc/nginx/conf.d/gitlab.conf

    十一,SMTP配置

    vim config/initializers/smtp_settings.rb   ===>ActionMailer::Base.delivery_method = :smtp

    十二,更新启动脚本

    sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab

    十三,启动服务&检查

    sudo service gitlab start
    sudo service nginx restart

    sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

    sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

    ##################################################8.16升级至8.17##############################

    一,停止服务

    service gitlab stop

    二,备份

    三,更新ruby

    ruby > 2.3    ===========》使用2.3.3

    npm   2.14.12

    node 4.3.0   

    /////////gcc  6.3.0====》不升级,会导致后续升级问题

    四,获取最新代码

    cd /home/git/gitlab

    sudo -u git -H git fetch --all
    sudo -u git -H git checkout -- db/schema.rb

    sudo -u git -H git checkout 8-17-stable

    五,更新lib等

    sudo -u git -H bundle install --without postgres development test --deployment
    sudo -u git -H bundle clean
    sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production

    npm install --production

    sudo -u git -H bundle exec rake gitlab:assets:clean gitlab:assets:compile cache:clear RAILS_ENV=production

    六,更新workhorse

    sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production

    七,更新gitlab-shell

    cd /home/git/gitlab-shell

    sudo -u git -H git fetch --all --tags

    sudo -u git -H git checkout v4.1.1

    八,更新配置文件

    cd /home/git/gitlab

    cd config

    cp gitlab.yml.example gitlab.yml

    vim gitlab.yml

    九,git设置

    sudo -u git -H git config --global repack.writeBitmaps true

    十,nginx配置

    cp lib/support/nginx/gitlab /etc/nginx/conf.d/gitlab_8.17

    vim /etc/nginx/nginx.conf

    十一,更新启动脚本

    cd /home/git/gitlab

    sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab

    十二,启动服务&检查运行

    sudo service gitlab start
    sudo service nginx restart
    sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
    sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

     #######################################8.17升级至9.0############################

    一,停止服务

    service gitlab stop

    二,更新ruby/node&安装yarn

    ruby 更新=======》跳过   =====》见上次升级 or 上上次

    更新node  =====>跳过

    安装yarn:   ===(1.12.3)

    curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

    sudo yum install yarn

    三,获取新代码

    cd /home/git/gitlab

    sudo -u git -H git fetch --all
    sudo -u git -H git checkout -- db/schema.rb

    sudo -u git -H git checkout 9-0-stable

    四,更新gitlab-shell

    cd /home/git/gitlab-shell

    sudo -u git -H git fetch --all --tags

    sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_SHELL_VERSION)

    五,更新workhorse

    cd /home/git/gitlab-workhorse

    sudo -u git -H git fetch --all --tags

    sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_WORKHORSE_VERSION)

    sudo -u git -H make

    六,更新配置文件

    cd /home/git/gitlab

    cp config/gitlab.yml.example config/gitlab.yml

    七,git配置

    sudo -u git -H git config --global repack.writeBitmaps true

    八,nginx配置

     cp lib/support/nginx/gitlab /etc/nginx/conf.d/gitlab9.conf

     vim /etc/nginx/conf.d/gitlab9.conf

     vim /etc/nginx/nginx.conf

    九,更新启动脚本

    sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab

    十,更新lib等

    yum install re2-devel

    sudo -u git -H bundle install --without postgres development test --deployment

    sudo -u git -H bundle clean

    sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production

    mkdir -p /home/git/gitlab/node_modules/compression-webpack-plugin/node_modules

    chown -R git:git /home/git/gitlab/node_modules/compression-webpack-plugin/node_modules

    su - git

    cd /home/git/gitlab

    bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile RAILS_ENV=production NODE_ENV=production   ===>成功后回到root用户

    安装gitly======>暂时跳过

    十一,启动服务&监控变化

    service gitlab start

    service nginx restart

    sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

    sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

  • 相关阅读:
    Linux常用指令
    maven报错 java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors
    Idea 项目jdk环境配置
    Idea 设置maven配置文件settings.xml的位置
    IntelliJ IDEA常用快捷键总结
    Idea 一个窗口打开多个项目
    Git 下拉项目
    Git 删除本地保存的账号和密码
    mysql 查询奇偶数
    redis 短信验证码
  • 原文地址:https://www.cnblogs.com/zy1234567/p/9962508.html
Copyright © 2020-2023  润新知