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 @@
[Gitaly](https://gitlab.com/gitlab-org/gitlay) (introduced in GitLab
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.
GitLab components that access Git repositories (gitlab-rails,
......@@ -11,28 +11,26 @@ not have direct access to Gitaly.
## Configuring Gitaly
The Gitaly service itself is configured via environment variables.
These variables are documented [in the gitaly
The Gitaly service itself is configured via a TOML configuration file.
This file is documented [in the gitaly
repository](https://gitlab.com/gitlab-org/gitaly/blob/master/doc/configuration/README.md).
To change a Gitaly environment variable in Omnibus you can use
`gitaly['env']` in `/etc/gitlab/gitlab.rb`. Changes will be applied
To change a Gitaly setting in Omnibus you can use
`gitaly['my_setting']` in `/etc/gitlab/gitlab.rb`. Changes will be applied
when you run `gitlab-ctl reconfigure`.
```ruby
gitaly['env'] = {
'GITALY_MY_VARIABLE' => 'value'
}
gitaly['prometheus_listen_addr'] = 'localhost:9236'
```
To change a Gitaly environment variable in installations from source
you can edit `/home/git/gitaly/env`.
To change a Gitaly setting in installations from source you can edit
`/home/git/gitaly/config.toml`.
```shell
GITALY_MY_VARIABLE='value'
```toml
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`.
## Configuring GitLab to not use Gitaly
......@@ -49,15 +47,15 @@ gitaly['enable'] = false
```
In source installations, edit `/home/git/gitlab/config/gitlab.yml` and
make sure `socket_path` in the `gitaly` section is commented out. This
does not disable the Gitaly service; it only prevents it from being
used.
make sure `enabled` in the `gitaly` section is set to 'false'. This
does not disable the Gitaly service in your init script; it only
prevents it from being used.
Apply the change with `service gitlab restart`.
```yaml
gitaly:
# socket_path: tmp/sockets/private/gitlay.socket
enabled: false
```
## Disabling or enabling the Gitaly service
......
......@@ -459,9 +459,9 @@ Make GitLab start on boot:
### Install Gitaly
As of GitLab 9.0 Gitaly is an **optional** component. Its
configuration is expected to change in GitLab 9.1. It is OK to wait
with setting up Gitaly until you upgrade to GitLab 9.1 or later.
As of GitLab 9.1 Gitaly is an **optional** component. Its
configuration is still changing regularly. It is OK to wait
with setting up Gitaly until you upgrade to GitLab 9.2 or later.
# 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
......@@ -471,8 +471,10 @@ with setting up Gitaly until you upgrade to GitLab 9.1 or later.
sudo chown git /home/git/gitlab/tmp/sockets/private
# Configure Gitaly
echo 'GITALY_SOCKET_PATH=/home/git/gitlab/tmp/sockets/private/gitaly.socket' | \
sudo -u git tee -a /home/git/gitaly/env
cd /home/git/gitaly
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
echo 'gitaly_enabled=true' | sudo tee -a /etc/default/gitlab
......
......@@ -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
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
`/home/git/gitlab/tmp/sockets/private/gitaly.socket`. Note what socket
......@@ -318,6 +321,20 @@ the socket path, but with `unix:` in front.
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
```bash
......
......@@ -326,8 +326,7 @@ start_gitlab() {
echo "Gitaly is already running with pid $gapid, not restarting"
else
$app_root/bin/daemon_with_pidfile $gitaly_pid_path \
$app_root/bin/with_env $gitaly_dir/env \
$gitaly_dir/gitaly >> $gitaly_log 2>&1 &
$gitaly_dir/gitaly $gitaly_dir/config.toml >> $gitaly_log 2>&1 &
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