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/gitea: update service configuration #94291

Merged
merged 7 commits into from Aug 12, 2020
Merged

nixos/gitea: update service configuration #94291

merged 7 commits into from Aug 12, 2020

Conversation

Izorkin
Copy link
Contributor

@Izorkin Izorkin commented Jul 31, 2020

Motivation for this change

Update tmpfiles rules, enable data access only for 'gitea' group.
Created option 'backupDir' to place gitea file dumps in custom path.
Add pid file, need to rotate the logы files using logrotate.
Added socket options to work with nginx over a socket.

cc @aanderse @srhb @c0deaddict @dasJ @Ma27 @Mic92 @flokli

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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.

@aanderse aanderse requested a review from kolaente July 31, 2020 11:21
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Looking good 👍 Just a few minor thoughts. Anyone agree or disagree with my comments?

WorkingDirectory = cfg.stateDir;
ExecStart = "${gitea}/bin/gitea web";
ExecStart = "${gitea}/bin/gitea web --pid /run/gitea/gitea.pid";
Copy link
Member

Choose a reason for hiding this comment

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

@kolaente out of curiosity what impact will this have? I'm assuming it would have been better to have this all along?

Copy link
Member

Choose a reason for hiding this comment

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

By default, Gitea puts its pid in /var/run/gitea.pid, not sure about other effects though

Copy link
Contributor

Choose a reason for hiding this comment

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

While there shouldn't really be much of a reason to write PID files at all, gitea should really not use /var/run, but /run:https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s13.html

I opened go-gitea/gitea#12391, and propose we don't set this here at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, systemd creates a folder in / run. Need to move pifd file to /run/gitea/gitea.pid ?

Copy link
Member

@Mic92 Mic92 Aug 2, 2020

Choose a reason for hiding this comment

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

Should we really block on upstream here? Writing a pid file to /run/gitea does not look like it would break anything. Also why was this pid file added now, did it not work before?

nixos/modules/services/misc/gitea.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gitea.nix Outdated Show resolved Hide resolved
@@ -357,12 +384,22 @@ in
};

systemd.tmpfiles.rules = [
Copy link
Member

Choose a reason for hiding this comment

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

@kolaente just curious why gitea does not provision any of its required sub directories itself. Do you have any insight on that?

Copy link
Member

Choose a reason for hiding this comment

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

You mean the conf, custom and log directories? IIRC it does that if you install it through the web wizard but probably not when installing it the way it is installed in nix.

(I'll ask the other maintainers if they know more about this)

@Ma27
Copy link
Member

Ma27 commented Jul 31, 2020

LGTM (without having tested it yet).

@Izorkin Izorkin force-pushed the gitea branch 2 times, most recently from c666cd5 to 278e576 Compare July 31, 2020 13:50
@Izorkin
Copy link
Contributor Author

Izorkin commented Jul 31, 2020

Update sandboxing options.

nixos/modules/services/misc/gitea.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gitea.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/gitea.nix Outdated Show resolved Hide resolved
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

How many options are listed here: https://docs.gitea.io/en-us/config-cheat-sheet/? 100? More? Should we add them all eventually?

If a nixos option isn't mandatory and doesn't do anything other than add a line to a configuration file there isn't much value in it. See NixOS/rfcs#42 for details discussing the cons to including every configuration option possible.

@Izorkin
Copy link
Contributor Author

Izorkin commented Aug 2, 2020

Removed permSocket

@Izorkin Izorkin force-pushed the gitea branch 2 times, most recently from baae9ca to 98a9ae1 Compare August 2, 2020 17:42
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Any remaining comments? Shall we merge?

Thanks for your work @Izorkin!

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

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

Tested on my server, login and cloning works.

@Mic92
Copy link
Member

Mic92 commented Aug 5, 2020

@GrahamcOfBorg test gitea

@Mic92 Mic92 merged commit dc255dc into NixOS:master Aug 12, 2020
@Izorkin Izorkin deleted the gitea branch August 12, 2020 11:23
@FRidh
Copy link
Member

FRidh commented Feb 15, 2021

This change triggered the installation wizard for me when upgrading from 20.03 to 20.09. That's not very nice. What needs to be done to avoid that?

@Izorkin
Copy link
Contributor Author

Izorkin commented Feb 15, 2021

Need manually restart gitea service - #94751

@FRidh
Copy link
Member

FRidh commented Feb 15, 2021

Indeed, that solved it. Thanks!

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

8 participants