2014-11-30 00:56:22 +01:00
|
|
|
# This test runs gitlab and checks if it works
|
|
|
|
|
2018-11-02 21:22:51 +01:00
|
|
|
import ./make-test.nix ({ pkgs, lib, ...} : with lib; {
|
2014-11-30 00:56:22 +01:00
|
|
|
name = "gitlab";
|
2015-07-12 12:09:40 +02:00
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
2018-11-02 21:22:51 +01:00
|
|
|
maintainers = [ globin ];
|
2015-07-12 12:09:40 +02:00
|
|
|
};
|
2014-11-30 00:56:22 +01:00
|
|
|
|
|
|
|
nodes = {
|
2018-07-20 22:56:59 +02:00
|
|
|
gitlab = { ... }: {
|
2018-11-02 21:22:51 +01:00
|
|
|
virtualisation.memorySize = 4096;
|
|
|
|
systemd.services.gitlab.serviceConfig.Restart = mkForce "no";
|
|
|
|
systemd.services.gitlab-workhorse.serviceConfig.Restart = mkForce "no";
|
|
|
|
systemd.services.gitaly.serviceConfig.Restart = mkForce "no";
|
|
|
|
systemd.services.gitlab-sidekiq.serviceConfig.Restart = mkForce "no";
|
2017-11-06 13:55:56 +01:00
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
2018-11-23 19:36:14 +01:00
|
|
|
recommendedProxySettings = true;
|
2017-11-06 13:55:56 +01:00
|
|
|
virtualHosts = {
|
|
|
|
"localhost" = {
|
|
|
|
locations."/".proxyPass = "http://unix:/run/gitlab/gitlab-workhorse.socket";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.gitlab = {
|
|
|
|
enable = true;
|
|
|
|
databasePassword = "dbPassword";
|
2018-11-02 21:22:51 +01:00
|
|
|
initialRootPassword = "notproduction";
|
2018-11-14 18:38:55 +01:00
|
|
|
smtp.enable = true;
|
2017-11-06 13:55:56 +01:00
|
|
|
secrets = {
|
|
|
|
secret = "secret";
|
|
|
|
otp = "otpsecret";
|
|
|
|
db = "dbsecret";
|
|
|
|
|
|
|
|
# nix-shell -p openssl --run "openssl genrsa 2048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sSpzYfFPLEAhieAkuhtbsX58Boo46djiKVfzGftfp6F9aHTOfzGORU5jrZ16mSbS
|
|
|
|
qkkC6BEFrATX2051dzzXC89fWoJYALrsffE5I3KlKXsCAWSnCP1MMxOfH+Ls61Mr
|
|
|
|
7pK/LKfvJt53mUH4jIdbmmFUDwbg18oBEH+x9PmbAoGAS/+JqXu9N67rIxDGUE6W
|
|
|
|
3tacI0f2+U9Uhe67/DTZaXyc8YFTlXU0uWKIWy+bw5RaYeM9tlL/f/f+m2i25KK+
|
|
|
|
vrZ7zNag7CWU5GJovGyykDnauTpZaYM03mN0VPT08/uc/zXIYqyknbhlIeaZynCK
|
|
|
|
fDB3LUF0NVCknz20WCIGU0kCgYEAkxY0ZXx61Dp4pFr2wwEZxQGs7uXpz64FKyEX
|
|
|
|
12r6nMATY4Lh6y/Px0W6w5vis8lk+5Ny6cNUevHQ0LNuJS+yu6ywl+1vrbrnqroM
|
|
|
|
f3LvpcPeGLSoX8jl1VDQi7aFgG6LoKly1xJLbdsH4NPutB9PgBbbTghx9GgmI88L
|
|
|
|
rPA2M6UCgYBOmkYJocNgxg6B1/n4Tb9fN1Q/XuJrFDE6NxVUoke+IIyMPRH7FC3m
|
|
|
|
VMYzu+b7zTVJjaBb1cmJemxl/xajziWDofJYPefhdbOVU7HXtmJFY0IG3pVxU1zW
|
|
|
|
3bmDj5QAtCUDpuuNa6GEIT0YR4+D/V7o3DmlZ0tVIwKJmVJoQ2f5dw==
|
|
|
|
-----END RSA PRIVATE KEY-----
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2014-11-30 00:56:22 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
$gitlab->start();
|
2018-11-02 21:22:51 +01:00
|
|
|
$gitlab->waitForUnit("gitaly.service");
|
|
|
|
$gitlab->waitForUnit("gitlab-workhorse.service");
|
2014-11-30 00:56:22 +01:00
|
|
|
$gitlab->waitForUnit("gitlab.service");
|
2014-12-14 02:30:13 +01:00
|
|
|
$gitlab->waitForUnit("gitlab-sidekiq.service");
|
2018-11-02 21:22:51 +01:00
|
|
|
$gitlab->waitForFile("/var/gitlab/state/tmp/sockets/gitlab.socket");
|
2018-11-23 19:36:14 +01:00
|
|
|
$gitlab->waitUntilSucceeds("curl -sSf http://gitlab/users/sign_in");
|
|
|
|
$gitlab->succeed("curl -isSf http://gitlab | grep -i location | grep -q http://gitlab/users/sign_in");
|
2018-11-02 21:22:51 +01:00
|
|
|
$gitlab->succeed("${pkgs.sudo}/bin/sudo -u gitlab -H gitlab-rake gitlab:check 1>&2")
|
2014-11-30 00:56:22 +01:00
|
|
|
'';
|
2015-07-12 12:09:40 +02:00
|
|
|
})
|