GitLab CE 8.9 升级/迁移到GitLab CE 9.3.4

这篇文章不记录Gitlab的使用方法,更不说明Gitlab的特性,只记录的升级步骤以及遇到的问题。由于升级的版本跨度有点大,Gitlab本身的备份\还原并不适合此次的迁移。

部署环境:

阿里云ECS 4核\8G\40G  CentOS 7.3.1611
阿里云RDS PostgreSQL 9.4
gitlab-ce-9.3.4-ce.0.el7.x86_64
nginx/1.10.2

迁移流程:
1、在新机器上部署GitLab,我们采用RPM包的方式安装。
2、编辑/etc/gitlab/gitlab.rb

external_url 'https://gitlab.xxxxx.com'  #git的URL,启用SSL就写https,反之就写http
gitlab_rails['time_zone'] = 'UTC'
gitlab_rails['gitlab_email_enabled'] = true  #启用Email
gitlab_rails['gitlab_email_from'] = 'user@host.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab email notification'
gitlab_rails['db_adapter'] = "postgresql"      #gitlab使用的数据库,mysql/postgresql
gitlab_rails['db_encoding'] = "utf8"
gitlab_rails['db_collation'] = nil
gitlab_rails['db_database'] = "gitlab_production"
gitlab_rails['db_pool'] = 10
gitlab_rails['db_username'] = "gitlab_user"
gitlab_rails['db_password'] = "*********"
gitlab_rails['db_host'] = "xxxx.pg.aliyun.com"
gitlab_rails['db_port'] = 3433
gitlab_rails['db_socket'] = nil
gitlab_rails['db_sslmode'] = nil
gitlab_rails['db_sslrootcert'] = nil
gitlab_rails['db_prepared_statements'] = true
gitlab_rails['db_statements_limit'] = 1000
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtpdm.aliyun.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "user@host.com"
gitlab_rails['smtp_password'] = "******"
gitlab_rails['smtp_domain'] = "user@host.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
postgresql['enable'] = false                                    #禁用自带postgressql
web_server['external_users'] = ['nginx']
nginx['enable'] = false                                            #禁用自带nginx
prometheus['enable'] = true
prometheus['monitor_kubernetes'] = true
prometheus['username'] = 'gitlab-prometheus'
prometheus['uid'] = nil
prometheus['gid'] = nil
prometheus['shell'] = '/bin/sh'
prometheus['home'] = '/var/opt/gitlab/prometheus'
prometheus['log_directory'] = '/var/log/gitlab/prometheus'
prometheus['scrape_interval'] = 15
prometheus['scrape_timeout'] = 15
prometheus['chunk_encoding_version'] = 2
prometheus['listen_address'] = '0.0.0.0:9090'                #修改prometheus的监听地址
prometheus_monitoring['enable'] = true

3、由于这台机器有好几个访问域名,需要共用一个nginx,所以就没用gitlab自带的Nginx。
配置nginx:

cat /etc/nginx/nginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"'
                      '$connection $upstream_addr '
                      'upstream_response_time $upstream_response_time';

access_log  /var/log/nginx/access.log  main;

sendfile            on;
    tcp_nopush          on;
    tcp_nodelay        on;
    keepalive_timeout  65;
    types_hash_max_size 2048;
        server_tokens off;

include            /etc/nginx/mime.types;
    default_type        application/octet-stream;
        client_body_buffer_size 3072k;
        proxy_buffers          16 2048k;
        proxy_buffer_size      512k;

connection_pool_size            256;
        client_header_buffer_size      1k;
        large_client_header_buffers    8 4k;
        request_pool_size              4k;
        client_max_body_size            128m ;

output_buffers  1 32k;
        postpone_output 1460;

ignore_invalid_headers  on;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/12578.html