Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5483c2b0
Commit
5483c2b0
authored
May 18, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
How to dump a production DB to staging
parent
c9c44e7f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
doc/development/README.md
doc/development/README.md
+1
-0
doc/development/db_dump.md
doc/development/db_dump.md
+45
-0
No files found.
doc/development/README.md
View file @
5483c2b0
...
...
@@ -7,3 +7,4 @@
-
[
Sidekiq debugging
](
sidekiq_debugging.md
)
-
[
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
-
[
How to dump production data to staging
](
dump_db.md
)
doc/development/db_dump.md
0 → 100644
View file @
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
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment