Commit 43a55494 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

add check bin

parent e7a4d233
#!/usr/bin/env ruby
require_relative '../lib/gitlab_init'
require_relative '../lib/gitlab_net'
#
# GitLab shell check task
#
print "Check GitLab API access: "
resp = GitlabNet.new.check
if resp.code == "200"
print 'OK'
else
puts "FAILED. code: #{resp.code}"
end
puts "\nCheck directories and files: "
config = GitlabConfig.new
dirs = [config.repos_path, config.auth_file]
dirs.each do |dir|
print "\t#{dir}: "
if File.exists?(dir)
print 'OK'
else
puts "FAILED"
end
puts "\n"
end
...@@ -9,6 +9,7 @@ require_relative '../lib/gitlab_init' ...@@ -9,6 +9,7 @@ require_relative '../lib/gitlab_init'
commands = [ commands = [
"mkdir -p /home/git/repositories", "mkdir -p /home/git/repositories",
"mkdir -p /home/git/.ssh", "mkdir -p /home/git/.ssh",
"touch /home/git/.ssh/authorized_keys",
"chmod -R ug+rwX,o-rwx /home/git/repositories/", "chmod -R ug+rwX,o-rwx /home/git/repositories/",
"find /home/git/repositories -type d -print0 | xargs -0 chmod g+s" "find /home/git/repositories -type d -print0 | xargs -0 chmod g+s"
] ]
......
# GitLab user. git by default
user: git user: git
# Url to gitlab instance. Used for api calls
gitlab_url: "http://localhost/" gitlab_url: "http://localhost/"
# Repositories path
repos_path: "/home/git/repositories" repos_path: "/home/git/repositories"
# File used as authorized_keys for gitlab user
auth_file: "/home/git/.ssh/authorized_keys" auth_file: "/home/git/.ssh/authorized_keys"
...@@ -22,6 +22,10 @@ class GitlabNet ...@@ -22,6 +22,10 @@ class GitlabNet
JSON.parse(resp.body) JSON.parse(resp.body)
end end
def check
get("#{host}/check")
end
protected protected
def host def host
......
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