升级组件
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/10.7-to-10.8.md
sudo -u git -H git fetch --all --prune
sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically
sudo -u git -H git checkout -- locale
sudo -u git -H git checkout -f 10-8-stable
sed -i "s|^source .*|source ‘https://gems.ruby-china.com/’|g" Gemfile
sed -i "s|remote.*|remote: https://gems.ruby-china.com/|g" Gemfile.lock
update gitaly:
sudo -u git -H git fetch --all --tags --prune
sudo -u git -H git checkout v$(</home/git/git/GITALY_SERVER_VERSION)
sudo -u git -H make
数据库表结构变更
vim /home/git/git/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb
vim /home/git/git/db/migrate/20171006090100_create_ci_build_trace_section_names.rb
Mysql2::Error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=': INSERT INTO personal_access_tokens (user_id, token, name, created_at, updated_at, scopes)
SELECT id, authentication_token, 'Private Token', NOW(), NOW(), '---
- api
'
FROM users
WHERE authentication_token IS NOT NULL
AND admin = FALSE
AND NOT EXISTS (
SELECT true
FROM personal_access_tokens
WHERE user_id = users.id
AND token = users.authentication_token
)
alter table personal_access_tokens modify `user_id` int(11) NOT NULL COLLATE utf8_unicode_ci;
alter table personal_access_tokens modify `token` varchar(255) NOT NULL COLLATE utf8_unicode_ci;
Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: ALTER TABLE `uploads` CHANGE `path` `path` varchar(511) NOT NULL
vim /home/git/git/db/migrate/20171103000000_set_uploads_path_size_for_mysql.rb
Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE TABLE `user_custom_attributes` (`id` int(11) auto_increment PRIMARY KEY, `created_at` timestamp DEFAULT 0 NOT NULL, `updated_at` timestamp DEFAULT 0 NOT NULL, `user_id` int(11) NOT NULL, `key` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, UNIQUE INDEX `index_user_custom_attributes_on_user_id_and_key` (`user_id`, `key`) , INDEX `index_user_custom_attributes_on_key_and_value` (`key`, `value`) ) ENGINE=InnoDB
CREATE TABLE `user_custom_attributes` (`id` int(11) auto_increment PRIMARY KEY, `created_at` timestamp DEFAULT 0 NOT NULL, `updated_at` timestamp DEFAULT 0 NOT NULL, `user_id` int(11) NOT NULL, `key` varchar(190) NOT NULL, `value` varchar(190) NOT NULL, UNIQUE INDEX `index_user_custom_attributes_on_user_id_and_key` (`user_id`, `key`) , INDEX `index_user_custom_attributes_on_key_and_value` (`key`, `value`) ) ENGINE=InnoDB;
vim /home/git/git/db/migrate/20170720122741_create_user_custom_attributes.rb
Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE TABLE `project_custom_attributes` (`id` int(11) auto_increment PRIMARY KEY, `created_at` timestamp DEFAULT 0 NOT NULL, `updated_at` timestamp DEFAULT 0 NOT NULL, `project_id` int(11) NOT NULL, `key` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, UNIQUE INDEX `index_project_custom_attributes_on_project_id_and_key` (`project_id`, `key`) , INDEX `index_project_custom_attributes_on_key_and_value` (`key`, `value`) ) ENGINE=InnoDB
CREATE TABLE `project_custom_attributes` (`id` int(11) auto_increment PRIMARY KEY, `created_at` timestamp DEFAULT 0 NOT NULL, `updated_at` timestamp DEFAULT 0 NOT NULL, `project_id` int(11) NOT NULL, `key` varchar(190) NOT NULL, `value` varchar(190) NOT NULL, UNIQUE INDEX `index_project_custom_attributes_on_project_id_and_key` (`project_id`, `key`) , INDEX `index_project_custom_attributes_on_key_and_value` (`key`, `value`) ) ENGINE=InnoDB;
vim /home/git/git/db/migrate/20170918111708_create_project_custom_attributes.rb
Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE TABLE `group_custom_attributes` (`id` int(11) auto_increment PRIMARY KEY, `created_at` timestamp DEFAULT 0 NOT NULL, `updated_at` timestamp DEFAULT 0 NOT NULL, `group_id` int(11) NOT NULL, `key` varchar(255) NOT NULL, `value` varchar(255) NOT NULL, UNIQUE INDEX `index_group_custom_attributes_on_group_id_and_key` (`group_id`, `key`) , INDEX `index_group_custom_attributes_on_key_and_value` (`key`, `value`) ) ENGINE=InnoDB
CREATE TABLE `group_custom_attributes` (`id` int(11) auto_increment PRIMARY KEY, `created_at` timestamp DEFAULT 0 NOT NULL, `updated_at` timestamp DEFAULT 0 NOT NULL, `group_id` int(11) NOT NULL, `key` varchar(190) NOT NULL, `value` varchar(190) NOT NULL, UNIQUE INDEX `index_group_custom_attributes_on_group_id_and_key` (`group_id`, `key`) , INDEX `index_group_custom_attributes_on_key_and_value` (`key`, `value`) ) ENGINE=InnoDB;
vim /home/git/git/db/migrate/20170918140927_create_group_custom_attributes.rb
Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX `index_ci_build_trace_section_names_on_project_id_and_name` ON `ci_build_trace_section_names` (`project_id`, `name`)
alter table ci_build_trace_section_names modify column name varchar(190);
Mysql2::Error: Table 'ci_build_trace_section_names' already exists: CREATE TABLE `ci_build_trace_section_names` (`id` int(11) auto_increment PRIMARY KEY, `project_id` int(11) NOT NULL, `name` varchar(255) NOT NULL) ENGINE=InnoDB
vim /home/git/git/db/migrate/20171006090100_create_ci_build_trace_section_names.rb
Mysql2::Error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=': INSERT INTO personal_access_tokens (user_id, token, name, created_at, updated_at, scopes)
SELECT id, authentication_token, 'Private Token', NOW(), NOW(), '---
- api
'
FROM users
WHERE authentication_token IS NOT NULL
AND admin = FALSE
AND NOT EXISTS (
SELECT true
FROM personal_access_tokens
WHERE user_id = users.id
AND token = users.authentication_token
)
alter table personal_access_tokens modify `user_id` int(11) NOT NULL COLLATE utf8_unicode_ci;
alter table personal_access_tokens modify `token` varchar(255) NOT NULL COLLATE utf8_unicode_ci;
Incorrect string value: /xF0/xA1/x8B/xBE/xE5/xA2… for column 'diff' at row 60: INSERT INTO merge_request_diff_files (`diff`, `new_path`, `old_path`, `a_mode`, `b_mode`, `new_file`, `renamed_file`, `deleted_file`, `too_large`, `binary`, `merge_request_diff_id`, `relative_order`)
#alter table merge_request_diff_files CHARSET=utf8mb4;
https://github.com/jaywcjlove/mysql-tutorial/blob/master/chapter17/17.1.md
http://seanlook.com/2016/10/23/mysql-utf8mb4/
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md#tables-and-data-conversion-to-utf8mb4
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
SET GLOBAL innodb_file_per_table=1, innodb_file_format=Barracuda, innodb_large_prefix=1;
SET GLOBAL log_bin_trust_function_creators = 1;
production:
adapter: mysql2
encoding: utf8mb4
collation: utf8mb4_general_ci
sudo -u git -H bundle exec rake add_limits_mysql RAILS_ENV=production
#Mysql2::Error: Table 'gitlabhq_production.ci_build_trace_chunks' doesn't exist
Data too long for column 'message' at row 102:
https://gitlab.com/gitlab-org/gitlab-ce/issues/9084
show table status from gitlabhq_production_new like 'merge_request_diff_commits' \G;
show create table merge_request_diff_commits \G;
ALTER TABLE `merge_request_diff_commits` CHANGE `message` `message` longtext;
select count(1) from merge_request_diff_files;
以下这步执行略久。。。。。。
mysql> select count(1) from merge_request_diff_commits;
+----------+
| count(1) |
+----------+
| 1093793 |
+----------+
1 row in set (0.18 sec)
mysql> select count(1) from merge_request_diff_files;
+----------+
| count(1) |
+----------+
| 1177319 |
+----------+
1 row in set (43.29 sec)
# 生产中最后升级时的数据
mysql> select count(1) from merge_request_diff_files;
+----------+
| count(1) |
+----------+
| 1217747 |
+----------+
1 row in set (0.44 sec)
== 20171124104327 MigrateKubernetesServiceToNewClustersArchitectures: migrating
Mysql2::Error: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'like': SELECT `services`.* FROM `services` LEFT JOIN projects ON projects.id = services.project_id LEFT JOIN cluster_projects ON cluster_projects.project_id = projects.id LEFT JOIN cluster_platforms_kubernetes ON cluster_platforms_kubernetes.cluster_id = cluster_projects.cluster_id WHERE `services`.`category` = 'deployment' AND `services`.`type` = 'KubernetesService' AND `services`.`template` = 0 AND (services.properties LIKE '%api_url%') AND ((services.properties NOT LIKE CONCAT('%', cluster_platforms_kubernetes.api_url, '%')) OR cluster_platforms_kubernetes.api_url IS NULL) GROUP BY `services`.`id` ORDER BY `services`.`id` ASC LIMIT 1
alter table cluster_platforms_kubernetes modify api_url text COLLATE utf8_unicode_ci;
# 这一步生产环境升级时居然没爆出来,真是神奇
== 20180119121225 RemoveRedundantPipelineStages: migrating ====================
-- execute("UPDATE ci_builds SET stage_id = NULL WHERE stage_id IN (SELECT id FROM ci_stages WHERE (pipeline_id, name) IN (\n SELECT pipeline_id, name FROM ci_stages\n GROUP BY pipeline_id, name HAVING COUNT(*) > 1\n)\n)\n")
执行2个半小时...
explain SELECT id FROM ci_stages WHERE (pipeline_id, name) IN ( SELECT pipeline_id, name FROM ci_stages GROUP BY pipeline_id, name HAVING COUNT(*) > 1);
语句select结果为空,可以注释直接略过去,无意义
vim /home/git/git/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
ActiveRecord::StatementInvalid: Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE UNIQUE INDEX `index_ci_stages_on_pipeline_id_and_name` ON `ci_stages` (`pipeline_id`, `name`)
alter table ci_stages modify name varchar(190);
Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE INDEX `index_uploads_on_uploader_and_path` USING btree ON `uploads` (`uploader`, `path`)
alter table uploads modify column path varchar(190);
alter table uploads modify column uploader varchar(190);
Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE TABLE `deploy_tokens` (`id` int(11) auto_increment PRIMARY KEY, `revoked` tinyint(1) DEFAULT 0, `read_repository` tinyint(1) DEFAULT 0 NOT NULL, `read_registry` tinyint(1) DEFAULT 0 NOT NULL, `expires_at` timestamp DEFAULT 0 NOT NULL, `created_at` timestamp DEFAULT 0 NOT NULL, `name` varchar(255) NOT NULL, `token` varchar(255) NOT NULL, UNIQUE INDEX `index_deploy_tokens_on_token` (`token`) , INDEX `index_deploy_tokens_on_token_and_expires_at_and_id` (`token`, `expires_at`, `id`) ) ENGINE=InnoDB
CREATE TABLE `deploy_tokens` (
`id` int(11) PRIMARY KEY AUTO_INCREMENT,
`revoked` tinyint(1) DEFAULT 0,
`read_repository` tinyint(1) NOT NULL DEFAULT 0,
`read_registry` tinyint(1) NOT NULL DEFAULT 0,
`expires_at` timestamp NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT 0,
`name` varchar(190) NOT NULL,
`token` varchar(190) NOT NULL,
UNIQUE `index_deploy_tokens_on_token` (`token`),
INDEX `index_deploy_tokens_on_token_and_expires_at_and_id`(`token`, `expires_at`, `id`)
) ENGINE = InnoDB
vim /home/git/git/db/migrate/20180319190020_create_deploy_tokens.rb
Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE INDEX `index_project_mirror_data_on_jid` ON `project_mirror_data` (`jid`)
alter table project_mirror_data modify jid varchar(190);
alter table project_mirror_data modify status varchar(190);
前端编译模块
{
"private": true,
"scripts": {
"dev-server": "nodemon -w 'config/webpack.config.js' --exec 'webpack-dev-server --config config/webpack.config.js'",
"eslint": "eslint --max-warnings 0 --ext .js,.vue .",
"eslint-fix": "eslint --max-warnings 0 --ext .js,.vue --fix .",
"eslint-report": "eslint --max-warnings 0 --ext .js,.vue --format html --output-file ./eslint-report.html .",
"karma": "BABEL_ENV=${BABEL_ENV:=karma} karma start --single-run true config/karma.config.js",
"karma-coverage": "BABEL_ENV=coverage karma start --single-run true config/karma.config.js",
"karma-start": "BABEL_ENV=karma karma start config/karma.config.js",
"prettier-staged": "node ./scripts/frontend/prettier.js",
"prettier-staged-save": "node ./scripts/frontend/prettier.js save",
"prettier-all": "node ./scripts/frontend/prettier.js check-all",
"prettier-all-save": "node ./scripts/frontend/prettier.js save-all",
"webpack": "webpack --config config/webpack.config.js",
"webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js"
},
"dependencies": {
"@gitlab-org/gitlab-svgs": "^1.22.0",
"autosize": "^4.0.0",
"axios": "^0.17.1",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-define": "^1.3.0",
"babel-preset-latest": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"blackst0ne-mermaid": "^7.1.0-fixed",
"bootstrap-sass": "^3.3.6",
"brace-expansion": "^1.1.8",
"chart.js": "1.0.2",
"classlist-polyfill": "^1.2.0",
"clipboard": "^1.7.1",
"compression-webpack-plugin": "^1.1.11",
"copy-webpack-plugin": "^4.5.1",
"core-js": "^2.4.1",
"cropper": "^2.3.0",
"css-loader": "^0.28.11",
"d3-array": "^1.2.1",
"d3-axis": "^1.0.8",
"d3-brush": "^1.0.4",
"d3-scale": "^1.0.7",
"d3-selection": "^1.2.0",
"d3-shape": "^1.2.0",
"d3-time": "^1.0.8",
"d3-time-format": "^2.1.1",
"deckar01-task_list": "^2.0.0",
"diff": "^3.4.0",
"document-register-element": "1.3.0",
"dropzone": "^4.2.0",
"emoji-unicode-version": "^0.2.1",
"exports-loader": "^0.7.0",
"file-loader": "^1.1.11",
"fuzzaldrin-plus": "^0.5.0",
"glob": "^7.1.2",
"imports-loader": "^0.8.0",
"jed": "^1.1.1",
"jquery": "^3.2.1",
"jquery-ujs": "1.2.2",
"jquery.waitforimages": "^2.2.0",
"js-cookie": "^2.1.3",
"jszip": "^3.1.3",
"jszip-utils": "^0.0.2",
"katex": "^0.8.3",
"marked": "^0.3.12",
"monaco-editor": "0.10.0",
"mousetrap": "^1.4.6",
"pikaday": "^1.6.1",
"prismjs": "^1.6.0",
"raphael": "^2.2.7",
"raven-js": "^3.22.1",
"raw-loader": "^0.5.1",
"sanitize-html": "^1.16.1",
"select2": "3.5.2-browserify",
"sha1": "^1.1.1",
"sql.js": "^0.4.0",
"style-loader": "^0.21.0",
"svg4everybody": "2.1.9",
"three": "^0.84.0",
"three-orbit-controls": "^82.1.0",
"three-stl-loader": "^1.0.4",
"timeago.js": "^3.0.2",
"underscore": "^1.9.0",
"url-loader": "^1.0.1",
"visibilityjs": "^1.2.4",
"vue": "^2.5.16",
"vue-loader": "^14.1.1",
"vue-resource": "^1.5.0",
"vue-router": "^3.0.1",
"vue-template-compiler": "^2.5.16",
"vue-virtual-scroll-list": "^1.2.5",
"vuex": "^3.0.1",
"webpack": "^4.7.0",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^2.1.2",
"webpack-stats-plugin": "^0.2.1",
"worker-loader": "^1.1.1"
},
"devDependencies": {
"axios-mock-adapter": "^1.10.0",
"babel-eslint": "^8.0.2",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-rewire": "^1.1.0",
"babel-template": "^6.26.0",
"babel-types": "^6.26.0",
"chalk": "^2.4.1",
"commander": "^2.15.1",
"eslint": "^3.18.0",
"eslint-config-airbnb-base": "^10.0.1",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-filenames": "^1.1.0",
"eslint-plugin-html": "2.0.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jasmine": "^2.1.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-vue": "^4.0.1",
"ignore": "^3.3.7",
"istanbul": "^0.4.5",
"jasmine-core": "^2.9.0",
"jasmine-jquery": "^2.1.1",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "^1.1.1",
"karma-mocha-reporter": "^2.2.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "3.0.0",
"nodemon": "^1.17.3",
"prettier": "1.11.1",
"webpack-dev-server": "^3.1.4"
}
}
升级后验证
格式写的这个凌乱!
@商品团队 哈哈