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

gitlab: service doesn't start when enableStartTLSAuto is set to false #86160

Closed
tom-kuca opened this issue Apr 28, 2020 · 1 comment · Fixed by #86173
Closed

gitlab: service doesn't start when enableStartTLSAuto is set to false #86160

tom-kuca opened this issue Apr 28, 2020 · 1 comment · Fixed by #86173

Comments

@tom-kuca
Copy link

GitLab service do not start with configuration services.gitlab.smtp.enableStartTLSAuto = false;.

TLDR boolToString should be used instead of toString when creating config file.

There is an error message in the log:

Apr 28 02:33:29 titan rc0mzxlhr0qg595fkpk22g8mcpczk553-gitlab-pre-start[1009452]: SyntaxError: /nix/store/bzgjldlpl0lrw02b1jrhid8gz1f63356-gitlab-12.8.8/share/gitlab/config/initializers/smtp_settings.rb:12: syntax error, unexpected ','
Apr 28 02:33:29 titan rc0mzxlhr0qg595fkpk22g8mcpczk553-gitlab-pre-start[1009452]:     enable_starttls_auto: ,
Apr 28 02:33:29 titan rc0mzxlhr0qg595fkpk22g8mcpczk553-gitlab-pre-start[1009452]:                           ^
Apr 28 02:33:29 titan rc0mzxlhr0qg595fkpk22g8mcpczk553-gitlab-pre-start[1009452]: /nix/store/bzgjldlpl0lrw02b1jrhid8gz1f63356-gitlab-12.8.8/share/gitlab/config/initializers/smtp_settings.rb:13: syntax error, unexpected ',', expecting end
Apr 28 02:33:29 titan rc0mzxlhr0qg595fkpk22g8mcpczk553-gitlab-pre-start[1009452]: ...ssl/certs/ca-certificates.crt",
…
Apr 28 02:33:29 titan systemd[1]: gitlab.service: Control process exited, code=exited, status=1/FAILURE

To Reproduce
Steps to reproduce the behavior:

  1. Add services.gitlab.smtp.enableStartTLSAuto = false; to configuration.nix
  2. Run nix-switch

Expected behavior
GitLab service should be running after switching to new configuration.

Additional context

The file smtp_settings.rb mentioned in the error:

if Rails.env.production?
  Rails.application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    address: "localhost",
    port: 25,
    
    
    domain: "localhost",
    
    enable_starttls_auto: ,
    ca_file: "/etc/ssl/certs/ca-certificates.crt",
    openssl_verify_mode: 'peer'
  }
end

Note the missing value for enable_starttls_auto: ,. The problem seems to be at

enable_starttls_auto: ${toString cfg.smtp.enableStartTLSAuto},
, toString generates empty string:

nix-repl> builtins.toString false                                   
""

Notify maintainers
@fpletz @globin @krav @talyz

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.28, NixOS, 20.03.git.e03eeffd616M (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.4`
 - channels(root): `"nixos-19.09.2393.60c4ddb97fd"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: []
# a list of nixos modules affected by the problem
module:
- gitlab
tom-kuca added a commit to tom-kuca/nixpkgs that referenced this issue Apr 28, 2020
`toString` function converts `false` to an empty string, which results in a configuration file with invalid syntax:
```
enable_starttls_auto: ,
```
`boolToString` places correct value there.

fixes NixOS#86160
talyz added a commit to talyz/nixpkgs that referenced this issue Apr 28, 2020
'toString false' results in an empty string, which, in this context,
is a syntax error. Use boolToString instead.

Fixes NixOS#86160
@talyz
Copy link
Contributor

talyz commented Apr 28, 2020

Thank you for reporting this! I've fixed this on master and will backport the fix to 20.03 and 19.09.

talyz added a commit to talyz/nixpkgs that referenced this issue Apr 28, 2020
'toString false' results in an empty string, which, in this context,
is a syntax error. Use boolToString instead.

Fixes NixOS#86160

(cherry picked from commit c0a838d)
talyz added a commit to talyz/nixpkgs that referenced this issue Apr 28, 2020
'toString false' results in an empty string, which, in this context,
is a syntax error. Use boolToString instead.

Fixes NixOS#86160

(cherry picked from commit c0a838d)
stigok pushed a commit to stigok/nixpkgs that referenced this issue Jun 12, 2020
'toString false' results in an empty string, which, in this context,
is a syntax error. Use boolToString instead.

Fixes NixOS#86160

(cherry picked from commit c0a838d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants