Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5483c2b0
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5483c2b0
编写于
5月 18, 2015
作者:
J
Jacob Vosmaer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
How to dump a production DB to staging
上级
c9c44e7f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
0 deletion
+46
-0
doc/development/README.md
doc/development/README.md
+1
-0
doc/development/db_dump.md
doc/development/db_dump.md
+45
-0
未找到文件。
doc/development/README.md
浏览文件 @
5483c2b0
...
@@ -7,3 +7,4 @@
...
@@ -7,3 +7,4 @@
-
[
Sidekiq debugging
](
sidekiq_debugging.md
)
-
[
Sidekiq debugging
](
sidekiq_debugging.md
)
-
[
UI guide
](
ui_guide.md
)
for building GitLab with existing css styles and elements
-
[
UI guide
](
ui_guide.md
)
for building GitLab with existing css styles and elements
-
[
Migration Style Guide
](
migration_style_guide.md
)
for creating safe migrations
-
[
Migration Style Guide
](
migration_style_guide.md
)
for creating safe migrations
-
[
How to dump production data to staging
](
dump_db.md
)
doc/development/db_dump.md
0 → 100644
浏览文件 @
5483c2b0
# Importing a database dump into a staging enviroment
Sometimes it is useful to import the database from a production environment
into a staging environment for testing. The procedure below assumes you have
SSH+sudo access to both the production environment and the staging VM.
On the staging VM, add the following line to
`/etc/gitlab/gitlab.rb`
to speed up
large database imports.
```
# On STAGING
echo "postgresql['checkpoint_segments'] = 64" | sudo tee -a /etc/gitlab/gitlab.rb
sudo touch /etc/gitlab/skip-auto-migrations
sudo gitlab-ctl reconfigure
```
Next, we let the production environment stream a compressed SQL dump to our
local machine via SSH, and redirect this stream to a psql client on the staging
VM.
```
# On LOCAL MACHINE
ssh -C gitlab.example.com sudo -u gitlab-psql /opt/gitlab/embedded/bin/pg_dump -Cc gitlabhq_production |\
ssh -C staging-vm sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -d template1
```
## Recreating directory structure
If you need to re-create some directory structure on the staging server you can
use this procedure.
First, on the production server, create a list of directories you want to
re-create.
```
# On PRODUCTION
(umask 077; sudo find /var/opt/gitlab/git-data/repositories -maxdepth 1 -type d -print0 > directories.txt)
```
Copy
`directories.txt`
to the staging server and create the directories there.
```
# On STAGING
sudo -u git xargs -0 mkdir -p < directories.txt
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录