• gitlab 源码安装=》rpm安装横向迁移(version 9.0)


    准备:

    下载版本地址:

    https://packages.gitlab.com/gitlab/gitlab-ce

    迁移环境:

    源码安装的gitlab9.0.13

    目标迁移至9.0.13 RPM安装的环境

    ###################源码安装gitlab9.0.13############参考官方文档

    https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/

    ###################RPM安装gitlab9.0.13#######################

    https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

    OS :rhel7.4

    关闭防火墙: setenforce 0

    修改主机名: vim /etc/hostname  /etc/sysconfig/network   /etc/hosts

    安装依赖包:

    yum install curlopenssh-server openssh-clients postfix -y

    安装glibc新版:

     rpm -ivh gitlab-ce-9.x.x-ce.0.el7.x86_64.rpm

     编辑文件

    vim /etc/gitlab/gitlab.rb

    修改如下:

    external_url 'http://10.2.177.57:8090'

    重置配置

    gitlab-ctl reconfigure

    gitlab-ctl restart

     #################################备份还原#####################

    一,备份

    cd /home/git/gitlab

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

    cd tmp/backups/

     scp XXXX  root@IP:/var/opt/gitlab/backups/

    二,RPM服务器停止服务

    gitlab-ctl stop unicorn
    gitlab-ctl stop sidekiq

    cd /var/opt/gitlab/backups/

    gitlab-rake gitlab:backup:restore BACKUP=1542476495_2018_11_18

    =======》报错    =====》解决: ln -s /usr/local/mysql/bin/mysql  /usr/bin/mysql

    Errno::ENOENT: No such file or directory - mysql
    /opt/gitlab/embedded/service/gitlab-rails/lib/backup/database.rb:58:in `spawn'
    /opt/gitlab/embedded/service/gitlab-rails/lib/backup/database.rb:58:in `restore'
    /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:102:in `block (4 levels) in <top (required)>'
    /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:53:in `block (3 levels) in <top (required)>'
    /opt/gitlab/embedded/bin/bundle:22:in `load'
    /opt/gitlab/embedded/bin/bundle:22:in `<main>'
    Tasks: TOP => gitlab:backup:db:restore
    (See full trace by running task with --trace)

    仓库要单独打包还原到/var/opt/gitlab/git-data/repositories

    三,启动服务

    gitlab-ctl start 

    四,额外配置

    假设源码使用的MySQL数据库

    修改RPM默认的数据库

    1)登陆MySQL&配置

    CREATE USER 'git'@'localhost' IDENTIFIED BY '123456';

    SET GLOBAL innodb_file_per_table=1, innodb_file_format=Barracuda, innodb_large_prefix=1;

    CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_general_ci`;

    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES, REFERENCES ON `gitlabhq_production`.* TO 'git'@'localhost';

    flush privileges;

    2)修改gitlab配置文件

    vim /etc/gitlab/gitlab.rb

    gitlab_rails['db_adapter'] = "mysql2"
    gitlab_rails['db_encoding'] = "utf8"
    gitlab_rails['db_database'] = "gitlabhq_production"
    gitlab_rails['db_username'] = "git"
    gitlab_rails['db_password'] = "123456"
    gitlab_rails['db_host'] = "127.0.0.1"
    gitlab_rails['db_port'] = 3306
    postgresql['enable'] = false

    3)消除postgresql依赖

    vim /opt/gitlab/embedded/service/gitlab-rails/.bundle/config

    修改内容为:

    BUNDLE_WITHOUT: "development:test:postgres"  ===》MySQL改为postgres

    保存

    重新启动配置

    gitlab-ctl reconfigure

    4)安装MySQL依赖

    cd /opt/gitlab/embedded/bin/

    ./gem install mysql2  -v “0.3.20” ===>默认安装的是0.3.20

    gitlab-rake gitlab:check  ====》运行该命令会提示版本是否正确  ===》其余信息不用看

      ==>这里可能i显示没有mysql2 0.3.20版本,修改Gemfile文件,修改完成cd /opt/gitlab/embedded/service/gitlab-rails/  && /opt/gitlab/embedded/bin/bundle install

    gitlab-rake gitlab:setup  gitlab初始化

    初始化完成之后可以执行 gitlab-rake gitlab:check检查

    5)启动服务

    gitlab-ctl restart

    gitlab-ctl status 查看启动信息

  • 相关阅读:
    ArcGIS添加鹰眼
    C#设计模式--工厂方法
    C#设计模式--简单工厂
    C# 单例模式(转)
    事务的 原子性、一致性、隔离性、持久性
    asp.net 常用的3中身份验证
    angular localStorage使用方法
    angular.js升序降序过滤器
    ionic中$ionicPopover和$ionicModal
    ionic的弹出框$ionicPopover
  • 原文地址:https://www.cnblogs.com/zy1234567/p/9971409.html
Copyright © 2020-2023  润新知