Self-hosted file storage server with a convenient web interface
droppy is a self-hosted file storage server with an interface similar to desktop file managers and has capabilites to edit files as well as view media directly in the browser. It focuses on performance and intuitive usage. It can run both standalone or through express. To provide realtime updates, most communication is done through WebSockets. A demo is available here.
npm installed, run:
$ [sudo] npm install -g droppy$ droppy start
If you're running Docker, use the official (work in progress) image:
$ docker pull silverwind/droppy$ docker run -p 8989:8989 -v $HOSTDIR:/droppy-data silverwind/droppy
$HOSTDIR with a directory on the docker host where configuration and files can be stored for persistence outside the container. This isn't strictly necessary, but it enables one to update by simply pulling a new image.
To install to a local directory:
$ git clone$ cd droppy$ npm install$ node droppy.js start
To store configuration and files, these two directories will be used:
~/.droppy: configuration directory. Override with
~/.droppy/files: files directory. Override with
By default, the server listens on all interfaces, port 8989. On first login, a prompt for username and password for the first account will appear. Additional accounts can be created in the options interface or the command line.
droppy config to edit
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
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.
publicBoolean - When enabled, no authentication is performed.
timestampsBoolean - When enabled, adds timestamps to log output.
linkLengthNumber - The amount of characters in a share link.
logLevelNumber - Logging amount.
0is no logging,
2is info (HTTP requests),
3is debug (Websocket communication).
maxFileSizeNumber - The maximum file size in bytes a user can upload in a single file.
updateIntervalNumber - Interval in milliseconds which a single client can receive update messages through changes in the file system.
pollingIntervalNumber - Interval in milliseconds which the file system is polled for changes, which may be necessary on network drives and other non-standard situations. This is CPU-intensive! Corresponds to chokidar's usePolling option. Set to
0to disable polling.
keepAliveNumber - Interval in milliseconds in which the server sends keepalive message over the websocket. These messages add some overhead but may be needed with proxies are involved. Set to
0to disable keepalive messages.
listeners defines on which interfaces, ports and protcol(s) the server will listen. For example:
"listeners":"host" : "0.0.0.0" "::""port" : 80"protocol" : "http""host" : "0.0.0.0""port" : 443"protocol" : "https""key" : "~/certs/tls.key""cert" : "~/certs/tls.crt""ca" : "~/certs/tls.ca""dhparam" : "~/certs/tls.dhparam""hsts" : 31536000
The above configuration will result in:
A listener object accepts these options:
hostString/Array - Network interface(s) to listen on. Required.
portNumber/Array - Network port(s) to listen on. Required.
protocolString - Protocol to use,
For SSL/TLS these additional options are available:
keyString - Path to PEM-encoded SSL/TLS private key file. Required.
certString - Path to PEM-encoded SSL/TLS certificate file. Required.
caString - Path to PEM-encoded SSL/TLS intermediate certificate file.
dhparamString - Path to PEM-encoded SSL/TLS Diffie-Hellman parameters file. If not provided, new 2048 bit parameters will generated and saved for future use.
hstsNumber - Length of the HSTS header in seconds. Set to
0to disable HSTS.
Note: Unless given absolute, SSL/TLS paths are relative to the config folder. If your certificate file includes an concatenated intermediate certificate, it will be detected and used, there's no need to specify
ca in this case.
droppy can be used with express like this:
var app = require"express";var droppy = require"droppy"configdir: "~/droppy/config"filesdir: "~/droppy/files"log: "~/droppy/log"logLevel: 0;appuse"/" droppylistenprocessenvPORT || 8989;
See the commented express example for a working example.
logare present on the API.
function onRequest(req, res). All arguments are optional.
For correct filenames of shared links, use
--content-disposition or add this to
content-disposition = on
droppy is currently optimized for a moderate amount of files. To aid in performance, all directories are read into memory once on startup. The downside of this is that the startup will take considerable time on slow storage with hunderts of thousands of files present.
© silverwind, distributed under BSD licence.