-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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: make use of declarative features where applicable #61923
Conversation
The patches itself seem fine, I'll do some testing on one of the next weekends unless one of the other maintainers is faster :) |
cc @kolaente |
@Ma27 I'm planning on testing this on an existing instance running mysql. Do you happen to have an existing instance running postgresql to test on? |
Updated code to add more declarative goodness via |
It's on my todo list to move several self-hosted services (including gitea) from sqlite to postgresql. |
@GrahamcOfBorg test gitea.mysql gitea.postgres gitea.sqlite |
@Ma27 That would be great. I haven't completely convinced myself this won't break existing |
@artemist If you're available for review and/or testing I would appreciate. |
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployed the patches onto a gitea instance with postgresql
running and an existing data set and didn't encounter any issues, so 👍
@GrahamcOfBorg test gitea.mysql gitea.postgres gitea.sqlite |
@Ma27 if you feel I've adequately addressed your most recent comments please feel free to merge as after you reported back on testing I feel this is ready. Thanks everyone! |
Had a final look, with passing tests and having this tested with actual data I guess this should be fine now 👍 |
@aanderse thanks! |
Thanks to all for feedback, review, and testing! |
This broke my configuration: I have After upgrade to 19.09, it says "services.gitea.database.user must match services.gitea.user if the database is to be automatically provisioned". :( I know I'm late to the party, but... For me, this is clearly a regression. And this change wasn't even mentioned in release notes. Also, this change overloads the |
@pvgoran sorry for the trouble 😞 Did you end up resolving this? For what reason are you using a local database but not socket authentication? |
@aanderse For now, I resolved this by using an old version of the module. Which is hardly an acceptable long-term solution. I'm using the local database (postgresql) because gitea's system user is different from its database user. The system user is I don't know what other details I can provide. My problem is simple: the configuration that worked before is (as of release 19.09) not accepted by NixOS anymore. |
@pvgoran that makes sense. While the documentation wasn't enough to explain the changes required in your case, fortunately the "fix" is quite trivial so we can get you back to using the most recent version of the module. I assume all you need to do is set
Since you have an existing install the Please let me know if this works out or not. |
@aanderse I know that I can set |
@pvgoran yes, you are correct... |
That's the opposite of what I meant.
|
Please keep in mind |
Well, I don't want to argue about the meaning of words, it's counterproductive. The problem is, the configuration The requirement for |
@pvgoran I don't mean to come off as troublesome, but I really can't stress enough how you have been mislead by this module to think it was reproducible. As soon as you set For example, take this config:
And replace it with this configuration:
You have lost all reproducibility. I really really really want to stress these types of options lead to systems which are not reproducible. Documenting this and trying to bring a better understanding of the issue to the attention of our users and developers has been something @grahamc, @flokli and myself have been discussing over the past few months. See nixpkgs/nixos/modules/services/misc/gitea.nix Line 336 in f53bdf3
|
What's wrong with documenting this change in the 19.09 release-notes? Breaking changes do happen. |
@aanderse If we are talking about reproducibility in the strict sense, then NixOS, being a stateful Linux installation, can't really be reproducible (well, except maybe if special care is taken to ensure that all state is destroyed on activation; I don't think this is easy to achieve). It's not a Docker container which is designed to work statelessly (at least in some common cases). I'm fully aware of the consequences of the scenario that you described. It's not anything new, it exists on the system level when On the other hand, there are properties of the instance that are normally preserved during activation, and reproduced when deploying the same configuration to a new machine (even if state is different). In many cases, and in this case too, these properties boil down to "the system is running the particular service, and this service is usable". I may be wrong, but having the ability to maintain such invariant properties is one of the strong points of NixOS's declarative configuration system. And with this change, this ability, for this particular case, was lost. |
@Ma27 Even if breaking changes happen, they are hardly desirable. If there is no way around them (which is not the case here), it would be better to first deprecate a feature, and only remove it in the next release. |
This derailed a bit from @pvgoran 's the initial report, so let me try to explain what happened: Before
|
@flokli Thanks for writing a summary, this will probably help someone to understand the situation. Of course, an assertion is better than silently producing a broken configuration (or, even worse, a configuration that is not broken immediately, but will fail on a fresh instance).
Instead of this, I would rather see the commit reverted altogether, so that the functionality I'm using was restored, instead of being properly documented as removed. Or, perhaps even better, the |
@pvgoran it actually made sense to aggregate this logic into the database-specific nixos module by then. Looking at the diff from #84146, it'll be made more explicit in the gitea module: https://github.com/NixOS/nixpkgs/pull/84146/files#diff-ca28bfecf4338f2def6526c29a1ddc36R299. Adding all the new options, and only adding them for gitea (and for every other module using some sort of databases) probably isn't desirable. If your initial concern was not having to amend config, adding these won't help. I propose to provide a "somewhat good default" for most users, and if you deviate from the default config, you're expected to do the setup by yourself. This descreases the possibilities for pitfalls considerably. |
@flokli Of course it made sense. I see how it simplifies the module code. The only problem is that the functionality that I happen to use was sacrificed in the process.
It's not about having to change the configuration text, it's about having to change the configuration meaning. Now I either have to change the Git URLs to use
Well, I'd argue that using the same name for Gitea's system user and for Gitea's database user is a poor default. I explained the reasons for using different user names in this comment, and I think that these reasons are quite sensible. |
@pvgoran it has been done, and it doesn't make any sense to change it back now either. The few users that used gitea and had nonstandard usernames would already have migrated when switching to 19.09. We can add a release note entry if there's still people late at the party migrating now to 19.09, but I see zero benefit adding error-prone migration code half a year after most people already migrated. |
@flokli It does make sense to change it back: like I said, the current defaults are poor. But I understand that I'm fighting a lost battle here: even if this change was a mistake, noone likes to admit mistakes (let alone correct them), if making this mistake was (and continues to be) convenient. |
@pvgoran I assure you that after multiple lengthy video calls, chats, and time spent contemplating the issue neither @flokli nor myself view this change as a mistake and are having a hard time admitting so. We simply have a different opinion than yours. I'd also like you to know I have spent more than a non trivial amount of time discussing the discussion in this thread with various community members and I don't feel "good" about where we are at. While I hold my position I really am regretting how this thread and change make you feel. I don't intend to trivialize your opinion. After spending some more time understanding your position and goals I wonder if this solution is adequate for you:
It has the downside of being more verbose, but it does satisfy other criteria for a solution you mentioned so far. To be fair NixOS gives you the tool to create your own system user |
@aanderse I appreciate you giving it some thought, and I feel uneasy about occupying attention of several people with this subject.
What do you mean here? Is there a way to create the user
It doesn't seem good. It's non-modular (it "appropriates" the So I'll probably end up writing a generic module that would generate systemd service(s) to (1) generate a random password file or copy it from somewhere, (2) create a postgres user and assign the password to it, (3) make this file accessible to a specified user. |
Motivation for this change
I threw this together quickly so haven't really given any thought into how this would impact upgrading existing installations. I just wanted to get the code out there so I could get some feedback sooner rather than later. Feedback (positive or negative) appreciated.
NOTE: Best to review this commit by commit. If you think this should be broken up into multiple PRs I probably agree with you and can do so.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)