gitlab: 8.0.5 -> 8.5.0, service improvements
Updates gitlab to the current stable version and fixes a lot of features that were broken, at least with the current version and our configuration. Quite a lot of sweat and tears has gone into testing nearly all features and reading/patching the Gitlab source as we're about to deploy gitlab for our whole company. Things to note: * The gitlab config is now written as a nix attribute set and will be converted to JSON. Gitlab uses YAML but JSON is a subset of YAML. The `extraConfig` opition is also an attribute set that will be merged with the default config. This way *all* Gitlab options are supported. * Some paths like uploads and configs are hardcoded in rails (at least after my study of the Gitlab source). This is why they are linked from the Gitlab root to /run/gitlab and then linked to the configurable `statePath`. * Backup & restore should work out of the box from another Gitlab instance. * gitlab-git-http-server has been replaced by gitlab-workhorse upstream. Push & pull over HTTPS works perfectly. Communication to gitlab is done over unix sockets. An HTTP server is required to proxy requests to gitlab-workhorse over another unix socket at `/run/gitlab/gitlab-workhorse.socket`. * The user & group running gitlab are now configurable. These can even be changed for live instances. * The initial email address & password of the root user can be configured. Fixes #8598.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
{ stdenv, lib, bundler, fetchgit, bundlerEnv, defaultGemConfig, libiconv, ruby
|
||||
{ stdenv, lib, bundler, fetchFromGitHub, bundlerEnv, defaultGemConfig, libiconv, ruby
|
||||
, tzdata, git, nodejs, procps
|
||||
}:
|
||||
|
||||
/* When updating the Gemfile add `gem "activerecord-nulldb-adapter"`
|
||||
to allow building the assets without a database */
|
||||
|
||||
let
|
||||
env = bundlerEnv {
|
||||
name = "gitlab";
|
||||
@@ -21,19 +24,23 @@ in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "gitlab-${version}";
|
||||
version = "8.0.5";
|
||||
version = "8.5.0";
|
||||
|
||||
buildInputs = [ ruby bundler tzdata git nodejs procps ];
|
||||
src = fetchgit {
|
||||
url = "https://github.com/gitlabhq/gitlabhq.git";
|
||||
rev = "2866c501b5a5abb69d101cc07261a1d684b4bd4c";
|
||||
fetchSubmodules = false;
|
||||
sha256 = "edc6bedd5e79940189355d8cb343d20b0781b69fcef56ccae5906fa5e81ed521";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "gitlabhq";
|
||||
repo = "gitlabhq";
|
||||
rev = "v${version}";
|
||||
sha256 = "1rhl906xnvpxkw3ngwfzi80cl3daihx5vizy04b9b39adyd3i5hl";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./remove-hardcoded-locations.patch
|
||||
./disable-dump-schema-after-migration.patch
|
||||
./nulladapter.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# For reasons I don't understand "bundle exec" ignores the
|
||||
# RAILS_ENV causing tests to be executed that fail because we're
|
||||
@@ -41,7 +48,6 @@ stdenv.mkDerivation rec {
|
||||
# tests works though.:
|
||||
rm lib/tasks/test.rake
|
||||
|
||||
mv config/gitlab.yml.example config/gitlab.yml
|
||||
rm config/initializers/gitlab_shell_secret_token.rb
|
||||
|
||||
substituteInPlace app/controllers/admin/background_jobs_controller.rb \
|
||||
@@ -50,7 +56,7 @@ stdenv.mkDerivation rec {
|
||||
# required for some gems:
|
||||
cat > config/database.yml <<EOF
|
||||
production:
|
||||
adapter: postgresql
|
||||
adapter: <%= ENV["GITLAB_DATABASE_ADAPTER"] || sqlite %>
|
||||
database: gitlab
|
||||
host: <%= ENV["GITLAB_DATABASE_HOST"] || "127.0.0.1" %>
|
||||
password: <%= ENV["GITLAB_DATABASE_PASSWORD"] || "blerg" %>
|
||||
@@ -58,14 +64,22 @@ stdenv.mkDerivation rec {
|
||||
encoding: utf8
|
||||
EOF
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
export GEM_HOME=${env}/${ruby.gemPath}
|
||||
bundle exec rake assets:precompile RAILS_ENV=production
|
||||
mv config/gitlab.yml.example config/gitlab.yml
|
||||
GITLAB_DATABASE_ADAPTER=nulldb bundle exec rake assets:precompile RAILS_ENV=production
|
||||
mv config/gitlab.yml config/gitlab.yml.example
|
||||
mv config config.dist
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share
|
||||
cp -r . $out/share/gitlab
|
||||
ln -sf /run/gitlab/uploads $out/share/gitlab/public/uploads
|
||||
ln -sf /run/gitlab/config $out/share/gitlab/config
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit env;
|
||||
inherit ruby;
|
||||
|
||||
Reference in New Issue
Block a user