gitlab迁徙
背景
- 之前gitlab在阿里云机部署,因为外网绝对不平安思考迁到内网
环境
- gitlab-11.11.3 docker部署
施行
- 备份
docker exec -ti gitlab bashgitlab-rake gitlab:backup:createdocker cp gitlab:/var/opt/gitlab/backups/1612427334_2021_02_04_11.11.3_gitlab_backup.tar .
- 在内网机器启动雷同版本gitlab(gitlab备份复原须要雷同版本)
docker exec -ti gitlab bashmv 1612427334_2021_02_04_11.11.3_gitlab_backup.tar /var/opt/gitlab/backups/chmod 755 /var/opt/gitlab/backups/1612427334_2021_02_04_11.11.3_gitlab_backup.tarchown root:root /var/opt/gitlab/backups/1612427334_2021_02_04_11.11.3_gitlab_backup.targitlab-rake gitlab:backup:restore BACKUP=1612427334_2021_02_04_11.11.3
问题
1.进入ci/cd runner页面报500
gitlab-rails consoleCi::Runner.all.update_all(token_encrypted: nil)gitlab-rails dbconsoleUPDATE projects SET runners_token = null, runners_token_encrypted = null;
2.新建用户,在强制用户批改明码时报500
log 显示相似: 因为没有第一工夫写文章,日志显示相似,不是我遇到的日志。
The form contains the following error: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint DETAIL: Failing row contains (null, 164, t). : INSERT INTO "project_ci_cd_settings" ("project_id") VALUES (164) RETURNING "id"
解决思路:查看对应表有没有null值,启动全新的gitlab比照表构造
解决:
gitlabhq_production=> CREATE SEQUENCE user_preference_id_seq INCREMENT BY 1 NO MINVALUE NO MAXVALUE START WITH 106 OWNED BY user_preferences.id; 从新创立sequencegitlabhq_production=> ALTER TABLE user_preferences ALTER COLUMN id SET DEFAULT NEXTVAL('user_preference_id_seq'::regclass); 复原表构造修饰符
3.创立merge时指定给用户时,提交后500
gitlab日志:
==> /var/log/gitlab/postgresql/current <==2021-03-18_05:52:05.23424 ERROR: null value in column "id" violates not-null constraint2021-03-18_05:52:05.23427 DETAIL: Failing row contains (null, 61, 4046).2021-03-18_05:52:05.23427 STATEMENT: INSERT INTO "merge_request_assignees" ("user_id", "merge_request_id") VALUES (61, 4046) RETURNING "id"
解决:
gitlabhq_production=> CREATE SEQUENCE merge_request_assignees_id_seq INCREMENT BY 1 NO MINVALUE NO MAXVALUE START WITH 106 OWNED BY merge_request_assignees.id; 从新创立sequencegitlabhq_production=> ALTER TABLE merge_request_assignees ALTER COLUMN id SET DEFAULT NEXTVAL('merge_request_assignees_id_seq'::regclass); 复原表构造修饰符