gitlab 备份与恢复

gitlab 安装于黑群晖,是群晖自有版本。

第一次升级手动下载12.10.6,安装失败,提示redis下载失败显示已经安装了12.10.6,需要修复

卸载群晖gitlab,直接搜索安装docker版的gitlab ce 11.11.8
安装还算顺利,配置目录映射和端口,其他基本没动
然后开bash,进入终端,rake gitlab:backup:restore RAILS_ENV=production BACKUP=1625992100_2021_07_11_11.11.8一直报错,找不到rakefile
搜索了一下,才发现应该使用gitlab-rake恢复OK
gitlab-ctl reconfiguregitlab-ctl restart

  • 还是报500错误,无法登录

log中发现:{ “method”: “POST”, “path”: “/users/sign_in”, “format”: “html”, “controller”: “SessionsController”, “action”: “create”, “status”: 500, “error”: “ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: null value in column \”id\” violates not-null constraint\nDETAIL: Failing row contains (null, 2, SecurityEvent, 2, User, —\n:with: standard\n:target_id: 2\n:target_type: User\n:target_det…, 2021-07-12 03:52:35.682732, 2021-07-12 03:52:35.682732).\n: INSERT INTO \”audit_events\” (\”author_id\”, \”type\”, \”entity_id\”, \”entity_type\”, \”details\”, \”created_at\”, \”updated_at\”) VALUES (2, ‘SecurityEvent’, 2, ‘User’, ‘—\n:with: standard\n:target_id: 2\n:target_type: User\n:target_details: mingyang wu\n’, ‘2021-07-12 03:52:35.682732’, ‘2021-07-12 03:52:35.682732’) RETURNING \”id\””, “duration”: 2954.65, “view”: 0.0, “db”: 158.04, “time”: “2021-07-12T03:52:32.741Z”, “params”: [  {   “key”: “utf8”,   “value”: “✓”  },  {   “key”: “authenticity_token”,   “value”: “[FILTERED]”  },  {   “key”: “user”,   “value”: {    “login”: “minyoad@gmail.com”,    “password”: “[FILTERED]”,    “remember_me”: “0”   }  } ], “remote_ip”: “59.60.10.194”, “user_id”: 2, “username”: “wmingyang”, “ua”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.64”, “queue_duration”: 13.01, “correlation_id”: “zBrUR6Nkap5”}
audit_events 的sequence 丢失解决办法:
gitlab-rails dbconsole
create SEQUENCE audit_events_id_seq OWNED BY audit_events.id;ALTER TABLE ONLY audit_events ALTER COLUMN id SET DEFAULT nextval(‘audit_events_id_seq’::regclass);

  • merge request 500

“error”: “ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR:  null value in column \”id\” violates not-null constraint\nDETAIL:  Failing row contains (null, 2, 79).\n: INSERT INTO \”merge_request_assignees\” (\”user_id\”, \”merge_request_id\”) VALUES (2, 79) RETURNING \”id\””,

create SEQUENCE merge_request_assignees_id_seq OWNED BY merge_request_assignees.id;ALTER TABLE ONLY merge_request_assignees ALTER COLUMN id SET DEFAULT nextval(‘merge_request_assignees_id_seq’::regclass);

SELECT setval('merge_request_assignees_id_seq', 62, true); 

“error”: “ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR:  null value in column \”id\” violates not-null constraint\nDETAIL:  Failing row contains (null, empty, 80, 2021-07-16 16:49:45.504076, 2021-07-16 16:49:45.504076, null, null, null, null, null, diff-, null, null).\n: INSERT INTO \”merge_request_diffs\” (\”state\”, \”merge_request_id\”, \”created_at\”, \”updated_at\”, \”external_diff\”) VALUES (’empty’, 80, ‘2021-07-16 16:49:45.504076’, ‘2021-07-16 16:49:45.504076’, ‘diff-‘) RETURNING \”id\””, create SEQUENCE merge_request_diffs_id_seq OWNED BY merge_request_diffs.id;ALTER TABLE ONLY merge_request_diffs ALTER COLUMN id SET DEFAULT nextval(‘merge_request_diffs_id_seq’::regclass);SELECT setval(‘merge_request_diffs_id_seq’, (select max(id) from merge_request_diffs), true); 

参考:gitlab迁移及迁移后500问题 – SegmentFault 思否

Update migration procedure (#2827) · Issues · GitLab.org / GitLab FOSS · GitLab

  • docker版

进入bash,bin目录下

rake gitlab:backup:create RAILS_ENV=production  
# 你会找到一个类似 /home/git/data/backups/1531046569_2018_07_14_10.6.4_gitlab_backup.tar 的文件 rake gitlab:backup:restore RAILS_ENV=production BACKUP=1625992100_2021_07_11_11.11.8

参考:
GitLab升级维护及升级后报500错误_周二也被占用-CSDN博客

  • 外部URL设置

external_url ‘https://gitlab.example.com:9443’
nginx[‘listen_port’] = 80   #如果不设置,默认与external_url的端口一致nginx[‘listen_https’] = false
参考:GitLab on Synology: set ‘external_url’ – mixable Blog

  • merge request 500错误

postgresql – Postgres manually alter sequence – Stack OverflowSELECT 'SELECT SETVAL(' || quote_literal(quote_ident(PGT.schemaname) || '.' || quote_ident(S.relname)) || ', COALESCE(MAX(' ||quote_ident(C.attname)|| '), 1) ) FROM ' || quote_ident(PGT.schemaname)|| '.'||quote_ident(T.relname)|| ';' FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C, pg_tables AS PGT WHERE S.relkind = 'S' AND S.oid = D.objid AND D.refobjid = T.oid AND D.refobjid = C.attrelid AND D.refobjsubid = C.attnum AND T.relname = PGT.tablename ORDER BY S.relname;

  • 升级到12.0.12

docker升级后,ci-cd配置的500 错误竟然消失了再次升级后,cicd 500 问题依旧参考:Project CI/CD-Settings broken – How to Use GitLab – GitLab ForumGitLab 迁移之后的事情 – 苏洋博客 (soulteary.com)
works fine without restarting or reconfiguring gitlabhq_production=> update Projects set runners_token_encrypted = null;全部设置为null即可。

问题原因

再次查看备份与恢复 的文档,发现 GitLab 在恢复备份过程中,对于下面的文件是不会进行备份和恢复操作的。 /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab.rb /home/git/gitlab/config/secrets.yml

而被恢复的数据库中包含双因子加密验证的数据,其中的一个解密因子被保存在了 gitlab-secrets.json 中,如果你不进行手动合并操作,那么你的新 GitLab 应用中涉及到需要双因子解密的数据将都不可用,而 GitLab 在代码中也没有对这类情况作一些额外操作,就导致页面报 500 错误,显示不可访问。

  • 升级路径

 11.11.8 -> 12.0.12 -> 12.1.17 -> 12.10.14 -> 13.0.14 -> 13.1.11 -> latest 13.12.Z -> latest 14.0.Z -> 14.1.Z -> latest 14.Y.Z经过了几天的折腾,终于到了13.12了,真是不容易啊

babun 访问gitlab 每次弹出用户名密码

问题:

使用babun自带的git,因为工作项目是放在gitlab上,但是每次git pull,都会弹出询问用户名密码,设置了ssh key也是如此。

解决方案:

http://stackoverflow.com/a/36721316/4377192

Get the GCMW’s latest release, download the zip file (not the installer), extract it’s contents (only .dll and .exe files are needed) to C:\cygwin\usr\libexec\git-core\ for 32-bit Cygwin, or C:\cygwin64\usr\libexec\git-core\ for 64-bit Cygwin. Reference

To tell git to use GCMW, execute: git config --global credential.helper manager

To get GUI prompts for credentials, execute: git config --global credential.modalprompt true

If you want this to be a per-repository setting, remove the --global option.

来源: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/146

下载gcmw的zip包,把里面的EXE,DLL文件都拷贝到babun的git-core 目录下

%Profile%\.babun\cygwin\usr\libexec\git-core\

然后设置

git config –global credential.helper manager

如果只是单项目的,移除–global即可

整合的babun下载:

http://www.odrive.tk/?/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/babun-1.2.0-dist.zip

GDB debug setting for lazarus

GDB_on_OS_X_Mavericks_or_newer_and_Xcode_5_or_newer

Codesigning gdb

https://sourceware.org/gdb/wiki/BuildingOnDarwin#Method_for_Mac_OS_X_10.5_.28Leopard.29_and_later

Mac(os x)下使用gdb的问题

codesign 之后,运行出现

sudo codesign -fs gdb-cert /usr/local/bin/gdb

The GDB command:
"-gdb-set confirm off"
did not return any result.

终端执行gdb

dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.6.dylib
Referenced from: /usr/local/bin/gdb
Reason: image not found
[1] 25803 trace trap gdb

参考:
cannot run gdb on mac's terminal even after codesign

build gdb from source

  1. download source from
    ftp://sourceware.org/pub/gdb/releases/
  2. build

    ./configure
    make
    sudo make install

    build error

probe.c:63:28: error: default initialization of an object of const type 'const any_static_probe_ops' without a user-provided default

https://news.ycombinator.com/item?id=16275140

fixed: remove const

- const any_static_probe_ops any_static_probe_ops;
+ any_static_probe_ops any_static_probe_ops;

使用iresign企业证书重新签名ipa

首先说说对ipa重签的作用。

作用一:

有时候公司在进行软件开发的时候, 发布软件初期使用的是个人账号或者是公司账号,但是因为某种需要要使用企业账号进行分发这个应用,但是这时候可能出现一个问题就是不能再次使用原来的BundleId了,苹果规定BundleId必须是唯一的,更换BundleId就可以解决问题。但是新的问题就出现了,因为原先的微博、统计、以及推送的功能就失效了,这样又要重新配置新的BundleId,而且会对以前的版本造成影响。这时候就要使用到ipa重签解决问题了。(注:此方法只适用于iOS8.1.3以下版本)

http://stackoverflow.com/questions/15634188/resigning-an-ios-provisioning-profile(方法已经失效)

作用二:

手机不想越狱,但是又想使用APPStore上面的收费软件,我们如何解决呢?其实很多苹果助手就是用企业证书把APP重签提供下载的。作为iOS开发者的我们,也可以使用自己的证书进行重签,以测试的身份使用APP。

方法:

我们使用iReSign这个软件(https://github.com/maciekish/iReSign

iresign证书重签

1011166-271f461b0867991d

选择对应的ipa文件和自己的证书描述文件,然后选中自己的开发证书,点击“重新签名”即可。

然后我们就可以使用itools等工具将软件装到手机里。

Delphi XE5 lite 8.0 百度盘下载

image

为了便于在 Lite 8.0 中集成 freecat、huayan889、sinner、yuto 等大侠的特别补丁,写了这个:Activator.exe

主要作用:

1、整合 freecat、gateway、huayan889、sinner、yuto 的特别补丁、sn、cglm.ini 等
2、经测试,yuto 提供的方法较为稳定,Keygen.exe 方法暂时保留

相对原始部署方式,这个 Activator 实现“一键激活”!

继续阅读