
Deploy Seafile | (Just Updated) Self-Hosted File Sync and Share Server, Dropbox Alternative, Admin Login Generated
Seafile file sync and share server, Dropbox alternative, admin generated
Just deployed
/shared
redis
Just deployed
/data
mariadb
Just deployed
/var/lib/mysql
Deploy and Host Seafile on Railway
Built for an LLM agent to deploy and use. The deploy form has no fields to fill: the administrator account is created at first boot with a generated password, nobody can register an account, and the libraries, the database and the cache live on volumes. Seafile is a self-hosted file sync and share server with libraries, desktop and mobile sync clients, a web interface and a REST API, a self-hosted alternative to Dropbox and Google Drive.
About Hosting Seafile
This template runs three services: seafile (the upstream Seafile Community Edition 14.0.9 image, pinned by digest, through a thin wrapper, with a volume at /shared that holds the libraries, the configuration and the logs), mariadb (MariaDB 10.11 with a volume, three databases created by Seafile at the first boot) and redis (Redis 8 as the cache, with a volume). One public domain on the seafile service serves the web interface, the sync protocol and the REST API at /api2/. The server listens on Railway's injected PORT, and the healthcheck is GET /api2/ping/.
What the wrapper fixes. Upstream's container serves nginx on a hard-coded port 80, and its start script waits for that exact port before it starts the web application, so on Railway's injected PORT the stack never reports ready. The wrapper moves nginx and the readiness check to PORT on every boot, refuses to start if the administrator email or a password of at least 8 characters is missing, has upstream create that administrator from the variables on the first boot, and bakes every constant setting (database names and user, cache provider, protocol, port) into the image so the deploy form holds only generated secrets. Read from the upstream image's /scripts/utils.py (wait_for_nginx() looks for :80 in netstat); not reproduced on a Railway control of the unwrapped image.
Using it. Open the domain and sign in with the email INIT_SEAFILE_ADMIN_EMAIL (admin@ plus the public domain) and the password INIT_SEAFILE_ADMIN_PASSWORD, both on the seafile service. Create a library, upload files in the browser, or point the Seafile desktop and mobile clients at https:// plus the domain. Registration is closed: only the administrator creates accounts. The login is created on the first boot only; change the password in the web interface afterwards, and redeploys keep the same account and libraries. The stack needs about 700 MiB of memory at idle.
Agent contract
- Public URL:
https://RAILWAY_PUBLIC_DOMAIN(the generated domain of theseafileservice) - Private URL:
http://seafile.railway.internal:8080 - Credentials: the variables
INIT_SEAFILE_ADMIN_EMAILandINIT_SEAFILE_ADMIN_PASSWORDon theseafileservice are the login of the administrator - Auth:
POST /api2/auth-token/with the form fieldsusername(the email) andpasswordreturns a JSONtoken; send it as the headerAuthorization: Tokenfollowed by the token on every/api2/call. Without the token a write answers 403 or 401. Public sign-up is closed:/accounts/register/does not exist. - Health:
GET /api2/ping/returns 200 without credentials
#!/bin/sh
# needs: RAILWAY_PUBLIC_DOMAIN, INIT_SEAFILE_ADMIN_EMAIL, INIT_SEAFILE_ADMIN_PASSWORD (variables of the seafile service); also curl, sed, grep.
R="https://$RAILWAY_PUBLIC_DOMAIN"
STAMP=$(date +%s)
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/api2/ping/")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/api2/ping/"
# public sign-up is closed: the registration page does not exist
curl -s -o /dev/null -w "public signup: %{http_code}\n" "$R/accounts/register/"
# a stranger cannot write: creating a library without a token or with a wrong one is refused
curl -s -X POST -d "name=stranger$STAMP" "$R/api2/repos/" -o /dev/null -w "write without key: %{http_code}\n"
curl -s -X POST -H "Authorization: Token not-a-token" -d "name=stranger$STAMP" "$R/api2/repos/" -o /dev/null -w "write with wrong key: %{http_code}\n"
# a wrong password is refused, the generated one returns an API token
curl -s -X POST --data-urlencode "username=$INIT_SEAFILE_ADMIN_EMAIL" --data-urlencode "password=wrong$STAMP$STAMP" "$R/api2/auth-token/" -o /dev/null -w "login with wrong password: %{http_code}\n"
TOKEN=$(curl -s -X POST --data-urlencode "username=$INIT_SEAFILE_ADMIN_EMAIL" --data-urlencode "password=$INIT_SEAFILE_ADMIN_PASSWORD" "$R/api2/auth-token/" | sed -n 's/.*"token": *"\([^"]*\)".*/\1/p')
if [ -n "$TOKEN" ]; then echo "login with key: ok"; else echo "login with key: FAILED"; fi
# with the token a library is created, a file is uploaded to it and listed back
CREATED=$(curl -s -X POST -H "Authorization: Token $TOKEN" -d "name=agent$STAMP" "$R/api2/repos/" -w "\nwrite with key: %{http_code}\n")
echo "$CREATED" | grep "write with key"
REPO=$(echo "$CREATED" | sed -n 's/.*"repo_id": *"\([^"]*\)".*/\1/p' | head -n 1)
LINK=$(curl -s -H "Authorization: Token $TOKEN" "$R/api2/repos/$REPO/upload-link/?p=/" | tr -d '"')
echo "hello from an agent" | curl -s -H "Authorization: Token $TOKEN" -F "file=@-;filename=agent-$STAMP.txt" -F parent_dir=/ "$LINK?ret-json=1" -o /dev/null -w "upload: %{http_code}\n"
if curl -s -H "Authorization: Token $TOKEN" "$R/api2/repos/$REPO/dir/?p=/" | grep -q "agent-$STAMP.txt"; then echo "file listed: found"; else echo "file listed: MISSING"; fi
Expected output against a fresh deploy (measured on a Railway deploy of the generated draft):
health: 200
public signup: 404
write without key: 403
write with wrong key: 401
login with wrong password: 400
login with key: ok
write with key: 200
upload: 200
file listed: found
The refusals are the contract: write without key: 403 and write with wrong key: 401 on the library create, public signup: 404 on the registration page, and login with wrong password: 400.
Why Deploy Seafile 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 Seafile 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.
- Agent-ready - no deployer fields, a contract block, and one script that proves the server is healthy, a stranger can neither write nor register, and the generated password signs in, creates a library and stores a file.
- Owned by you from the first request - the administrator is created before the first request and registration does not exist, so nobody else can claim the instance.
- Works on first deploy - nginx and the readiness check already follow Railway's injected
PORT. - Data survives redeploys - the libraries, the databases and the cache live on volumes.
- Pinned - the upstream, MariaDB and Redis images are pinned by digest and the wrapper by tag and digest.
Common Use Cases
- Private file sync and share - libraries synced to desktop and mobile clients, share links with passwords and expiry.
- Team file storage - groups, library permissions and a web interface for a small team.
- Self-hosted alternative to Dropbox and Google Drive - your files on your own volume, with file versioning and a REST API for automation.
Dependencies for Seafile Hosting
- The seafile, mariadb and redis services with their volumes, created by the template.
Deployment Dependencies
Template Content
