赞
踩
GitLab 是一个全球知名的一体化 DevOps 平台,很多人都通过私有化部署 GitLab 来进行源代码托管。极狐GitLab :https://gitlab.cn/install?channel=content&utm_source=csdn 是 GitLab 在中国的发行版,专门为中国程序员服务。可以一键式部署极狐GitLab。
极狐GitLab 在 5 月 28 日正式发布了 AI 产品驭码CodeRider。现已开启免费试用,登录官网:https://coderider.gitlab.cn/ 即可申请试用。
更多关于极狐GitLab :https://gitlab.cn 或者 DevOps 的最佳实践,可以关注文末的极狐GitLab 公众号。
搜索【极狐GitLab】公众号,后台输入加群,备注gitlab,即可加入官方微信技术交流群。
本指南记录了如何配置启用极狐独立数据库。
要使用极狐独立数据库,你需要将极狐GitLab 实例配置为使用多数据库支持。
极狐独立数据库目前仅支持 Linux 安装包,暂不支持其他如 Docker 等方式的极狐GitLab。
如果是全新安装,请先按照安装方法让极狐GitLab 实例启动运行起来。
创建配置的备份:
sudo cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.org
/etc/gitlab/gitlab.rb
并保存更改。### Gitlab JH database settings
gitlab_rails['databases']['jh']['enable'] = true
gitlab_rails['databases']['jh']['db_database'] = "gitlabhq_production_jh"
gitlab_rails['databases']['jh']['db_database_tasks'] = true
gitlab_rails['databases']['jh']['db_migrations_paths'] = "jh/db/migrate"
gitlab_rails['databases']['jh']['db_schema_migrations_path'] = "jh/db/schema_migrations"
sudo su - gitlab-psql
/bin/bash
psql -h /var/opt/gitlab/postgresql -d template1
# 在 psql 内执行
ALTER USER gitlab CREATEDB;
运行 sudo gitlab-ctl reconfigure
命令
运行迁移脚本:
# 步骤一
sudo gitlab-rails db:create:jh
# 步骤二
sudo gitlab-rails db:migrate:jh
gitlabhq_production_jh
)已经被正确创建好:sudo gitlab-psql -c 'select version()'
-------------------------------------------------------
PostgreSQL 13.11 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, 64-bit
(1 row)
sudo gitlab-psql -c 'SELECT pg_database.datname as "dbname", pg_database_size(pg_database.datname)/1024/1024 AS size_in_mb FROM pg_database ORDER by size_in_mb DESC'
# 在输出列表中应该能看到 `gitlabhq_production_jh` 出现
dbname | size_in_mb
------------------------+------------
gitlabhq_production | 71
gitlabhq_production_jh | 7
sudo gitlab-ctl restart
重启极狐GitLab 实例。此时,极狐GitLab 实例应该启动并正常运行,且已同时支持主数据库和极狐独立数据库。
目前暂时不支持gitlab-backup的备份方式。可以使用 PostgreSQL 的工具来进行备份和恢复。
sudo su - gitlab-psql
$ pg_dump -h /var/opt/gitlab/postgresql -d gitlabhq_production_jh -f /path/to/backup/jhdb_bak.sql
sudo su - gitlab-psql
$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production_jh < /path/to/backup/jhdb_bak.sql
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。