Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/gitlab: Fix databaseCreateLocally evaluation and operation #69344

Merged
merged 2 commits into from Oct 8, 2019

Conversation

talyz
Copy link
Contributor

@talyz talyz commented Sep 24, 2019

Motivation for this change

Currently, as long as the services.gitlab.databaseCreateLocally option is set to true, the default, we create a local database, even if the services.gitlab.databaseHost option is set, indicating that we're not going to connect to the local database. We also assert that services.gitlab.user and services.gitlab.databaseUsername are equal, which in actuality only matters when services.gitlab.databaseHost is set to its default value "". This issue was raised in #68841.

Even worse, setting services.gitlab.databaseCreateLocally to false results in an evaluation failure unless services.postgresql.enable is set to true either manually or by another module.

This fixes both of these issues and needs to be ported to 19.09.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @aanderse @flokli @globin @mawis

Copy link
Member

@globin globin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine except for style nitpick

nixos/modules/services/misc/gitlab.nix Outdated Show resolved Hide resolved
config.services.postgresql.package is only defined when the postgresql
service is activated, which means we fail to evaluate when
databaseCreateLocally == false. Fix this by using the default
postgresql package when the postgresql service is disabled.
Make sure that we don't create a database if we're not going to
connect to it. Also, fix the assertion that usernames be equal to only
trig when peer authentication is used (databaseHost == "").
@ghost
Copy link

ghost commented Oct 1, 2019

Can this be merged? @globin

@globin globin merged commit b5449e6 into NixOS:master Oct 8, 2019
@talyz talyz deleted the gitlab-create-database branch October 9, 2019 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants