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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
476037b0
Commit
476037b0
authored
Apr 10, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure Gitaly through settings file instead of ENV vars
parent
0fa00e84
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
doc/install/installation.md
doc/install/installation.md
+1
-3
lib/tasks/gitlab/gitaly.rake
lib/tasks/gitlab/gitaly.rake
+37
-0
spec/support/test_env.rb
spec/support/test_env.rb
+4
-3
No files found.
doc/install/installation.md
View file @
476037b0
...
...
@@ -470,10 +470,8 @@ with setting up Gitaly until you upgrade to GitLab 9.2 or later.
sudo chmod 0700 /home/git/gitlab/tmp/sockets/private
sudo chown git /home/git/gitlab/tmp/sockets/private
# Configure Gitaly
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
cd /home/git/gitaly
sudo -u git -H editor config.toml
# Enable Gitaly in the init script
...
...
lib/tasks/gitlab/gitaly.rake
View file @
476037b0
...
...
@@ -2,6 +2,8 @@ namespace :gitlab do
namespace
:gitaly
do
desc
"GitLab | Install or upgrade gitaly"
task
:install
,
[
:dir
]
=>
:environment
do
|
t
,
args
|
require
'toml'
warn_user_is_not_gitlab
unless
args
.
dir
.
present?
abort
%(Please specify the directory where you want to install gitaly:\n rake "gitlab:gitaly:install[/home/git/gitaly]")
...
...
@@ -16,6 +18,7 @@ namespace :gitlab do
command
=
status
.
zero?
?
'gmake'
:
'make'
Dir
.
chdir
(
args
.
dir
)
do
create_gitaly_configuration
run_command!
([
command
])
end
end
...
...
@@ -33,5 +36,39 @@ namespace :gitlab do
puts
TOML
.
dump
(
storage:
config
)
end
private
# We cannot create config.toml files for all possible Gitaly configuations.
# For instance, if Gitaly is running on another machine then it makes no
# sense to write a config.toml file on the current machine. This method will
# only write a config.toml file in the most common and simplest case: the
# case where we have exactly one Gitaly process and we are sure it is
# running locally because it uses a Unix socket.
def
create_gitaly_configuration
storages
=
[]
address
=
nil
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
key
,
val
|
if
address
if
address
!=
val
[
'gitaly_address'
]
raise
ArgumentError
,
"Your gitlab.yml contains more than one gitaly_address."
end
elsif
URI
(
val
[
'gitaly_address'
]).
scheme
!=
'unix'
raise
ArgumentError
,
"Automatic config.toml generation only supports 'unix:' addresses."
else
address
=
val
[
'gitaly_address'
]
end
storages
<<
{
name:
key
,
path:
val
[
'path'
]
}
end
File
.
open
(
"config.toml"
,
"w"
)
do
|
f
|
f
.
puts
TOML
.
dump
(
socket_path:
address
.
sub
(
%r{
\A
unix:}
,
''
),
storages:
storages
)
end
rescue
ArgumentError
=>
e
puts
"Skipping config.toml generation:"
puts
e
.
message
end
end
end
spec/support/test_env.rb
View file @
476037b0
...
...
@@ -124,12 +124,13 @@ module TestEnv
raise
"Can't clone gitaly"
end
start_gitaly
(
gitaly_dir
,
socket_path
)
start_gitaly
(
gitaly_dir
)
end
def
start_gitaly
(
gitaly_dir
,
socket_path
)
def
start_gitaly
(
gitaly_dir
)
gitaly_exec
=
File
.
join
(
gitaly_dir
,
'gitaly'
)
@gitaly_pid
=
spawn
({
"GITALY_SOCKET_PATH"
=>
socket_path
},
gitaly_exec
,
[
:out
,
:err
]
=>
'/dev/null'
)
gitaly_config
=
File
.
join
(
gitaly_dir
,
'config.toml'
)
@gitaly_pid
=
spawn
(
gitaly_exec
,
gitaly_config
,
[
:out
,
:err
]
=>
'/dev/null'
)
end
def
stop_gitaly
...
...
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