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/gotenberg: init #326372

Merged
merged 4 commits into from
Jul 17, 2024
Merged

nixos/gotenberg: init #326372

merged 4 commits into from
Jul 17, 2024

Conversation

pyrox0
Copy link
Member

@pyrox0 pyrox0 commented Jul 11, 2024

Description of changes

This adds Gotenberg, an API server for file conversions to PDF. It can be used in paperless-ngx, and with the 2.11.0 release, paperless only supports Gotenberg version 8, so it seemed like the right time to package it.

Module tests have been added, as well as release notes entries.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/prs-ready-for-review/3032/4230

nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Show resolved Hide resolved
pkgs/by-name/go/gotenberg/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/go/gotenberg/package.nix Show resolved Hide resolved
pkgs/by-name/go/gotenberg/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/go/gotenberg/package.nix Outdated Show resolved Hide resolved
Comment on lines 189 to 199
assertions = [
{
assertion = cfg.enableBasicAuth -> cfg.environmentFile != null;
message = ''
When enabling HTTP Basic Authentication with `services.gotenberg.enableBasicAuth`,
you must provide an environment file(via `services.gotenberg.environmentFile`) with the appropriate environment variables set in it!

See `services.gotenberg.enableBasicAuth` for the names of those variables!
'';
}
];
Copy link
Member

Choose a reason for hiding this comment

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

im a bit iffy on this assertion. i understand why it's there (as to discourage leaking secrets), but i haven't seen this in many other modules...

i'd welcome it nonetheless, but i think some others commenting on it would be nice

@getchoo getchoo mentioned this pull request Jul 11, 2024
13 tasks
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

nice, good work! Just some little refinements and then we can merge this.

nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
pkgs/by-name/go/gotenberg/package.nix Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Show resolved Hide resolved
nixos/modules/services/misc/gotenberg.nix Outdated Show resolved Hide resolved
@SuperSandro2000
Copy link
Member

I quickly pushed the last changes myself to be able to merge this 😅

@SuperSandro2000 SuperSandro2000 merged commit d1fbb7d into NixOS:master Jul 17, 2024
29 of 31 checks passed
@pyrox0 pyrox0 mentioned this pull request Jul 17, 2024
13 tasks
@pyrox0 pyrox0 deleted the gotenberg-init branch August 4, 2024 23:21
Copy link
Contributor

@nh2 nh2 left a comment

Choose a reason for hiding this comment

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

I added two likely oversights we shoudl address with a follow-up PR.

nixos/modules/services/misc/gotenberg.nix Show resolved Hide resolved
@nh2
Copy link
Contributor

nh2 commented Oct 16, 2024

@pyrox0 Another issue you're likely interested in:

Happens to me when paperless-ngx tries to send an .xls to gotenberg.

@nh2
Copy link
Contributor

nh2 commented Oct 17, 2024

Oddly on latest nixos-unstable Hydra fails to build it:

https://hydra.nixos.org/build/274719893

Running phase: checkPhase
--- FAIL: TestCmd_Wait (0.01s)
    --- FAIL: TestCmd_Wait/wait_error (0.00s)
        cmd_test.go:133: expected error but got none
{"level":"debug","logger":"echo.stdout","msg":"Hello World"}
FAIL
FAIL    github.com/gotenberg/gotenberg/v8/pkg/gotenberg 11.052s
FAIL

On a slow PC, it fails for me too, but with another error message:

Running phase: checkPhase
ok      github.com/gotenberg/gotenberg/v8/pkg/gotenberg 11.481s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/api       0.341s
--- FAIL: TestChromiumBrowser_Start (10.12s)
    --- FAIL: TestChromiumBrowser_Start/successful_start (5.05s)
        browser_test.go:101: expected no error but got: run exec allocator: websocket url timeout reached
    --- FAIL: TestChromiumBrowser_Start/all_browser_arguments (5.06s)
        browser_test.go:101: expected no error but got: run exec allocator: websocket url timeout reached
--- FAIL: TestChromiumBrowser_Healthy (6.24s)
    --- FAIL: TestChromiumBrowser_Healthy/healthy_browser (5.07s)
        browser_test.go:220: setup error: run exec allocator: websocket url timeout reached
FAIL
FAIL    github.com/gotenberg/gotenberg/v8/pkg/modules/chromium  26.653s
FAIL
error: builder for '/nix/store/vnxyn579m9shpfilbm4i75i6c08yc767-gotenberg-8.9.1.drv' failed with exit code 1

On a fast PC, it builds:

Running phase: checkPhase
ok      github.com/gotenberg/gotenberg/v8/pkg/gotenberg 11.013s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/api       0.218s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/chromium  1.105s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/exiftool  0.527s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/libreoffice       0.004s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/libreoffice/api   11.405s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/libreoffice/pdfengine     0.004s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/logging   0.003s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/pdfcpu    0.012s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/pdfengines        0.003s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/pdftk     0.435s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/prometheus        0.004s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/qpdf      0.016s
ok      github.com/gotenberg/gotenberg/v8/pkg/modules/webhook   0.007s
checkPhase completed in 42 seconds

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.

7 participants