Deploy Nextcloud | (Just Updated) Google Drive Alternative Whose Background Jobs Actually Run
Google Drive alternative whose background jobs and login throttle work
nextcloud
Just deployed
/var/www/html
postgres
Just deployed
/var/lib/postgresql
redis
Just deployed
Deploy and Host Nextcloud on Railway
Nextcloud is a self-hosted file sync and collaboration platform — a private alternative to Google Drive, Dropbox and Microsoft 365. Files sync to desktop and mobile clients over WebDAV, and the same instance carries calendars, contacts, shared links, Nextcloud Talk and 300+ apps from its own app store.
This deployment runs Nextcloud 34.0.2 on a volume with Postgres and Redis, and it fixes the three things that decide whether a Nextcloud on a redeploying platform behaves: the background job runner, the client IP behind the edge proxy, and the admin account.
About Hosting Nextcloud
Hosting Nextcloud means running a PHP application that keeps user data on disk, a database for metadata, and a scheduler for the work that happens when nobody is looking. On Railway three details matter more than they do on a VPS:
- Background jobs. A fresh install runs them in
ajaxmode — one job per page load. An instance driven by sync clients and WebDAV loads no pages, so trash and version expiry, share expiry, preview generation, activity mail and app updates never run. This deployment switches tocronmode and runscron.phpinside the app container every five minutes, so no second always-on service is billed for it. - The client address. The container's peer is always the platform edge, so Nextcloud's
brute-force protection collapses onto a single bucket. Measured on the stock image: eight failed
logins from eight different clients recorded 0 attempts against each client and 8 against
the proxy, with a 25-second delay applied to that one shared bucket — i.e. one attacker slows the
login page for everybody and is never singled out. Here the client address is recovered from the
first
X-Forwarded-Forhop, and the same probe records one attempt per client and none against the proxy. - The admin account. It is created here from a generated secret before the URL serves a request, and re-applied on every boot, so rotating it is a redeploy rather than a support ticket.
The image is pinned to 34.0.2. Nextcloud only upgrades one major at a time and refuses to start when the data directory is more than one major behind — on a tag that floats, a redeploy is an unrequested upgrade and a long-idle instance is a container that will not boot.
Common Use Cases
- Private cloud storage and file sharing for a person or a small team, synced to desktop and phone
- Photo and video backup from mobile devices, with albums, tagging and shared links
- Calendars, contacts and tasks over CalDAV/CardDAV, kept off third-party servers
- A data-sovereignty-compliant document store for teams that cannot use US-hosted SaaS
Dependencies for Nextcloud Hosting
- Nextcloud 34.0.2 (Apache + PHP 8.5) —
ghcr.io/bon5co/nextcloud-railway:34.0.2, a thin wrapper on the officialnextcloud:34.0.2-apache - PostgreSQL 17 — users, file metadata, shares and app configuration
- Redis 7 — distributed cache and transactional file locking
Deployment Dependencies
Implementation Details
Volumes: /var/www/html on the app (config, apps and user data under data/) and
/var/lib/postgresql on the database. Both are required — Nextcloud keeps uploaded files on disk,
not in the database.
The deploy form asks for nothing. NEXTCLOUD_ADMIN_PASSWORD is generated per deploy, the database
credentials are wired between services, and NEXTCLOUD_TRUSTED_DOMAINS, overwritehost,
overwriteprotocol and overwrite.cli.url are derived from the Railway domain so share links and
client setup payloads are https:// and correct.
Sizing follows the plan: PHP's memory_limit and OPcache, and Apache's MaxRequestWorkers, are
computed from the container's cgroup limits instead of the image's fixed 512M / 150 workers.
First boot installs the schema and the bundled apps and takes a few minutes; there is deliberately no HTTP healthcheck so that install cannot be killed halfway.
Why Deploy Nextcloud 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 Nextcloud 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