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'
commands = [
"mkdir -p /home/git/repositories",
"mkdir -p /home/git/.ssh",
"touch /home/git/.ssh/authorized_keys",
"chmod -R ug+rwX,o-rwx /home/git/repositories/",
"find /home/git/repositories -type d -print0 | xargs -0 chmod g+s"
]
......
# GitLab user. git by default
user: git
# Url to gitlab instance. Used for api calls
gitlab_url: "http://localhost/"
# Repositories path
repos_path: "/home/git/repositories"
# File used as authorized_keys for gitlab user
auth_file: "/home/git/.ssh/authorized_keys"
......@@ -22,6 +22,10 @@ class GitlabNet
JSON.parse(resp.body)
end
def check
get("#{host}/check")
end
protected
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