Skip to content

Commit

Permalink
gitlab: 9.4.5 -> 9.5.2
Browse files Browse the repository at this point in the history
(cherry picked from commit 2f48144)
  • Loading branch information
fpletz committed Sep 3, 2017
1 parent 11459b0 commit 313ea79
Show file tree
Hide file tree
Showing 17 changed files with 732 additions and 14,875 deletions.
46 changes: 36 additions & 10 deletions nixos/modules/services/misc/gitlab.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let
ruby = cfg.packages.gitlab.ruby;
bundler = pkgs.bundler;

gemHome = "${cfg.packages.gitlab.ruby-env}/${ruby.gemPath}";
gemHome = "${cfg.packages.gitlab.rubyEnv}/${ruby.gemPath}";

gitlabSocket = "${cfg.statePath}/tmp/sockets/gitlab.socket";
gitalySocket = "${cfg.statePath}/tmp/sockets/gitaly.socket";
Expand All @@ -29,7 +29,13 @@ let

gitalyToml = pkgs.writeText "gitaly.toml" ''
socket_path = "${lib.escape ["\""] gitalySocket}"
# prometheus metrics
prometheus_listen_addr = "localhost:9236"
[gitaly-ruby]
dir = "${cfg.packages.gitaly.ruby}"
[gitlab-shell]
dir = "${cfg.packages.gitlab-shell}"
${concatStringsSep "\n" (attrValues (mapAttrs (k: v: ''
[[storage]]
Expand All @@ -54,6 +60,11 @@ let
namespace: resque:gitlab
'';

redisYml = ''
production:
url: redis://localhost:6379/
'';

secretsYml = ''
production:
secret_key_base: ${cfg.secrets.secret}
Expand Down Expand Up @@ -101,11 +112,22 @@ let
upload_pack = true;
receive_pack = true;
};
workhorse = {
secret_file = "${cfg.statePath}/.gitlab_workhorse_secret";
};
git = {
bin_path = "git";
max_size = 20971520; # 20MB
timeout = 10;
};
monitoring = {
ip_whitelist = [ "127.0.0.0/8" "::1/128" ];
sidekiq_exporter = {
enable = true;
address = "localhost";
port = 3807;
};
};
extra = {};
};
};
Expand All @@ -123,19 +145,21 @@ let
GITLAB_SHELL_CONFIG_PATH = "${cfg.statePath}/home/config.yml";
GITLAB_SHELL_SECRET_PATH = "${cfg.statePath}/config/gitlab_shell_secret";
GITLAB_SHELL_HOOKS_PATH = "${cfg.statePath}/home/hooks";
GITLAB_REDIS_CONFIG_FILE = pkgs.writeText "gitlab-redis.yml" redisYml;
prometheus_multiproc_dir = "/run/gitlab";
RAILS_ENV = "production";
};

unicornConfig = builtins.readFile ./defaultUnicornConfig.rb;

gitlab-rake = pkgs.stdenv.mkDerivation rec {
name = "gitlab-rake";
buildInputs = [ cfg.packages.gitlab cfg.packages.gitlab.ruby-env pkgs.makeWrapper ];
buildInputs = [ cfg.packages.gitlab cfg.packages.gitlab.rubyEnv pkgs.makeWrapper ];
phases = "installPhase fixupPhase";
buildPhase = "";
installPhase = ''
mkdir -p $out/bin
makeWrapper ${cfg.packages.gitlab.ruby-env}/bin/bundle $out/bin/gitlab-bundle \
makeWrapper ${cfg.packages.gitlab.rubyEnv}/bin/bundle $out/bin/gitlab-bundle \
${concatStrings (mapAttrsToList (name: value: "--set ${name} '${value}' ") gitlabEnv)} \
--set GITLAB_CONFIG_PATH '${cfg.statePath}/config' \
--set PATH '${lib.makeBinPath [ pkgs.nodejs pkgs.gzip pkgs.git pkgs.gnutar config.services.postgresql.package ]}:$PATH' \
Expand Down Expand Up @@ -455,6 +479,7 @@ in {
ruby
openssh
nodejs
gnupg
];
serviceConfig = {
Type = "simple";
Expand All @@ -463,15 +488,15 @@ in {
TimeoutSec = "300";
Restart = "on-failure";
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
ExecStart="${cfg.packages.gitlab.ruby-env}/bin/bundle exec \"sidekiq -C \"${cfg.packages.gitlab}/share/gitlab/config/sidekiq_queues.yml\" -e production -P ${cfg.statePath}/tmp/sidekiq.pid\"";
ExecStart="${cfg.packages.gitlab.rubyEnv}/bin/bundle exec \"sidekiq -C \"${cfg.packages.gitlab}/share/gitlab/config/sidekiq_queues.yml\" -e production -P ${cfg.statePath}/tmp/sidekiq.pid\"";
};
};

systemd.services.gitaly = {
after = [ "network.target" "gitlab.service" ];
wantedBy = [ "multi-user.target" ];
environment.HOME = gitlabEnv.HOME;
path = with pkgs; [ gitAndTools.git ];
path = with pkgs; [ gitAndTools.git cfg.packages.gitaly.rubyEnv ];
serviceConfig = {
#PermissionsStartOnly = true; # preStart must be run as root
Type = "simple";
Expand Down Expand Up @@ -515,7 +540,7 @@ in {
+ "-listenAddr /run/gitlab/gitlab-workhorse.socket "
+ "-authSocket ${gitlabSocket} "
+ "-documentRoot ${cfg.packages.gitlab}/share/gitlab/public "
+ "-secretPath ${cfg.packages.gitlab}/share/gitlab/.gitlab_workhorse_secret";
+ "-secretPath ${cfg.statePath}/.gitlab_workhorse_secret";
};
};

Expand Down Expand Up @@ -551,7 +576,8 @@ in {
# symlinked in the gitlab package to /run/gitlab/uploads to make it
# configurable
mkdir -p /run/gitlab
mkdir -p ${cfg.statePath}/uploads
mkdir -p ${cfg.statePath}/{log,uploads}
ln -sf ${cfg.statePath}/log /run/gitlab/log
ln -sf ${cfg.statePath}/uploads /run/gitlab/uploads
chown -R ${cfg.user}:${cfg.group} /run/gitlab
Expand Down Expand Up @@ -599,7 +625,7 @@ in {
# up the initial database
if ! test -e "${cfg.statePath}/db-seeded"; then
${gitlab-rake}/bin/gitlab-rake db:seed_fu RAILS_ENV=production \
GITLAB_ROOT_PASSWORD="${cfg.initialRootPassword}" GITLAB_ROOT_EMAIL="${cfg.initialRootEmail}"
GITLAB_ROOT_PASSWORD='${cfg.initialRootPassword}' GITLAB_ROOT_EMAIL='${cfg.initialRootEmail}'
touch "${cfg.statePath}/db-seeded"
fi
Expand All @@ -618,7 +644,7 @@ in {
TimeoutSec = "300";
Restart = "on-failure";
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
ExecStart = "${cfg.packages.gitlab.ruby-env}/bin/bundle exec \"unicorn -c ${cfg.statePath}/config/unicorn.rb -E production\"";
ExecStart = "${cfg.packages.gitlab.rubyEnv}/bin/bundle exec \"unicorn -c ${cfg.statePath}/config/unicorn.rb -E production\"";
};

};
Expand Down
5 changes: 5 additions & 0 deletions pkgs/applications/version-management/gitaly/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'github-linguist', '~> 4.7.0', require: 'linguist'
gem 'gitaly', '~> 0.30.0'
gem 'activesupport'
70 changes: 70 additions & 0 deletions pkgs/applications/version-management/gitaly/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
charlock_holmes (0.7.5)
concurrent-ruby (1.0.5)
escape_utils (1.1.1)
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
gitaly (0.30.0)
google-protobuf (~> 3.1)
grpc (~> 1.0)
github-linguist (4.7.6)
charlock_holmes (~> 0.7.3)
escape_utils (~> 1.1.0)
mime-types (>= 1.19)
rugged (>= 0.23.0b)
google-protobuf (3.3.0)
googleauth (0.5.3)
faraday (~> 0.12)
jwt (~> 1.4)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
signet (~> 0.7)
grpc (1.4.1)
google-protobuf (~> 3.1)
googleauth (~> 0.5.1)
i18n (0.8.1)
jwt (1.5.6)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
minitest (5.9.1)
multi_json (1.12.1)
multipart-post (2.0.0)
os (0.9.6)
public_suffix (2.0.5)
rugged (0.26.0)
signet (0.7.3)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (~> 1.5)
multi_json (~> 1.10)
thread_safe (0.3.6)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
activesupport
gitaly (~> 0.30.0)
github-linguist (~> 4.7.0)

BUNDLED WITH
1.15.3
32 changes: 20 additions & 12 deletions pkgs/applications/version-management/gitaly/default.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
{ stdenv, fetchFromGitLab, git, go }:
{ stdenv, fetchFromGitLab, buildGoPackage, ruby, bundlerEnv }:

stdenv.mkDerivation rec {
version = "0.21.2";
let
rubyEnv = bundlerEnv {
name = "gitaly-env";
inherit ruby;
gemdir = ./.;
};
in buildGoPackage rec {
version = "0.33.0";
name = "gitaly-${version}";

srcs = fetchFromGitLab {
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitaly";
rev = "v${version}";
sha256 = "025r6vcra2bjm6xggcgnsqgkpvd7y2w73ff6lxrn06lbr4dfbfrf";
sha256 = "1x23z3a0svychs1kc9cbiskl0dp7ji9ddzqr6md22jiy6vgwx2wa";
};

buildInputs = [ git go ];
goPackagePath = "gitlab.com/gitlab-org/gitaly";

buildPhase = ''
make PREFIX=$out
'';
passthru = {
inherit rubyEnv;
};

installPhase = ''
mkdir -p $out/bin
make install PREFIX=$out
postInstall = ''
mkdir -p $ruby
cp -rv $src/ruby/{bin,lib,vendor} $ruby
'';

outputs = [ "bin" "out" "ruby" ];

meta = with stdenv.lib; {
homepage = http://www.gitlab.com/;
platforms = platforms.unix;
Expand Down
Loading

0 comments on commit 313ea79

Please sign in to comment.