droppy is a self-hosted file storage server with a web interface and capabilities to edit files and view media directly in the browser. It is particularly well-suited to be run on low-end hardware like the Raspberry Pi.
Two directories will be used. droppy is a well-behaved app and will not write anywhere else:
config: defaults to
~/.droppy/config, override with
droppy maintains a in-memory representation of the
files directory. If you're on slow storage and/or serving 100k+ files, the indexing on startup will take some time.
Node.js >= 4.0.0 installed, run:
$ sudo npm install -g droppy$ droppy start -c /srv/droppy/config -f /srv/droppy/files
To update, run
$ sudo npm update -g droppy
To pull the image and start the container:
$ docker run --name droppy -p 127.0.0.1:8989:8989 silverwind/droppy
This method uses automatic volumes for
/files which can be overridden through
-v /srv/droppy/config:/config and
-v /srv/droppy/files:/files. If you're using existing files, it's advisable to use
-e UID=1000 -e GID=1000 to get new files written with correct ownership.
To update a docker installation, run
$ docker pull silverwind/droppy$ docker stop droppy && docker rm droppy$ docker run --name droppy -p 127.0.0.1:8989:8989 silverwind/droppy
Alternatively, you can use the example
$ curl -O https://raw.githubusercontent.com/silverwind/droppy/master/examples/docker-compose.yml$ docker-compose up
docker-compose.yml uses the subdirectories
files of the current working directory for storing data.
By default, the server listens on all IPv4 and IPv6 interfaces on port 8989. On first startup, a prompt to create login data for the first account will appear. Once it's created, login credentials are enforced. Additional accounts can be created in the options interface or the command line. Configuration is done in
config/config.json, which is created with these defaults:
"listeners" :"host": "0.0.0.0" "::""port": 8989"protocol": "http""public": false"timestamps": true"linkLength": 5"logLevel": 2"maxFileSize": 0"updateInterval": 1000"pollingInterval": 0"keepAlive": 20000"allowFrame": false"readOnly": false"ignorePatterns":"watch": true
listenersArray - Defines on which network interfaces, port and protocols the server will listen. See listener options below.
listenershas no effect when droppy is used as a module. The default listens on HTTP port 8989 on all interfaces and protocols.
publicboolean - When enabled, no user authentication is performed. Default:
timestampsboolean - When enabled, adds timestamps to log output. Default:
linkLengthnumber - The amount of characters in a shared link. Default:
logLevelnumber - Logging amount.
0is no logging,
2is info (HTTP requests),
3is debug (Websocket communication). Default:
maxFileSizenumber - The maximum file size in bytes a user can upload in a single file.
updateIntervalnumber - Interval in milliseconds in which a single client can receive update messages through changes in the file system. Default:
pollingIntervalnumber - Interval in milliseconds in which the file system is polled for changes, which is likely necessary for files on external or network-mapped drives. This is CPU-intensive! Corresponds to chokidar's usePolling option.
0disables polling. Default:
keepAlivenumber - Interval in milliseconds in which the server sends keepalive message over the websocket, which may be necessary with proxies.
0disables keepalive messages. . Default:
allowFrameboolean - Allow the page to be loaded into a
readOnlyboolean - All served files will be treated as being read-only. Default:
compressionboolean - Whether to serve brotli/gzip compressed static content. Default:
true. Note that compression incurs no performance penalty because pre-compressed artifacts are included in the distribution. Default:
devboolean - Enable developer mode, skipping resource minification and enabling live reload. Default:
ignorePatternsArray - Array of file name glob patterns to ignore when indexing files. Default:
watchboolean - Whether to watch the local file system for changes. Can improve performance when dealing with a large number of files. If
watchis set to
false, file system changed not done through droppy won't be detected. Default:
listeners defines on which network interfaces, ports and protocol(s) the server will listen. For example:
"listeners":"host": "0.0.0.0" "::""socket": "/tmp/droppy""port": 80"protocol": "http""host": "0.0.0.0""port": 443"protocol": "https""key": "~/certs/example.com.key""cert": "~/certs/example.com.crt""dhparam": "~/certs/example.com.dh""hsts": 31536000
The above configuration will result in:
A listener object accepts these options:
hoststring/Array - Network interface(s) to listen on. Required when
portnumber/string/Array - Network port(s) to listen on. Required when
socketstring/Array - Unix domain socket(s) to listen on.
protocolstring - Protocol to use,
For TLS the following additional options are available. Paths can be given relative to the configuration directory and
~ is resolved as expected.
certstring - Path to PEM-encoded TLS certificate file, which can include additional intermediate certificates concatenated after the main certificate. Required.
keystring - Path to PEM-encoded TLS private key file. Required.
dhparamstring - Path to PEM-encoded TLS Diffie-Hellman parameters file. If not provided, new 2048 bit parameters will generated on launch and saved for future use.
passphrasestring - Passphrase for the TLS private key in case it is encrypted.
hstsnumber - Length of the HSTS header in seconds. Set to
0to disable HSTS.
droppy can be used with frameworks like express:
var app = ;var droppy =configdir: "~/droppy/config"filesdir: "~/droppy/files"log: "~/droppy/log"logLevel: 0;app;app;
See the express example for a working example.
optionsObject: Options. Extends config.json. In addition to above listed options,
logare present on the API.
function onRequest(req, res). All arguments are optional.
To download shared links with
wget to the correct filename:
$ curl -OJ url$ wget --content-disposition url
To start a live-reloading dev server:
$ git clone https://github.com/silverwind/droppy && cd droppy$ npm i$ node droppy start --dev
The Makefile has a few tasks for updating dependencies, pushing docker images, see the comment above for dependencies of those tasks.
© silverwind, distributed under BSD licence.