Self-hosted file sharing cloud for you and your friends
Find a file
2022-04-25 20:52:17 +02:00
images update screenshot 2022-04-24 21:49:27 +02:00
public update README 2022-04-24 20:59:07 +02:00
raincloud change configuration method 2022-04-25 20:18:16 +02:00
.gitignore make package 2022-04-24 17:48:32 +02:00
flake.lock clean repo 2022-04-24 17:56:59 +02:00
flake.nix change configuration method 2022-04-25 20:18:16 +02:00
MANIFEST.in fix package 2022-04-24 20:47:14 +02:00
README.org update module options 2022-04-25 20:52:17 +02:00
run.py change configuration method 2022-04-25 20:18:16 +02:00
setup.py make package 2022-04-24 17:48:32 +02:00

raincloud

A self-hosted file sharing cloud for you and your friends.

/denis/raincloud/media/commit/0564f34081b151154b30376d02164943186cd9d1/images/screenshot.png

Your friends can't use tools like magic-wormhole and you don't want them to upload private data to dubious hosters? You want to store a file from a computer you don't own and forgot your USB stick? Then maybe raincloud is for you.

A flat directory structure is used to generate HTTP routes on the fly. All subdirectories in a base path form a route if they contain a rc.toml configuration file. This configuration file can be used to allow downloading and uploading files to a directory or protecting routes with passwords.

Example

Assuming you host raincloud at https://cloud.example.com and your base path is /var/www/public with the following directory structure:

  public
  ├── alice
  │   ├── big_buck_bunny.mkv
  │   ├── elephants_dream.mkv
  │   ├── rc.toml
  │   └── the_daily_dweebs.mkv
  └── inbox
      ├── logo.svg
      └── rc.toml

Then the following two routes exist:

  • https://cloud.example.org/alice
  • https://cloud.example.org/inbox

All other routes return 404 Not Found. If the files are downloadable, people can upload new files or the files are password protected can be configured in the rc.toml files.

This repository contains the above listed public directory for testing raincloud locally. Just execute the following two command and navigate to http://localhost:5000/inbox.

$ pip install flask toml
$ ./run.py

The password for the alice directory is movie_evening!.

Installation

Call the following command in the repository to install the module:

$ pip install .

A WSGI server like Gunicorn can then be used to serve the app for example like this:

$ gunicorn "raincloud:create_app(base_path='public', secret_key='i_am_a_key')"

Note that currently only one worker is supported due to server side session caching.

NixOS

This repository is also a Nix Flake which provides a NixOS module. A minimal running instance can be setup for example like this:

  raincloud.nixosModule {
    services.raincloud = {
      enable = true;
      basePath = "/var/lib/raincloud";
      secretKey = "i_am_a_key";
    };
  }

All configuration options are:

Option Description Type Default value Example
address Bind address of the server str 127.0.0.1 0.0.0.0
port Port on which the server listens int 8000 5000
user User under which the server runs str raincloud alice
group Group under which the server runs str raincloud users
cloudName Name of the raincloud str raincloud bobsCloud
basePath Base path of the raincloud str /var/lib/raincloud
secretKey Flask secret key str i_am_a_key

Configuration

raincloud provides three configuration options which can be passed to raincloud.create_app():

base_path
Base path of the raincloud
secret_key
Flask secret key
cloud_name
Cloud name (default: raincloud)

Set them for example like this:

>>> app = raincloud.create_app(base_path='/home/alice/public', secret_key='super_secret', cloud_name='myCloud')

rc.toml

A rc.toml file can contain three configuration parameters. Here is a default file which can be used as template:

  # Create a password hash with 'mkpasswd -m sha-256' or 'mkpasswd -m sha512' and paste it here.
  # If the following line is uncommented and a hash is set, the directory is password protected.
  #
  # hashed_password = ""

  # Set this to 'true' to allow file downloads from this directory
  download = false

  # Set this to 'true' to allow uploads to this directory
  upload = false

Troubleshooting

The filesize which can be uploaded may be limited by your web server. When using Nginx for example, the following configuration parameter can be used to increase the upload files size:

client_max_body_size 100M;

Are you getting internal server errors? Check the directory permissions. The user which runs raincloud must have at least read permissions to allow downloads and execute permissions to allow uploads.