A simple barebones file sharing app to deploy with docker-compose, kubernetes, or simply docker run.
Created this simple file uploader to solve a problem I was having with free to use uploaders available on the internet for sharing a file with my friends and family over the internet. I looked for other open-source solutions and they didn't particularly scratch the right itch for me. I hope if someone else is looking for a simple (barebones) file share application to self-host, they can relax knowing that this exists and can be used simply with docker-compose on their machines/home servers.
Option | Description | Default | Required |
---|---|---|---|
API_PORT |
Defines the port for the backend service to listen on. | 5000 |
Y |
DEFAULT_DIR |
Default location to store client uploaded files on the system | /media/files |
Y |
MAX_FILES |
Maximum number of files that can be uploaded in a single request | 6 |
N |
MAX_SIZE_MB |
Maximum file size for any file being uploaded to the storage solution (note: future editions of this software will include cloud blob storage as an option) | 2048 (in MB) |
N |
CLEAN_ENABLED |
Whether or not to empty the upload directory on an interval. (use this if you plan on only storing files temporarily for short periods or if you have limited space) | false |
N |
CLEAN_DIR_INTERVAL |
iff CLEAN_ENABLED is enabled , then you can specify a number of days between each directory cleaning. |
7 |
N |
Most of the setup is pretty standard. Please read through this document first, however, if you experience any issues with your setup.
To use this app with docker-compose, simply update the FILES_ENDPOINT
variable in client/src/config/index.js
to include your server domain name.
This is required since we are using a client rendered site.
// Example client/src/config/index.js
export const FILES_ENDPOINT = 'http://<your-domain-name>/api/files'
Once you have updated that file, run the compose like so.
docker-compose -f docker-compose.dev.yml up -d
Modify settings (on server
service in docker-compose.yml
) using environment variables (see available options above)
After your modifications, run the docker-compose.yml
file inside of the project directory.
docker-compose up -d
If you want to run with docker, you will need to start pull both the client and server images and run them on the same network.
First create a network to use
docker network create <network_name>
Run the client container
docker run -d \
--name=uploader-client \
--restart=unless-stopped \
-p 8080:8080 \
--rm \
--network <network_name> sykeben/file-uploader-client:1.x
Note: Client port cannot be changed from 8080, but you can specify a different port mapping if you wish.
Run the server
docker run -d \
--name=uploader-api \
--restart=unless-stopped \
-p 5000:5000 \
--rm \
--network <network_name> \
-e DEFAULT_DIR=/files \
-e MAX_SIZE_MB=256 \
-e CLEAN_ENABLED=true \
-v <path/to/files>:/files \
sykeben/file-uploader-api:1.x
Note: Specify a volume mount that has rw on your host machine
That's it. If you experience any issues, please feel free to open an issue on GitHub and I will try my best to fix it.