Self-hosted file storage server
droppy is a self-hosted file storage server with a web interface and capabilites 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.
Note that two directories will be used by droppy:
configdirectory: set with
-c <dir>, default
filesdirectory: set with
-f <dir>, default
Make sure these directories exist and owned by the user running the application/container.
Node.js >= 4.0 and
npm installed, run:
# Install latest version and dependencies.$ [sudo] npm install -g droppy# Start with `/srv/droppy/config` for config and `/srv/droppy/files` for files.$ droppy start -c /srv/droppy/config -f /srv/droppy/files# Open
# Pull and start the container, forwarding port 8989 to localhost:8989$ docker run --name droppy -p 127.0.0.1:8989:8989 silverwind/droppy# Open
The image provides automatic volumes for the two mount points /config and /files which can be overridden through
-v /srv/droppy/config:/config and
-v /srv/droppy/files:/files respectively. If you're using existing files, it's adviceable to use the UID and GID container environment variables to get files written with correct ownership, e.g
-e UID=1000 and
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
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 user authentication is performed.
timestampsBoolean - When enabled, adds timestamps to log output.
linkLengthNumber - The amount of characters in a shared 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 in which a single client can receive update messages through changes in the file system.
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.
keepAliveNumber - Interval in milliseconds in which the server sends keepalive message over the websocket, which may be necessary with proxies.
0disables keepalive messages.
allowFrameBoolean - Allow the page to be loaded into a
devBoolean - Enable developer mode, skipping resource minification and enabling live reload.
listeners defines on which network interfaces, ports and protocol(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 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.
logare present on the API.
function onRequest(req, res). All arguments are optional.
$ [sudo] npm install -g droppy
$ docker pull silverwind/droppy$ docker stop droppy$ docker rm droppy$ docker run --name droppy -p 8989:8989 -v /srv/droppy/config:/config -v /srv/droppy/files:/files silverwind/droppy
droppy is currently optimized for a moderate amount of files. To aid in performance, all directories are indexed into memory once on startup. The downside of this is that the startup will take considerable time on slow storage with hundreds of thousands of files present.
For correct download filenames of shared links, use
--content-disposition or add this to
content-disposition = on
© silverwind, distributed under BSD licence.