Merge pull request #93426 from helsinki-systems/feat/gitlab-pages

nixos/gitlab: Support pages
This commit is contained in:
Florian Klink 2020-10-11 23:50:19 +02:00 committed by GitHub
commit a6fec75d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 0 deletions

View File

@ -73,6 +73,11 @@ let
redisConfig.production.url = cfg.redisUrl; redisConfig.production.url = cfg.redisUrl;
pagesArgs = [
"-pages-domain" gitlabConfig.production.pages.host
"-pages-root" "${gitlabConfig.production.shared.path}/pages"
] ++ cfg.pagesExtraArgs;
gitlabConfig = { gitlabConfig = {
# These are the default settings from config/gitlab.example.yml # These are the default settings from config/gitlab.example.yml
production = flip recursiveUpdate cfg.extraConfig { production = flip recursiveUpdate cfg.extraConfig {
@ -236,6 +241,13 @@ in {
description = "Reference to the gitaly package"; description = "Reference to the gitaly package";
}; };
packages.pages = mkOption {
type = types.package;
default = pkgs.gitlab-pages;
defaultText = "pkgs.gitlab-pages";
description = "Reference to the gitlab-pages package";
};
statePath = mkOption { statePath = mkOption {
type = types.str; type = types.str;
default = "/var/gitlab/state"; default = "/var/gitlab/state";
@ -451,6 +463,12 @@ in {
}; };
}; };
pagesExtraArgs = mkOption {
type = types.listOf types.str;
default = [ "-listen-proxy" "127.0.0.1:8090" ];
description = "Arguments to pass to the gitlab-pages daemon";
};
secrets.secretFile = mkOption { secrets.secretFile = mkOption {
type = with types; nullOr path; type = with types; nullOr path;
default = null; default = null;
@ -754,6 +772,26 @@ in {
}; };
}; };
systemd.services.gitlab-pages = mkIf (gitlabConfig.production.pages.enabled or false) {
description = "GitLab static pages daemon";
after = [ "network.target" "redis.service" "gitlab.service" ]; # gitlab.service creates configs
wantedBy = [ "multi-user.target" ];
path = [ pkgs.unzip ];
serviceConfig = {
Type = "simple";
TimeoutSec = "infinity";
Restart = "on-failure";
User = cfg.user;
Group = cfg.group;
ExecStart = "${cfg.packages.pages}/bin/gitlab-pages ${escapeShellArgs pagesArgs}";
WorkingDirectory = gitlabEnv.HOME;
};
};
systemd.services.gitlab-workhorse = { systemd.services.gitlab-workhorse = {
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];

View File

@ -0,0 +1,24 @@
{ buildGoModule, lib, fetchFromGitLab }:
buildGoModule rec {
pname = "gitlab-pages";
version = "1.21.0";
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitlab-pages";
rev = "v${version}";
sha256 = "0f317lx4iarlsbnq2ipcm4lpx66xzl8wfilj8xajq1csz19ws24z";
};
vendorSha256 = "186rxvl523n1d87jz4zzbj83ikzw9d0c1wrj78xs4iqzm8z3snh0";
subPackages = [ "." ];
doCheck = false; # Broken
meta = with lib; {
description = "Daemon used to serve static websites for GitLab users";
homepage = "https://gitlab.com/gitlab-org/gitlab-pages";
license = licenses.mit;
maintainers = with maintainers; [ das_j ];
};
}

View File

@ -16540,6 +16540,8 @@ in
gatling = callPackage ../servers/http/gatling { }; gatling = callPackage ../servers/http/gatling { };
gitlab-pages = callPackage ../servers/http/gitlab-pages { };
glabels = callPackage ../applications/graphics/glabels { }; glabels = callPackage ../applications/graphics/glabels { };
nats-server = callPackage ../servers/nats-server { }; nats-server = callPackage ../servers/nats-server { };