Deploy Dufs
File server that supports static serving, uploading, searching & more!
Dufs
sigoden/dufs
Just deployed
/data
Deploy and Host Dufs on Railway
Dufs is a distinctive utility file server that supports static serving, uploading, searching, accessing control, webdav...
About Hosting Dufs
Hosting Dufs on Railway involves deploying its official Docker image as a service. Since Dufs is a self-contained binary, it's incredibly lightweight and perfect for containerization. The process requires setting up a persistent volume on Railway to ensure your files are not lost when the service restarts. You'll configure Dufs using a start command, where you can specify permissions (like allowing uploads and deletes), set user authentication, and define the directory to be served from the persistent volume. Railway handles the networking, providing you with a public URL to access your file server instantly.
Common Use Cases
- Personal Cloud Storage: Create a private, self-hosted cloud drive by enabling WebDAV, allowing you to mount your storage on your computer or mobile device.
- Quick File Sharing: Easily share files, folders, or archives with friends, family, or colleagues without relying on third-party services.
- Simple Static Site Hosting: Host a simple static website, portfolio, or a single-page application (SPA) directly from a folder with its built-in rendering options.
Dependencies for Dufs Hosting
- Docker: Dufs is deployed as a container, making Docker a core dependency for the build and deployment process on Railway.
- A Railway Volume: To store files persistently, you need to attach a volume to the Dufs service.
Deployment Dependencies
- Dufs GitHub Repository
- Dufs on Docker Hub
- Railway Docs: Volumes
- Railway Docs: Deploying from a Dockerfile
Implementation Details
To deploy Dufs, you can use the official Docker image or create a Dockerfile
in your repository. Railway will automatically detect and build it.
1. Create a Dockerfile
This Dockerfile
uses a multi-stage build to create a small, optimized image.
# Dockerfile
FROM rust:1-alpine AS builder
WORKDIR /usr/src/dufs
RUN apk add --no-cache musl-dev
RUN cargo install dufs --locked
RUN strip /usr/local/cargo/bin/dufs
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /usr/local/cargo/bin/dufs /usr/local/bin/
# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
# Default port
EXPOSE 5000
# Default command (can be overridden in Railway)
CMD ["/data"]
2. Configure the Start Command on Railway
In your service settings on Railway, set the Start Command. This command tells Dufs which directory to serve (your volume, typically mounted at /data
) and what permissions to enable.
- To allow all operations (upload, delete, search):
dufs /data -A
- To set up a user with a password and full permissions:
> Note: It is highly recommended to set authentication for any publicly accessible file server. You can also use environment variables likedufs /data -A -a "your_username:your_password@/:rw"
DUFS_AUTH
to manage credentials securely.
Why Deploy Dufs on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Dufs on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Dufs
sigoden/dufs