NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.39k stars 14.34k forks source link

Gitab registry: always using port 5000, ignoring the service config port #350428

Open MatthieuBarthel opened 1 month ago

MatthieuBarthel commented 1 month ago

Describe the bug

By default the gitlab registry port is set to 4567 in services.gitlab.registry.port, but in my tests the registry always uses port 5000, whatever is configured.

Steps To Reproduce

Enable the registry with any port, except 5000:

{
  services.gitlab = {
    enable = true;
    registry = {
      enable = true;
      port = 4567;
      certFile = config.sops.secrets.gitlab_registry_cert.path;
      keyFile = config.sops.secrets.gitlab_registry_key.path;
      externalAddress = "registry.example.com";
      externalPort = 443;
    };
  };
}

Verify:

$ curl -I http://localhost:4567
curl: (7) Failed to connect to localhost port 4567 after 0 ms: Couldn't connect to server

$ curl -I http://localhost:5000
HTTP/1.1 200 OK
Cache-Control: no-cache
Date: Tue, 22 Oct 2024 08:28:28 GMT

Expected behavior

Should use the port configured :)

Notify maintainers

@globin @krav @talyz @yayayayaka

Thanks again <3

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.57, NixOS, 24.05 (Uakari), 24.05.20241017.4eb33fe`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - nixpkgs: `/nix/store/z7j461v8da67nwrad4xz50dx2l5wk0wz-source`

Add a :+1: reaction to issues you find important.

purefan commented 1 month ago

have you opened the port in networking.firewall.allowedTCPPorts ?

MatthieuBarthel commented 1 month ago

No because I use nginx as a proxy, but in the "steps to reproduce" I run the queries directly from the host:

$ curl -I http://localhost:4567
curl: (7) Failed to connect to localhost port 4567 after 0 ms: Couldn't connect to server

$ curl -I http://localhost:5000
HTTP/1.1 200 OK
nixos-discourse commented 1 month ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/gitlab-registry-and-certfile/54947/4