# Self-Hosted Nextcloud & Scheduled Backups

Public HTML: [Read in the portfolio](/work/nextcloud-backups/)

Category: homelab

Role: Independent infrastructure project

A private Nextcloud service used daily for scheduled microSD backups to external USB storage.

**Individual contribution summary:** Deployed and maintained the containerized Nextcloud stack, configured scheduled transfers, and troubleshot server stability, storage, and network issues.

Technologies: Debian · Docker Compose · Nextcloud · PHP-FPM · MariaDB · Redis · Caddy · Cloudflare Tunnel · WebDAV · Round Sync

## Overview

I maintain a private Nextcloud service that I use daily to back up files from my microSD card. A script triggers Round Sync at 1 a.m. to check for new file versions and transfer updates through Nextcloud WebDAV to external USB storage.

The application runs on an HP Pavilion using Debian, with an internal NVMe SSD for application execution and an external Western Digital NTFS drive for bulk storage. The external drive remains connected continuously.

## My Contribution

I deployed and maintain the Docker Compose stack, including Nextcloud with PHP-FPM, MariaDB, Redis, Caddy, and cloudflared. I configured host-level cron for Nextcloud background jobs independently of the device’s Round Sync schedule.

I also configured the supporting Ubuntu gateway and investigated server lockups, storage scanning issues, database consistency, reverse-proxy behavior, and stalled network transfers.

## Architecture

![Backup flow: microSD and Round Sync → Cloudflare → cloudflared on Debian → Caddy → Nextcloud → external USB storage. MariaDB and Redis support Nextcloud, while background cron runs separately.](/_astro/nextcloud-architecture.DMjYKnlG.png)

Round Sync transfers updated files over WebDAV through Cloudflare and an outbound Cloudflare Tunnel connection established by cloudflared on the Debian server. Caddy routes requests to Nextcloud, which writes the files to the external USB drive. MariaDB stores application records, while Redis handles transactional file locking.

The Ubuntu ThinkPad gateway belongs to the same home infrastructure and handles routing, DHCP/DNS, and trusted/guest access restrictions. Its configuration is described in the related Linux Gateway, DNS & Firewall case study.

## Evidence

The supplied Debian ASCII output records the host operating system, hardware, packages, and resource usage at capture time. Uptime and resource figures are snapshots, not live measurements or reliability guarantees. It replaces the previous dashboard image.

Three supplied Nextcloud administration screenshots show Status, Database, and Background jobs. They replace the old blurry monitoring crop and can be enlarged to their original resolution. Values describe capture time, not live monitoring. The Database capture shows 11 failing checks, 25 passing, and 1 skipped; no claim of a fully healthy database is made. The original screenshots are preserved unchanged; the application and personal files remain private.

The architecture image illustrates the service’s components and transfer flow; it is not a screenshot or proof of measured reliability.

## Troubleshooting

I investigated recurring silent lockups on the Debian application server and applied persistent CPU C-state limits through a GRUB configuration drop-in. This served as a practical mitigation without establishing a definitive hardware root cause.

I investigated slow storage scans involving the external NTFS drive and its ntfs-3g driver. Following a mount-related incident, I used Nextcloud OCC commands to rebuild file-cache records and add missing database indexes.

I also investigated stalled requests across the gateway and tunnel paths, adding TCP MSS clamping through UFW’s configuration to address path-MTU-related transfer problems. Other troubleshooting involved Cloudflare settings, reverse-proxy configuration, application sharing behavior, and Nextcloud brute-force throttling.

## Technical Details

Nextcloud runs with PHP-FPM alongside dedicated MariaDB and Redis containers. Caddy handles reverse-proxy routing, and cloudflared establishes the outbound tunnel used for public ingress without opening inbound router ports for the service.

The Round Sync script runs at 1 a.m. to check microSD files for new versions and transfer updates through WebDAV. Nextcloud’s host-level cron performs separate application background jobs.

The Debian server uses internal NVMe storage for application execution and an external USB-connected Western Digital NTFS drive for bulk storage. Tailscale provides remote administrative connectivity, while the related Ubuntu gateway uses dnsmasq, UFW/iptables, and AdGuard Home.

Backup retention and recovery testing are not documented in this case study, and no uptime percentage is claimed.

## Architecture context

1. microSD + Round Sync
2. Cloudflare
3. cloudflared on Debian
4. Caddy / Nextcloud
5. External USB storage

Backup transfer path for the private service. MariaDB and Redis support Nextcloud; application background cron runs separately from Round Sync.

## Host system snapshot

Resource usage and uptime describe the capture, not live monitoring.

```text
ambian@nextcloud-server
     ,g$$$$$$$$$$$$$$$P.       -----------------------
   ,g$$P""       """Y$$.".     OS: Debian GNU/Linux 13 (trixie) x86_64
  ,$$P'              `$$$.    Host: HP Pavilion Power Laptop 15-cb0xx
',$$P       ,ggs.     `$$b:    Kernel: Linux 6.12.94+deb13-amd64
`d$$'     ,$P"'   .    $$$     Uptime: 3 days, 1 hour, 26 mins
 $$P      d$'     ,    $$P     Packages: 879 (dpkg)
 $$:      $$.   -    ,d$$'     Shell: bash 5.2.37
 $$;      Y$b._   _,d$P'      Display (LGD0532): 1920x1080 @ 60 Hz in 15" [Built-in]
 `.`"Y$$$$P"'                 Cursor: Adwaita
 `$$b      "-.__              Terminal: /dev/pts/0
  `Y$$b                       CPU: Intel(R) Core(TM) i7-7700HQ (8) @ 3.80 GHz
   `Y$$.                      GPU 1: NVIDIA GeForce GTX 1050 Mobile [Discrete]
     `$$b.                    GPU 2: Intel HD Graphics 630 @ 1.10 GHz [Integrated]
       `Y$$b.                 Memory: 2.06 GiB / 7.65 GiB (27%)
         `"Y$b._              Swap: 687.69 MiB / 7.88 GiB (9%)
             `""""            Disk (/): 27.88 GiB / 224.97 GiB (12%) - ext4
```

## Screenshots / Evidence links

[Nextcloud administration Status tab showing Linux host details, resource usage, load, and memory.](/_astro/nextcloud-status.Dne7ag4U.png)

Supplied Status screenshot. Host details and resource usage describe capture time, not live monitoring.

[Nextcloud Background jobs tab showing System cron, recent job runs, durations, and peak memory.](/_astro/nextcloud-background-jobs.BY_yNbIN.png)

Supplied Background jobs screenshot showing System cron and recent runs. This cron is separate from the 1 a.m. Round Sync backup schedule.

[Nextcloud Database tab showing connections, queries per second, latency, and database check counts.](/_astro/nextcloud-database.BAGDjB-T.png)

Supplied Database screenshot. The captured checks include 11 failing, 25 passing, and 1 skipped; it does not establish a fully healthy database.

Public repository URL not supplied.

## Related work

- [Linux Gateway, DNS & Firewall Homelab](/work/linux-gateway.md) · [HTML](/work/linux-gateway/)

[All published work](/projects.md)
