Deploy Nextcloud
Self-hosted file sync, sharing and collaboration with Postgres and Redis
Just deployed
/var/lib/postgresql/data
Redis
Just deployed
/data
Nextcloud
Just deployed
/var/www/html
Deploy and Host Nextcloud on Railway
Nextcloud is an open-source platform for file sync and sharing, calendars, contacts and team collaboration that you run on your own server. Desktop and mobile clients keep files in sync, a web interface handles sharing and editing, and hundreds of apps add features such as notes, tasks and video calls.
About Hosting Nextcloud
Hosting Nextcloud means running a PHP web application, a database, a cache and a scheduler, and keeping all of them configured to work together. You need persistent storage for user files, configuration and installed apps, HTTPS with the right trusted domains and proxy settings, file locking through Redis, and background jobs every few minutes. Upgrades must move one major version at a time, and the database needs occasional index updates. This template does that wiring for you: Nextcloud installs itself on the first start with a generated admin password, sets the Railway domain, runs background jobs by cron and applies upgrades when the image is updated.
Common Use Cases
- Private file storage and sync across desktop and phone, as an alternative to Google Drive, Dropbox or OneDrive
- Sharing files and folders with family, clients or a team through links with passwords and expiry dates
- Shared calendars, contacts and tasks through CalDAV and CardDAV, plus collaboration apps from the Nextcloud app store
Dependencies for Nextcloud Hosting
- PostgreSQL (Railway's Postgres service) for metadata, users and shares
- Redis (Railway's Redis service) for file locking, caching and sessions
Deployment Dependencies
- Nextcloud server: https://github.com/nextcloud/server
- Official Docker image: https://hub.docker.com/_/nextcloud
- Template source and changelog: https://github.com/aalfath/nextcloud-railway-template
- Admin manual: https://docs.nextcloud.com/server/latest/admin_manual/
Implementation Details
- Version: Nextcloud 35.0.3 (official
nextcloud:35.0.3-apacheimage, pinned by digest). Updates come as changes to the template repo, and Railway offers them to you as an update you can apply. - Log in with the user
adminand the password in theNEXTCLOUD_ADMIN_PASSWORDvariable of the Nextcloud service. Change the password in Nextcloud afterwards: the variable is only used on the first start. - All data (files, config, apps) lives on the volume mounted at
/var/www/html. Back up that volume and the Postgres database before a major upgrade. - Own domain: add it in Railway's networking settings, then set
NEXTCLOUD_TRUSTED_DOMAINSon the Nextcloud service to a space-separated list such ascloud.YOUR-DOMAIN nextcloud-xxxx.up.railway.app, andOVERWRITECLIURLtohttps://cloud.YOUR-DOMAIN. - Email is optional: set it in Nextcloud under Administration settings, Basic settings, or with the image's
SMTP_*variables. - Health check:
/healthzanswers only when Nextcloud is installed, not in maintenance mode, and the database responds.
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
Redis
redis:8.2Nextcloud
aalfath/nextcloud-railway-template