Add Nextcloud data directory migration workflow

Co-Authored-By: Oz <oz-agent@warp.dev>
This commit is contained in:
Raghav
2026-04-17 09:28:30 +05:30
parent d1245fac70
commit a51dcf6115
3 changed files with 194 additions and 0 deletions

View File

@ -31,6 +31,29 @@ cp .env.example .env
```bash
./scripts/test.sh
```
## Move Nextcloud data directory to external storage
Use the migration helper to move existing data to a host path and switch the app to a bind mount.
Default target:
- `/media/rbhat/DATA/nextcloud/NextCloudData`
Run migration:
```bash
./scripts/migrate-data-directory.sh /media/rbhat/DATA/nextcloud/NextCloudData
```
What the script does:
- enables maintenance mode
- copies current `/var/www/html/data` content to target directory
- applies owner/group and permissions for Nextcloud (`www-data`)
- updates `docker-compose.yml` app volume with `...:/var/www/html/data`
- recreates `app` and `web` services
- disables maintenance mode and verifies mount
Rollback (if needed):
1. Remove the `:/var/www/html/data` bind mount line from `app` volumes in `docker-compose.yml`.
2. `docker compose up -d app web`
3. Confirm status:
```bash
docker exec --user www-data nextcloud-app php occ status
```
## Production TLS (Let's Encrypt + Cloudflare DNS-01)
1. Export credentials in shell:
```bash