Commit f14f532f2a88280ce77203975d838c888360d553
1 parent
a553a6a4
Exists in
master
and in
13 other branches
Add documentation for external databases
Showing
1 changed file
with
52 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -308,6 +308,56 @@ sudo /opt/gitlab/bin/gitlab-rails console |
308 | 308 | |
309 | 309 | This will only work after you have run `gitlab-ctl reconfigure` at least once. |
310 | 310 | |
311 | +## Using omnibus-gitlab with a remote database server | |
312 | + | |
313 | +This is an advanced topic. If you do not want to use the built-in Postgres | |
314 | +server of omnibus-gitlab or if you want to use MySQL (GitLab Enterprise Edition | |
315 | +only) you can do so as follows. | |
316 | + | |
317 | +Important note: if you are connecting omnibus-gitlab to an existing GitLab | |
318 | +database you should create a backup before attempting this procedure. | |
319 | + | |
320 | +### Create a user and database for GitLab | |
321 | + | |
322 | +First, set up your database server according to the [upstream GitLab | |
323 | +instructions](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#5-database). | |
324 | +If you want to keep using an existing GitLab database you can skip this step. | |
325 | + | |
326 | +### Configure omnibus-gitlab to connect to your remote database server | |
327 | + | |
328 | +Next, we add the following settings to `/etc/gitlab/gitlab.rb`. | |
329 | + | |
330 | +```ruby | |
331 | +# Disable the build-in Postgres | |
332 | +postgresql['enable'] = false | |
333 | + | |
334 | +# Fill in the values for database.yml | |
335 | +gitlab_rails['db_adapter'] = 'mysql2' | |
336 | +gitlab_rails['db_encoding'] = 'utf8' | |
337 | +gitlab_rails['db_host'] = '127.0.0.1' | |
338 | +gitlab_rails['db_port'] = '3306' | |
339 | +gitlab_rails['db_username'] = 'git' | |
340 | +gitlab_rails['db_password'] = 'password' | |
341 | +``` | |
342 | + | |
343 | +Parameters such as `db_adapter` correspond to `adapter` in `database.yml`; see | |
344 | +the upstream GitLab examples for [Postgres][database.yml.postgresql] and | |
345 | +[MySQL][database.yml.mysql]. We remind you that `/etc/gitlab/gitlab.rb` should | |
346 | +have file permissions `0600` because it contains plaintext passwords. | |
347 | + | |
348 | +Run `sudo gitlab-ctl reconfigure` for the change to take effect. | |
349 | + | |
350 | +### Seed the database (fresh installs only) | |
351 | + | |
352 | +Omnibus-gitlab will not automatically seed your external database. Run the | |
353 | +following command to import the schema and create the first admin user: | |
354 | + | |
355 | +```shell | |
356 | +sudo gitlab-rake gitlab:setup | |
357 | +``` | |
358 | + | |
359 | +This is a destructive command; do not run it on an existing database! | |
360 | + | |
311 | 361 | ## Building your own package |
312 | 362 | |
313 | 363 | See [the separate build documentation](doc/build.md). |
... | ... | @@ -321,3 +371,5 @@ This omnibus installer project is based on the awesome work done by Chef in |
321 | 371 | [CE README]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/README.md |
322 | 372 | [omnibus-chef-server]: https://github.com/opscode/omnibus-chef-server |
323 | 373 | [gitlab.yml.erb]: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb |
374 | +[database.yml.postgresql]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/database.yml.postgresql | |
375 | +[database.yml.mysql]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/database.yml.mysql | ... | ... |