Commit 173384f8 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'gitaly-config-toml' into 'master'

Use config.toml to configure Gitaly

See merge request !10496
parents 86d5f1f8 2f7ff6ea
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
[Gitaly](https://gitlab.com/gitlab-org/gitlay) (introduced in GitLab [Gitaly](https://gitlab.com/gitlab-org/gitlay) (introduced in GitLab
9.0) is a service that provides high-level RPC access to Git 9.0) is a service that provides high-level RPC access to Git
repositories. As of GitLab 9.0 it is still an optional component with repositories. As of GitLab 9.1 it is still an optional component with
limited scope. limited scope.
GitLab components that access Git repositories (gitlab-rails, GitLab components that access Git repositories (gitlab-rails,
...@@ -11,28 +11,26 @@ not have direct access to Gitaly. ...@@ -11,28 +11,26 @@ not have direct access to Gitaly.
## Configuring Gitaly ## Configuring Gitaly
The Gitaly service itself is configured via environment variables. The Gitaly service itself is configured via a TOML configuration file.
These variables are documented [in the gitaly This file is documented [in the gitaly
repository](https://gitlab.com/gitlab-org/gitaly/blob/master/doc/configuration/README.md). repository](https://gitlab.com/gitlab-org/gitaly/blob/master/doc/configuration/README.md).
To change a Gitaly environment variable in Omnibus you can use To change a Gitaly setting in Omnibus you can use
`gitaly['env']` in `/etc/gitlab/gitlab.rb`. Changes will be applied `gitaly['my_setting']` in `/etc/gitlab/gitlab.rb`. Changes will be applied
when you run `gitlab-ctl reconfigure`. when you run `gitlab-ctl reconfigure`.
```ruby ```ruby
gitaly['env'] = { gitaly['prometheus_listen_addr'] = 'localhost:9236'
'GITALY_MY_VARIABLE' => 'value'
}
``` ```
To change a Gitaly environment variable in installations from source To change a Gitaly setting in installations from source you can edit
you can edit `/home/git/gitaly/env`. `/home/git/gitaly/config.toml`.
```shell ```toml
GITALY_MY_VARIABLE='value' prometheus_listen_addr = "localhost:9236"
``` ```
Changes to `/home/git/gitaly/env` are applied when you run `service Changes to `/home/git/gitaly/config.toml` are applied when you run `service
gitlab restart`. gitlab restart`.
## Configuring GitLab to not use Gitaly ## Configuring GitLab to not use Gitaly
...@@ -49,15 +47,15 @@ gitaly['enable'] = false ...@@ -49,15 +47,15 @@ gitaly['enable'] = false
``` ```
In source installations, edit `/home/git/gitlab/config/gitlab.yml` and In source installations, edit `/home/git/gitlab/config/gitlab.yml` and
make sure `socket_path` in the `gitaly` section is commented out. This make sure `enabled` in the `gitaly` section is set to 'false'. This
does not disable the Gitaly service; it only prevents it from being does not disable the Gitaly service in your init script; it only
used. prevents it from being used.
Apply the change with `service gitlab restart`. Apply the change with `service gitlab restart`.
```yaml ```yaml
gitaly: gitaly:
# socket_path: tmp/sockets/private/gitlay.socket enabled: false
``` ```
## Disabling or enabling the Gitaly service ## Disabling or enabling the Gitaly service
......
...@@ -459,9 +459,9 @@ Make GitLab start on boot: ...@@ -459,9 +459,9 @@ Make GitLab start on boot:
### Install Gitaly ### Install Gitaly
As of GitLab 9.0 Gitaly is an **optional** component. Its As of GitLab 9.1 Gitaly is an **optional** component. Its
configuration is expected to change in GitLab 9.1. It is OK to wait configuration is still changing regularly. It is OK to wait
with setting up Gitaly until you upgrade to GitLab 9.1 or later. with setting up Gitaly until you upgrade to GitLab 9.2 or later.
# Fetch Gitaly source with Git and compile with Go # Fetch Gitaly source with Git and compile with Go
sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly]" RAILS_ENV=production sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly]" RAILS_ENV=production
...@@ -471,9 +471,11 @@ with setting up Gitaly until you upgrade to GitLab 9.1 or later. ...@@ -471,9 +471,11 @@ with setting up Gitaly until you upgrade to GitLab 9.1 or later.
sudo chown git /home/git/gitlab/tmp/sockets/private sudo chown git /home/git/gitlab/tmp/sockets/private
# Configure Gitaly # Configure Gitaly
echo 'GITALY_SOCKET_PATH=/home/git/gitlab/tmp/sockets/private/gitaly.socket' | \ cd /home/git/gitaly
sudo -u git tee -a /home/git/gitaly/env sudo -u git cp config.toml.example config.toml
# If you are using non-default settings you need to update config.toml
sudo -u git -H editor config.toml
# Enable Gitaly in the init script # Enable Gitaly in the init script
echo 'gitaly_enabled=true' | sudo tee -a /etc/default/gitlab echo 'gitaly_enabled=true' | sudo tee -a /etc/default/gitlab
......
...@@ -297,7 +297,10 @@ during your 9.1 upgrade **you can skip this step**. ...@@ -297,7 +297,10 @@ during your 9.1 upgrade **you can skip this step**.
If you have not yet set up Gitaly then follow [Gitaly section of the installation If you have not yet set up Gitaly then follow [Gitaly section of the installation
guide](../install/installation.md#install-gitaly). guide](../install/installation.md#install-gitaly).
If you installed Gitaly in GitLab 9.0 you need to make some changes in gitlab.yml. If you installed Gitaly in GitLab 9.0 you need to make some changes in
gitlab.yml, and create a new config.toml file.
#### Gitaly gitlab.yml changes
Look for `socket_path:` the `gitaly:` section. Its value is usually Look for `socket_path:` the `gitaly:` section. Its value is usually
`/home/git/gitlab/tmp/sockets/private/gitaly.socket`. Note what socket `/home/git/gitlab/tmp/sockets/private/gitaly.socket`. Note what socket
...@@ -318,6 +321,20 @@ the socket path, but with `unix:` in front. ...@@ -318,6 +321,20 @@ the socket path, but with `unix:` in front.
Each entry under `storages:` should use the same `gitaly_address`. Each entry under `storages:` should use the same `gitaly_address`.
#### Gitaly config.toml
In GitLab 9.1 we are replacing environment variables in Gitaly with a
TOML configuration file.
```shell
cd /home/git/gitaly
sudo mv env env.old
sudo -u git cp config.toml.example config.toml
# If you are using custom repository storage paths they need to be in config.toml
sudo -u git -H editor config.toml
```
### 11. Start application ### 11. Start application
```bash ```bash
......
...@@ -24,7 +24,7 @@ module Gitlab ...@@ -24,7 +24,7 @@ module Gitlab
end end
def find_ref_name(commit_id, ref_prefix) def find_ref_name(commit_id, ref_prefix)
request = Gitaly::FindRefNameRequest.new( request = Gitaly::FindRefNameRequest.new(
repository: @repository, repository: @repository,
commit_id: commit_id, commit_id: commit_id,
prefix: ref_prefix prefix: ref_prefix
......
...@@ -326,8 +326,7 @@ start_gitlab() { ...@@ -326,8 +326,7 @@ start_gitlab() {
echo "Gitaly is already running with pid $gapid, not restarting" echo "Gitaly is already running with pid $gapid, not restarting"
else else
$app_root/bin/daemon_with_pidfile $gitaly_pid_path \ $app_root/bin/daemon_with_pidfile $gitaly_pid_path \
$app_root/bin/with_env $gitaly_dir/env \ $gitaly_dir/gitaly $gitaly_dir/config.toml >> $gitaly_log 2>&1 &
$gitaly_dir/gitaly >> $gitaly_log 2>&1 &
fi fi
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment