WsgiDAV

A generic and extendable WebDAV server written in Python and based on WSGI. It can be used to share files between across your various devices or with friends.


Note

For this guide you should be familiar with the basic concepts of

License

MIT license.

Installation

Use pip3 to install wsgidav:

[isabell@stardust ~]$ pip3 install wsgidav cheroot --user

Create the data folder:

[isabell@stardust ~]$ mkdir ~/webdav

Add additional folders you want to access via webdav with:

[isabell@stardust ~]$ mkdir ~/webdav/<newfoldername>

Config file

Note

Only use spaces to indent in the config file! No tabs!

We will modify this example config (YAML): https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html#sample-wsgidav-yaml

Define which folder should be accessible:

mount_path: null
provider_mapping:
    "/": "/home/isabell/webdav/"
    "/firstpath": "/home/isabell/webdav/<newpath>"
# Adds folder "/home/isabell/webdav/<newpath>" to URL https://isabell.uber.space/firstpath

Add user and password for every path:

simple_dc:
    user_mapping:
        "*":  # default (used for all shares that are not explicitly listed). Keep this one!
            "isabell":
                password: "<password>" # Change it!
                roles: ["editor"]
        "/firstpath": # The mount_path this user has access to.
            "isabellscousin": # Username
                password: "<password>" # Password. Change it!
# You can add multiple users for every path.

Save the file here:

~/etc/wsgidav.yaml

Configure web server

To make the web server available as a web backend you have to explicitly set the host ip address in the configuration file ~/etc/wsgidav.yaml.

host: 0.0.0.0

Note

wsgidav is running on port 8080.

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

Configure supervisord

Create ~/etc/services.d/wsgidav.ini with the following content:

[program:wsgidav]
command=wsgidav -c %(ENV_HOME)s/etc/wsgidav.yaml
directory = %(ENV_HOME)s/webdav
autostart=yes
autorestart=yes

Start Service

After creating the configuration, tell supervisord to refresh its configuration and start the service:

[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE                            RUNNING   pid 26020, uptime 0:03:14
[isabell@stardust ~]$

Now go to https://<username>.uber.space (would be https://isabell.uber.space in our example) and see if it works. Enjoy!

Updates

First, create a backup of your config file:

[isabell@stardust ~]$ cp ~/etc/wsgidav.yaml ~/etc/wsgidav.backup.yaml

Next, update the wsgidav installation and restart the service:

[isabell@stardust ~]$ pip3 install --upgrade wsgidav cheroot --user
[isabell@stardust ~]$ supervisorctl restart wsgidav

Check the service status:

[isabell@stardust ~]$ supervisorctl status wsgidav

If the service is not in RUNNING state, refer to the “Troubleshooting” section.

Troubleshooting

Check the service logs:

[isabell@stardust ~]$ tail -n 20 ~/logs/supervisord.log

Problem: Configuration has changed

If the log output for wsgidav looks like:

- Deprecated option 'debug_litmus': use 'logging.debug_litmus' instead.
- Deprecated option 'debug_methods': use 'logging.debug_methods' instead.
- Deprecated option 'dir_browser.ms_mount': use '(removed)' instead.

it might be that the configuration format of ~/etc/wsgidav.yaml has changed with the latest update. Edit the ~/etc/wsgidav.yaml file as suggested in the error logs. You can always compare your configuration to the example yaml file from the latest documentation: https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html#sample-wsgidav-yaml

After updating the configuration, restart the service using supervisorctl restart wsgidav. If wsgidav still fails to start up, repeat the troubleshooting steps and check for other errors that might have been hidden previously.


Tested with wsgidav 3.1.0, Uberspace 7.8.1.0

Written by: Sebastian Burschel <https://github.com/SeBaBu/>