docker exec -ti gitlab bash gitlab-rake gitlab:backup:create docker cp gitlab:/var/opt/gitlab/backups/1612427334_2021_02_04_11.11.3_gitlab_backup.tar .
docker exec -ti gitlab bash mv 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.tar chown root:root /var/opt/gitlab/backups/1612427334_2021_02_04_11.11.3_gitlab_backup.tar gitlab-rake gitlab:backup:restore BACKUP=1612427334_2021_02_04_11.11.3
1.進入ci/cd runner頁面報500git
gitlab-rails console Ci::Runner.all.update_all(token_encrypted: nil) gitlab-rails dbconsole UPDATE projects SET runners_token = null, runners_token_encrypted = null;
2.新建用戶,在強制用戶修改密碼時報500
log 顯示相似: 由於沒有第一時間寫文章,日誌顯示相似,不是我遇到的日誌。sql
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對比表結構docker
gitlabhq_production=> CREATE SEQUENCE user_preference_id_seq INCREMENT BY 1 NO MINVALUE NO MAXVALUE START WITH 106 OWNED BY user_preferences.id; 從新建立sequence gitlabhq_production=> ALTER TABLE user_preferences ALTER COLUMN id SET DEFAULT NEXTVAL('user_preference_id_seq'::regclass); 恢復表結構修飾符
3.建立merge時指定給用戶時,提交後500
gitlab日誌:shell
==> /var/log/gitlab/postgresql/current <== 2021-03-18_05:52:05.23424 ERROR: null value in column "id" violates not-null constraint 2021-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; 從新建立sequence gitlabhq_production=> ALTER TABLE merge_request_assignees ALTER COLUMN id SET DEFAULT NEXTVAL('merge_request_assignees_id_seq'::regclass); 恢復表結構修飾符