diff options
Diffstat (limited to 'doc/administration/read_only_gitlab.md')
-rw-r--r-- | doc/administration/read_only_gitlab.md | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/doc/administration/read_only_gitlab.md b/doc/administration/read_only_gitlab.md index 3718741e2e9..3842cf0846b 100644 --- a/doc/administration/read_only_gitlab.md +++ b/doc/administration/read_only_gitlab.md @@ -70,28 +70,28 @@ the database is read-only: in case things don't go as expected. 1. Enter PostgreSQL on the console as an administrator user: - ```shell - sudo \ - -u gitlab-psql /opt/gitlab/embedded/bin/psql \ - -h /var/opt/gitlab/postgresql gitlabhq_production - ``` + ```shell + sudo \ + -u gitlab-psql /opt/gitlab/embedded/bin/psql \ + -h /var/opt/gitlab/postgresql gitlabhq_production + ``` 1. Create the `gitlab_read_only` user. The password is set to `mypassword`, change that to your liking: - ```sql - -- NOTE: Use the password defined earlier - CREATE USER gitlab_read_only WITH password 'mypassword'; - GRANT CONNECT ON DATABASE gitlabhq_production to gitlab_read_only; - GRANT USAGE ON SCHEMA public TO gitlab_read_only; - GRANT SELECT ON ALL TABLES IN SCHEMA public TO gitlab_read_only; - GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO gitlab_read_only; - - -- Tables created by "gitlab" should be made read-only for "gitlab_read_only" - -- automatically. - ALTER DEFAULT PRIVILEGES FOR USER gitlab IN SCHEMA public GRANT SELECT ON TABLES TO gitlab_read_only; - ALTER DEFAULT PRIVILEGES FOR USER gitlab IN SCHEMA public GRANT SELECT ON SEQUENCES TO gitlab_read_only; - ``` + ```sql + -- NOTE: Use the password defined earlier + CREATE USER gitlab_read_only WITH password 'mypassword'; + GRANT CONNECT ON DATABASE gitlabhq_production to gitlab_read_only; + GRANT USAGE ON SCHEMA public TO gitlab_read_only; + GRANT SELECT ON ALL TABLES IN SCHEMA public TO gitlab_read_only; + GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO gitlab_read_only; + + -- Tables created by "gitlab" should be made read-only for "gitlab_read_only" + -- automatically. + ALTER DEFAULT PRIVILEGES FOR USER gitlab IN SCHEMA public GRANT SELECT ON TABLES TO gitlab_read_only; + ALTER DEFAULT PRIVILEGES FOR USER gitlab IN SCHEMA public GRANT SELECT ON SEQUENCES TO gitlab_read_only; + ``` 1. Get the hashed password of the `gitlab_read_only` user and copy the result: @@ -101,10 +101,10 @@ the database is read-only: 1. Edit `/etc/gitlab/gitlab.rb` and add the password from the previous step: - ```ruby - postgresql['sql_user_password'] = 'a2e20f823772650f039284619ab6f239' - postgresql['sql_user'] = "gitlab_read_only" - ``` + ```ruby + postgresql['sql_user_password'] = 'a2e20f823772650f039284619ab6f239' + postgresql['sql_user'] = "gitlab_read_only" + ``` 1. Reconfigure GitLab and restart PostgreSQL: |