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
8171c6ca
Commit
8171c6ca
authored
Mar 22, 2022
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: GDK defaults to multiple databases
Add steps on how to switch back to single database
parent
81f5f80f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
116 deletions
+4
-116
doc/development/database/multiple_databases.md
doc/development/database/multiple_databases.md
+4
-116
No files found.
doc/development/database/multiple_databases.md
View file @
8171c6ca
...
...
@@ -15,34 +15,14 @@ To scale GitLab, the we are
database for CI/CD tables was
[
introduced
](
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64289
)
in GitLab 14.1. This feature is still under development, and is not ready for production use.
###
Development setup
###
Configure single database
By default, GitLab is configured to use only one main database. To
opt-in to use a main database, and CI database, modify the
`config/database.yml`
file to have a
`main`
and a
`ci`
database
configurations.
You can set this up using
[
GDK
](
#gdk-configuration
)
or by
[
manually configuring `config/database.yml`
](
#manually-set-up-the-cicd-database
)
.
#### GDK configuration
If you are using GDK, you can follow the following steps:
By default, GDK is configured to run with multiple databases. To configure GDK to use a single database:
1.
On the GDK root directory, run:
```
shell
gdk config
set
gitlab.rails.databases.ci.enabled
true
```
1.
Open your
`gdk.yml`
, and confirm that it has the following lines:
```
yaml
gitlab
:
rails
:
databases
:
ci
:
enabled
:
true
gdk config
set
gitlab.rails.databases.ci.enabled
false
```
1.
Reconfigure GDK:
...
...
@@ -51,99 +31,7 @@ If you are using GDK, you can follow the following steps:
gdk reconfigure
```
1.
[
Create the new CI/CD database
](
#create-the-new-database
)
.
#### Manually set up the CI/CD database
You can manually edit
`config/database.yml`
to split the databases.
To do so, consider a
`config/database.yml`
file like the example below:
```
yaml
development
:
main
:
adapter
:
postgresql
encoding
:
unicode
database
:
gitlabhq_development
host
:
/path/to/gdk/postgresql
pool
:
10
prepared_statements
:
false
variables
:
statement_timeout
:
120s
test
:
&test
main
:
adapter
:
postgresql
encoding
:
unicode
database
:
gitlabhq_test
host
:
/path/to/gdk/postgresql
pool
:
10
prepared_statements
:
false
variables
:
statement_timeout
:
120s
```
Edit it to split the databases into
`main`
and
`ci`
:
```
yaml
development
:
main
:
adapter
:
postgresql
encoding
:
unicode
database
:
gitlabhq_development
host
:
/path/to/gdk/postgresql
pool
:
10
prepared_statements
:
false
variables
:
statement_timeout
:
120s
ci
:
adapter
:
postgresql
encoding
:
unicode
database
:
gitlabhq_development_ci
host
:
/path/to/gdk/postgresql
pool
:
10
prepared_statements
:
false
variables
:
statement_timeout
:
120s
test
:
&test
main
:
adapter
:
postgresql
encoding
:
unicode
database
:
gitlabhq_test
host
:
/path/to/gdk/postgresql
pool
:
10
prepared_statements
:
false
variables
:
statement_timeout
:
120s
ci
:
adapter
:
postgresql
encoding
:
unicode
database
:
gitlabhq_test_ci
host
:
/path/to/gdk/postgresql
pool
:
10
prepared_statements
:
false
variables
:
statement_timeout
:
120s
```
Next,
[
create the new CI/CD database
](
#create-the-new-database
)
.
#### Create the new database
After configuring GitLab for the two databases, create the new CI/CD database:
1.
Create the new
`ci:`
database, load the DB schema into the
`ci:`
database,
and run any pending migrations:
```shell
bundle exec rails db:create db:schema:load:ci db:migrate
```
1.
Restart GDK:
```shell
gdk restart
```
To switch back to using multiple databases, set
`gitlab.rails.databases.ci.enabled`
to
`true`
and run
`gdk reconfigure`
.
<!--
NOTE: The
`validate_cross_joins!`
method in
`spec/support/database/prevent_cross_joins.rb`
references
...
...
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