Nextcloud + PostgreSQL + Redis
Nextcloud is a self-hosted storage and collaboration platform: synced files across devices, calendars, contacts, collaborative document editing, and video calls.
This Stack installs it with PostgreSQL and Redis, which Nextcloud uses for file locking and caching.
Services included
Besides the application, the Stack brings up PostgreSQL, Redis, an nginx that accepts traffic on port 80, an automatic backups service, and the web file manager.
Project structure
.
├── backup
│ └── backup-runner.sh
├── health
│ └── status.php
├── nginx
│ └── default.conf
├── .env.example
└── compose.yaml
Getting started
Install the Stack and start it:
docker-deploy-stack --stack php/nextcloud-postgres-redis
cd /root/stack/php/nextcloud-postgres-redis
docker compose up -d
This is a ready-to-use application: you don’t need to upload any code. Themes, plugins, extensions and files you upload from its admin panel are stored in the Stack and are included in automatic backups.
Configuration
Editable values are in the Stack’s .env file:
| Variable | Default | What it’s for |
|---|---|---|
APP_PORT |
80 |
Public port of the Stack. |
APP_ENV |
development |
Application environment. |
DB_NAME |
nextcloud |
Database name. |
DB_USER |
nextcloud |
Database user. |
BACKUP_ENABLED |
1 |
Automatic backups: 1 enabled, 0 disabled. |
BACKUP_INTERVAL_SECONDS |
86400 |
How many seconds between backups. |
BACKUP_RETENTION_DAYS |
7 |
How many days backups are retained. |
NEXTCLOUD_VERSION |
apache |
Version of the corresponding image. |
POSTGRES_VERSION |
16-alpine |
Version of the corresponding image. |
REDIS_VERSION |
7-alpine |
Version of the corresponding image. |
After changing it, apply the changes with docker compose up -d.
Useful commands
docker compose ps # see the containers that are running
docker compose logs -f # view live logs
docker compose restart # restart the services
docker compose down # stop and remove the containers