Skip to content

Commit

Permalink
Merge pull request #30 from haiwen/seafdav-patch
Browse files Browse the repository at this point in the history
Seafdav patch
  • Loading branch information
killing authored Aug 23, 2019
2 parents 7213e9c + 25a8362 commit 7668918
Show file tree
Hide file tree
Showing 21 changed files with 1,724 additions and 106 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
*~
*#
*.log
*.gz
/seafdav.conf
/seafdav.fcgi.conf
.cache
.coverage
.eggs
Expand Down
64 changes: 22 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
sudo: false
dist: bionic
language: python

matrix:
include:
- python: "2.7"
env: TOXENV=lint-py27
- python: "3.6"
env: TOXENV=black-check,lint-py36
- python: "2.7"
env: TOXENV=py27
- python: "3.4"
env: TOXENV=py34
- python: "3.5"
env: TOXENV=py35
- python: "3.6"
env: TOXENV=py36
- python: "3.7"
env: TOXENV=py37
dist: xenial
- python: "3.7-dev"
env: TOXENV=py37
- python: "3.8-dev"
env: TOXENV=py38
allow_failures:
- python: "3.7-dev"
env: TOXENV=py37
- python: "3.8-dev"
env: TOXENV=py38

python:
- "3.6"
compiler:
- gcc
addons:
apt:
packages:
- valac
- uuid-dev
- libevent-dev
- libarchive-dev
- intltool
- libjansson-dev
- libonig-dev
- libfuse-dev
- net-tools
before_install:
# See issue #80: litmus fails to build on travis
# The branch 'travis-litmus' still has this enabled to investigate...
# - sudo apt-get install libneon27-dev
# - ./install_litmus.sh

- chmod +x ci/install-deps.sh
- chmod +x ci/functests.sh
- pip install -r ./ci/requirements.txt
install:
- travis_retry pip install -U pip setuptools
- travis_retry pip install -U tox coveralls coverage

- "./ci/install-deps.sh"
script:
- travis_retry tox

after_success:
- coverage combine
- coveralls
- "./ci/functests.sh init && ./ci/functests.sh runserver && ./ci/functests.sh test"
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
The MIT License

Copyright (c) 2009-2019 Martin Wendt, (Original PyFileServer (c) 2005 Ho Chun Wei)
Copyright (c) 2012-present Seafile Ltd.

Seafile webdav server is based on WsgiDAV.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
all: seafdav.tar.gz

seafdav.tar.gz:
git archive HEAD wsgidav | gzip > seafdav.tar.gz
clean:
rm -f *.gz
88 changes: 24 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,33 @@
# ![logo](https://raw.githubusercontent.com/mar10/wsgidav/master/doc/logo.png) WsgiDAV
[![Build Status](https://travis-ci.org/mar10/wsgidav.svg?branch=master)](https://travis-ci.org/mar10/wsgidav)
[![Latest Version](https://img.shields.io/pypi/v/wsgidav.svg)](https://pypi.python.org/pypi/WsgiDAV/)
[![License](https://img.shields.io/pypi/l/wsgidav.svg)](https://github.com/mar10/wsgidav/blob/master/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/wsgidav/badge/?version=latest)](http://wsgidav.readthedocs.io/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![StackOverflow: WsgiDAV](https://img.shields.io/badge/StackOverflow-WsgiDAV-blue.svg)](https://stackoverflow.com/questions/tagged/WsgiDAV)
# Seafile WebDAV Server [![Build Status](https://secure.travis-ci.org/haiwen/seafdav.svg?branch=master)](http://travis-ci.org/haiwen/seafdav)

A generic and extendable [WebDAV](http://www.ietf.org/rfc/rfc4918.txt) server
written in Python and based on [WSGI](http://www.python.org/dev/peps/pep-3333/).
This is the WebDAV server for seafile.

Main features:
See [Seafile Server Manual](http://manual.seafile.com/extension/webdav.html) for details.

- WsgiDAV is a stand-alone WebDAV server with SSL support, that can be
installed and run as Python command line script on Linux, OSX, and Windows:<br>
```
$ pip install wsgidav cheroot
$ wsgidav --host=0.0.0.0 --port=8080 --root=/tmp
WARNING: share '/' will allow anonymous access.
Running WsgiDAV/2.2.2 Cheroot/5.5.0 Python/3.4.2
Serving on http://0.0.0.0:8080 ...
```
Run `wsgidav --help` for a list of available options.<br>
**Note:** The syntax changed slightly with v3.0.
- **Note:** Windows users may prefer the
[MSI Installer](https://github.com/mar10/wsgidav/releases/latest)
(see <kbd>Assets</kbd> section).
- WebDAV is a superset of HTTP, so WsgiDAV is also a performant, multi-threaded
web server with SSL support.
- WsgiDAV is also a Python library that implements the WSGI protocol and can
be run behind any WSGI compliant web server.<br>
- WsgiDAV is implemented as a configurable stack of WSGI middleware
applications.<br>
Its open architecture allows to extend the functionality and integrate
WebDAV services into your project.<br>
Typical use cases are:
- Expose data structures as virtual, editable file systems.
- Allow online editing of MS Office documents.
# Running

There are two templates for running seafdav:
- run.sh.template: This is for running seafdav on the default 8080 port with a built-in CherryPy server.
- run-fcgi.sh.template and seafdav.conf.template:
These two files are for running seafdav on fastcgi mode.

## Status
To run on 8080 port:

[![Latest Version](https://img.shields.io/pypi/v/wsgidav.svg)](https://pypi.python.org/pypi/WsgiDAV/)
See the ([change log](https://github.com/mar10/wsgidav/blob/master/CHANGELOG.md)) for details.
```
cp run.sh.template run.sh
```

**Note:** Release 3.0 introduces some refactorings and breaking changes.<br>
See the ([change log](https://github.com/mar10/wsgidav/blob/master/CHANGELOG.md)) for details.
Then change CCNET_CONF_DIR and SEAFILE_CONF_DIR to your Seafile server's settings.

# Testing

## More info

* [Read The Docs](http://wsgidav.rtfd.org) for details.
* [Discussion Group](https://groups.google.com/forum/#!forum/wsgidav)
* [Stackoverflow](http://stackoverflow.com/questions/tagged/wsgidav)


## Credits

Contributors:

* WsgiDAV is a [refactored version](https://github.com/mar10/wsgidav/blob/master/doc/changelog04.md)
of [PyFileServer 0.2](https://github.com/cwho/pyfileserver),
Copyright (c) 2005 Ho Chun Wei.<br>
Chun gave his approval to change the license from LGPL to MIT-License for
this project.
* <https://github.com/mar10/wsgidav/contributors>
* Markus Majer for providing the logo (a mixture of the international
maritime signal flag for 'W (Whiskey)' and a dove.)


Any kind of feedback is very welcome!<br>
Have fun :-)<br>
Martin
- start local seafile server
- start local seahub server (While seafdav itself doesn't require seahub, we use seahub webapi as a driver for testing)
- start seafdav server
- create a test user `test@seafiltest.com` with password `test`
- Run the tests
```
export CCNET_CONF_DIR=/path/to/ccnet
export SEAFILE_CONF_DIR=/path/to/seafile-data
./functest.sh test
```
67 changes: 67 additions & 0 deletions ci/functests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
set -e
if [ $# -lt "1" ]; then
echo
echo "Usage: ./functests.sh {init|runserver|test}"
echo
exit 1
fi
if [ ${TRAVIS} ] ;then
set -x
CCNET_CONF_DIR="/tmp/seafile-server/tests/conf"
SEAFILE_CONF_DIR="/tmp/seafile-server/tests/conf/seafile-data"
PYTHONPATH="/usr/local/lib/python3.6/site-packages:/tmp/seafobj:${PYTHONPATH}"
export PYTHONPATH
export CCNET_CONF_DIR
export SEAFILE_CONF_DIR

fi

function start_server() {
ccnet-server -c /tmp/seafile-server/tests/conf -f - &
seaf-server -c /tmp/seafile-server/tests/conf -d /tmp/seafile-server/tests/conf/seafile-data -f -l - &
sleep 2
}

function init() {
mkdir /tmp/seafile-server/tests/conf/seafile-data
touch /tmp/seafile-server/tests/conf/seafile-data/seafile.conf
cat > /tmp/seafile-server/tests/conf/seafile-data/seafile.conf << EOF
[database]
create_tables = true
EOF
touch ${CCNET_CONF_DIR}/seafile.ini
cat > ${CCNET_CONF_DIR}/seafile.ini << EOF
/tmp/seafile-server/tests/conf/seafile-data
EOF
start_server
python -c "from seaserv import ccnet_api as api;api.add_emailuser('test@seafiletest.com','test',0,1)"
}

function start_seafdav() {
if [ ${TRAVIS} ]; then
cd ${TRAVIS_BUILD_DIR}
python -m wsgidav.server.server_cli --host=127.0.0.1 --port=8080 --root=/ --server=gunicorn &
sleep 5
fi
}

function run_tests() {
cd seafdav_tests
py.test
}

case $1 in
"init")
init
;;
"runserver")
start_seafdav
;;
"test")
run_tests
;;
*)
echo "unknow command \"$1\""
;;
esac

38 changes: 38 additions & 0 deletions ci/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -e -x

git clone --depth=1 --branch=master git://github.com/haiwen/libevhtp /tmp/libevhtp
cd /tmp/libevhtp
cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .
make -j2
sudo make install
cd -

git clone --depth=1 --branch=master git://github.com/haiwen/libsearpc /tmp/libsearpc
cd /tmp/libsearpc
./autogen.sh
./configure
make -j2
sudo make install
cd -

git clone --depth=1 --branch=master git://github.com/haiwen/ccnet-server /tmp/ccnet-server
cd /tmp/ccnet-server
./autogen.sh
./configure
make -j2
sudo make install
cd -

git clone --depth=1 --branch=master git://github.com/haiwen/seafile-server /tmp/seafile-server
cd /tmp/seafile-server
./autogen.sh
./configure
make -j2
sudo make install
cd -

sudo ldconfig

git clone --depth=1 --branch=master git://github.com/haiwen/seafobj /tmp/seafobj
15 changes: 15 additions & 0 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
termcolor>=1.1.0
requests>=2.8.0
pytest>=3.3.2
backports.functools_lru_cache>=1.4
tenacity>=4.8.0
defusedxml~=0.5
Jinja2~=2.10
jsmin~=2.2
python-pam~=1.8
PyYAML~=5.1
six~=1.12
gunicorn
future
lxml
sqlalchemy
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ jsmin~=2.2
python-pam~=1.8
PyYAML~=5.1
six~=1.12
lxml
sqlalchemy
10 changes: 10 additions & 0 deletions run.sh.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

export CCNET_CONF_DIR=/data/data/ccnet
export SEAFILE_CONF_DIR=/data/data/seafile-data

TOP_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")

cd "$TOP_DIR"

python -m wsgidav.server.run_server --host=0.0.0.0 --port=8080 --root=/ --server=gunicorn
Loading

0 comments on commit 7668918

Please sign in to comment.