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

Seafile WebDAV extension (dependencies, package, and integration to seafile service) #171878

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

flyx
Copy link

@flyx flyx commented May 6, 2022

Description of changes

This adds the Python library seafobj and the Python WSGI application seafdav, both of which belong with the Seafile server. Version is 8.0.8 which is not the most recent one, but conforms to the current versions of existing seafile-server and seahub packages.

seafdav provides a WebDAV interface to a running seafile-server. seafobj is a dependency of seafdav.

The nixos/seafile service has been extended to provide options for automatically starting the WebDAV extension alongside the server. I opted to not allow freeform settings since the existing settings are already confusing – some are consumed by seafdav itself, some by the script server_cli (which my setup doesn't use), and some only when using Seafile's own management script seafile.sh (which isn't viable for NixOS). I wanted to clearly communicate which values are actually relevant.

I reviewed the relevant code (mainly server_cli.py) to learn how the settings are used, and then added and used a simpler WSGI application setup script for the service setup. This enables a service setup very similar to the one of seahub, which also is a WSGI application. This should be easier to maintain than running the server_cli.py script provided from upstream.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 22.05 Release Notes (or backporting 21.11 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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

ping @schmittlauch @greizgh (maintainers of the other Seafile packages)

@flyx flyx requested review from FRidh and jonringer as code owners May 6, 2022 23:14
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python 8.has: module (update) This PR changes an existing module in `nixos/` labels May 6, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels May 7, 2022
Copy link
Member

@pbsds pbsds left a comment

Choose a reason for hiding this comment

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

Impressive PR for a first-time contributor! Sorry for the long wait, this is not normal. Do not be discouraged!

The diff LGTM, but i have not test-run the package.

Could you please consider adding a nixos test for this module? Something as simple as a test that pings the webdav port should be sufficient.
here is an example

sha256 = "1gpvmfamjbw90gh9njgmba58qnzxji1w1sra46spnhi9k778mds3";
};

dontBuild = true;
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment justifying this.

sha256 = "0jwgbx083mwwh18x7450igq748bbld9s7zgibwv1cxwrrny1aari";
};

dontBuild = true;
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment justifying this.

src = fetchFromGitHub {
owner = "haiwen";
repo = "seafobj";
rev = "v8.0.8-server";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rev = "v8.0.8-server";
rev = "v${version}-server";

, nose
, python
}:
buildPythonPackage {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
buildPythonPackage {
buildPythonPackage rec {


installPhase = ''
runHook preInstall
dest="$out/lib/${python.libPrefix}/site-packages"
Copy link
Member

Choose a reason for hiding this comment

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

something like this should exist:

Suggested change
dest="$out/lib/${python.libPrefix}/site-packages"
dest="$out/${python.sitePackages}"

Consider inlining it instead of using a variable.

src = fetchFromGitHub {
owner = "haiwen";
repo = "seafdav";
rev = "v8.0.8-server";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rev = "v8.0.8-server";
rev = "v${version}-server";

@pbsds
Copy link
Member

pbsds commented Aug 6, 2022

Result of nixpkgs-review pr 171878 run on x86_64-linux 1

2 packages blacklisted:
  • nixos-install-tools
  • tests.nixos-functions.nixos-test

@flyx flyx force-pushed the seafdav branch 7 times, most recently from 099c4d7 to a60e225 Compare August 8, 2022 20:28
@flyx
Copy link
Author

flyx commented Aug 8, 2022

@pbsds Thanks for the review. I addressed your comments. Since Seafile has already a test, I simply added WebDAV subtests to it. Testing those showed that I forgot adding my packages to top-level, which I fixed. Running the test runs into an error in the seahub part (missing module 'drafts') and I haven't been able to figure out why, but perhaps I am simply running the test the wrong way…

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin labels Aug 8, 2022
Copy link
Contributor

@greizgh greizgh left a comment

Choose a reason for hiding this comment

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

re: testing, draft error sounds like #173825. Make sure you rebase to get the fix.

requires = [ "seaf-server.service" ];
restartTriggers = [ seahubSettings ];
environment = {
PYTHONPATH = "${pkgs.seafdav.pythonPath}:${pkgs.seafdav}:/etc/seafile";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need /etc/seafile in pythonpath?

Suggested change
PYTHONPATH = "${pkgs.seafdav.pythonPath}:${pkgs.seafdav}:/etc/seafile";
PYTHONPATH = "${pkgs.seafdav.pythonPath}:${pkgs.seafdav}";

Copy link
Author

Choose a reason for hiding this comment

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

This is required for loading the seahub_settings.py which is processed by SeafDAV. From what I understand, this is handled via django settings for actual seahub, but that is not used in SeafDAV so I'm unsure whether there's a better way to do this.

src = fetchFromGitHub {
owner = "haiwen";
repo = "seafdav";
rev = "v${version}-server";
Copy link
Contributor

Choose a reason for hiding this comment

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

Upstream has a habit of pushing over existing tags, on other seafile component we end up using commit hashes.
Let's hope this is not the case here 🤞

}:
python3.pkgs.buildPythonApplication rec {
pname = "seafdav";
version = "8.0.8";
Copy link
Contributor

Choose a reason for hiding this comment

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

seafile-server has been updated to 9.0.x, maybe update this component too?

Copy link
Author

Choose a reason for hiding this comment

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

Yes now that the other packages have been updated this should be too. I pushed the 9.0.7 version.

flyx added 3 commits August 10, 2022 22:08
Python module required for the Seafile WebDAV extension
WebDAV extension for Seafile server.
Package adds a WSGI application for easy deployment, which is
lacking from upstream sources.
Added option to start the optional WebDAV service alongside a
Seafile server. Added options for configuring the WebDAV service.
Added subtests for WebDAV server to Seafile test.
@flyx
Copy link
Author

flyx commented Aug 10, 2022

@greizgh Did a rebase and the error vanished, but test still fails with a timeout on starting seahub. Might be that my machine is simply too slow.

@greizgh
Copy link
Contributor

greizgh commented Dec 3, 2022

@greizgh Did a rebase and the error vanished, but test still fails with a timeout on starting seahub. Might be that my machine is simply too slow.

Tests were flaky because of sleep conditions, it should be fixed by #195253.

@ddelabru
Copy link
Contributor

This addresses the same functionality as #152069 but at present it looks like this one is the more complete pull request.

@Janik-Haag Janik-Haag added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
@hustlerone
Copy link
Contributor

So... What's keeping this from being merged?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 4, 2025
@flyx
Copy link
Author

flyx commented Mar 4, 2025

So... What's keeping this from being merged?

I lost interest in pushing this to get merged due to the long process. I just integrated it as local overlay on my system.

For the PR to be merged the seafobj/seafdav version should be updated (server and seahub have been bumped to 11.0.12 on nixos stable & unstable). Not sure whether this requires additional changes. In any case, I won't be doing it since the newer Seafile versions dropped support for postgres, which make me rather want to switch to an alternative than to upgrade.

Feel free to adopt the PR.

@hustlerone
Copy link
Contributor

Nextcloud isn't any better hence my interest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants