2023-12-08 22:25:59 -07:00
|
|
|
# crazy-file-server
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-13 20:09:02 -07:00
|
|
|
*A heavy-duty web file browser for cRaZy files.*
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-08 22:25:59 -07:00
|
|
|
The whole schtick of this program is that it caches the directory and file structures so that the server doesn't have to
|
|
|
|
re-read the disk on every request. By doing the processing upfront when the server starts along with some background
|
|
|
|
scans to keep the cache fresh we can keep requests snappy and responsive.
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-08 22:25:59 -07:00
|
|
|
I needed to serve a very large dataset full of small files publicly over the internet in an easy to browse website. The
|
|
|
|
existing solutions were subpar and I found myself having to create confusing Openresty scripts and complex CDN caching
|
|
|
|
to keep things responsive and server load low. I gave up and decided to create my own solution.
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-08 22:25:59 -07:00
|
|
|
You will likely need to store your data on an SSD for this. With an SSD, my server was able to crawl over 6 million
|
|
|
|
files stored in a very complicated directory tree in just 5 minutes.
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-08 22:25:59 -07:00
|
|
|
## Features
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-11 15:29:34 -07:00
|
|
|
- Automated cache management. Fill the cache when the starts, or as requests come in.
|
2023-12-11 22:36:41 -07:00
|
|
|
- Front end agnostic design.
|
|
|
|
- Elasticsearch integration.
|
2023-07-17 23:20:21 -06:00
|
|
|
- File browsing API.
|
|
|
|
- Download API.
|
2023-12-11 22:36:41 -07:00
|
|
|
- Admin API.
|
2023-07-17 23:20:21 -06:00
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
1. Install Go.
|
2023-12-11 15:29:34 -07:00
|
|
|
2. Download the binary or do `cd src && go mod tidy && go build`
|
2023-07-17 23:20:21 -06:00
|
|
|
|
|
|
|
## Use
|
|
|
|
|
|
|
|
1. Edit `config.yml`. It's well commented.
|
|
|
|
2. `./crazyfs --config /path/to/config.yml`. You can use `-d` for debug mode to see what it's doing.
|
|
|
|
|
|
|
|
By default, it looks for your config in the same directory as the executable: `./config.yml` or `./config.yaml`.
|
|
|
|
|
2023-12-11 22:36:41 -07:00
|
|
|
If you're using initial cache and have tons of files to scan you'll need at least 5GB of RAM and will have to wait 5 or
|
2023-12-11 15:29:34 -07:00
|
|
|
so minutes for it to traverse the directory structure. CrazyFS is heavily threaded, so you'll want at least an 8-core
|
2023-12-08 22:25:59 -07:00
|
|
|
machine.
|
2023-07-17 23:20:21 -06:00
|
|
|
|
2023-12-11 22:36:41 -07:00
|
|
|
You'll need something line Nginx if you want SSL or HTTP. Also, CrazyFS works great with an HTTP cache in front of it.
|