-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
flyx
wants to merge
4
commits into
NixOS:master
Choose a base branch
from
flyx:seafdav
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4392,6 +4392,12 @@ | |
githubId = 74379; | ||
name = "Florian Pester"; | ||
}; | ||
flyx = { | ||
email = "[email protected]"; | ||
github = "flyx"; | ||
githubId = 791710; | ||
name = "Felix Krause"; | ||
}; | ||
fmthoma = { | ||
email = "[email protected]"; | ||
github = "fmthoma"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,10 @@ import ./make-test-python.nix ({ pkgs, ... }: | |
ccnetSettings.General.SERVICE_URL = "http://server"; | ||
adminEmail = "[email protected]"; | ||
initialAdminPassword = "seafile_password"; | ||
webdav = { | ||
enable = true; | ||
shareName = "/webdav"; | ||
}; | ||
}; | ||
services.nginx = { | ||
enable = true; | ||
|
@@ -33,6 +37,7 @@ import ./make-test-python.nix ({ pkgs, ... }: | |
proxy_http_version 1.1; | ||
''; | ||
}; | ||
locations."/webdav".proxyPass = "http://unix:/run/seafdav/gunicorn.sock:/webdav"; | ||
}; | ||
}; | ||
networking.firewall = { allowedTCPPorts = [ 80 ]; }; | ||
|
@@ -117,5 +122,15 @@ import ./make-test-python.nix ({ pkgs, ... }: | |
client2.succeed("ls -la test01 >&2") | ||
|
||
client2.succeed('[ `cat test01/first_file` = "bla" ]') | ||
|
||
with subtest("start webdav-server"): | ||
server.wait_for_unit("seafdav.service") | ||
server.wait_for_file("/run/seafdav/gunicorn.sock") | ||
|
||
with subtest("webdav download file"): | ||
client2.succeed( | ||
"curl http://server/webdav/test01/first_file -u admin\@example.com -p seafile_password -o first_file.webdav" | ||
) | ||
client2.succeed('[ `cat first_file.webdav` = "bla" ]') | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ lib | ||
, fetchFromGitHub | ||
, python3 | ||
, makeWrapper | ||
}: | ||
python3.pkgs.buildPythonApplication rec { | ||
pname = "seafdav"; | ||
version = "9.0.7"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "haiwen"; | ||
repo = "seafdav"; | ||
rev = "v${version}-server"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
sha256 = "0jdspxz9cakpx0vipqsqf02llz3w02fjid3kff0kclz9apmyvx55"; | ||
}; | ||
|
||
dontBuild = true; # $out will contain Python sources, no build necessary | ||
|
||
doCheck = false; # disabled because it requires a ccnet environment | ||
|
||
propagatedBuildInputs = with python3.pkgs; [ | ||
defusedxml | ||
future | ||
jinja2 | ||
json5 | ||
pysearpc | ||
python-pam | ||
pyyaml | ||
six | ||
lxml | ||
seaserv | ||
seafobj | ||
sqlalchemy | ||
gunicorn | ||
]; | ||
|
||
installPhase = '' | ||
cp -dr --no-preserve='ownership' . $out/ | ||
cp ${./seafdav.py} $out/seafdav.py | ||
''; | ||
|
||
passthru = { | ||
python = python3; | ||
pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs; | ||
}; | ||
|
||
meta = with lib; { | ||
description = "Seafile WebDAV Server"; | ||
homepage = "https://github.com/haiwen/seafdav"; | ||
license = licenses.mit; | ||
maintainers = with maintainers; [ flyx ]; | ||
platforms = platforms.linux; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This is a WSGI application that can be run via GUnicorn. | ||
# | ||
# It is unclear why Seafile does not provide this script with seafdav, | ||
# when a similar script does exist for seahub. The existing server_cli | ||
# script is not as flexible since it is a Python script that launches | ||
# GUnicorn (or other WSGI servers) instead of being a consumable | ||
# WSGI application. For example, server_cli isn't able to bind to a | ||
# unix socket. | ||
|
||
from wsgidav.default_conf import DEFAULT_CONFIG | ||
from wsgidav.wsgidav_app import WsgiDAVApp | ||
from wsgidav.server.server_cli import _loadSeafileSettings | ||
|
||
import copy, logging | ||
|
||
config = copy.deepcopy(DEFAULT_CONFIG) | ||
|
||
logging.info("share_name = %s", config.get("share_name")) | ||
|
||
# gets us data from seafdav.conf, | ||
# and sets up the general Seafile configuration. | ||
_loadSeafileSettings(config) | ||
|
||
application = WsgiDAVApp(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ lib | ||
, fetchFromGitHub | ||
, buildPythonPackage | ||
, boto3 | ||
, coverage | ||
, future | ||
, mock | ||
, nose | ||
, python | ||
}: | ||
buildPythonPackage rec { | ||
pname = "seafobj"; | ||
version = "9.0.7"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "haiwen"; | ||
repo = "seafobj"; | ||
rev = "v${version}-server"; | ||
sha256 = "04vn75x4yx3lcvll69q4q0g4gbqlc4w7047x7hxan1zramjmdxfg"; | ||
}; | ||
|
||
dontBuild = true; # $out will contain Python sources, no build necessary | ||
|
||
checkInputs = [ coverage mock nose boto3 ]; | ||
|
||
checkPhase = '' | ||
runHook preCheck | ||
PYTHONPATH=$PYTHONPATH:seafobj ${python.interpreter} run_test.py --storage fs | ||
runHook postCheck | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
dest="$out/${python.sitePackages}" | ||
mkdir -p $dest | ||
cp -dr --no-preserve='ownership' seafobj $dest/ | ||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/haiwen/seafobj"; | ||
description = "Python library for accessing seafile data model"; | ||
maintainers = with maintainers; [ flyx ]; | ||
license = licenses.asl20; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we need
/etc/seafile
in pythonpath?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.
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.