From 9391d5e5841eeac0d5bbebe4ad6daf6f8c991033 Mon Sep 17 00:00:00 2001 From: code Date: Sat, 10 Oct 2026 23:53:59 +0000 Subject: [PATCH] nextcloud: add MariaDB tuning config mount Co-Authored-By: Claude Opus 5.5 --- nextcloud/README.md | 12 +++++++++--- nextcloud/compose.yaml | 1 + nextcloud/config/nextcloud-tuning.cnf | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 nextcloud/config/nextcloud-tuning.cnf diff --git a/nextcloud/README.md b/nextcloud/README.md index 0c34dbd..9fc7115 100644 --- a/nextcloud/README.md +++ b/nextcloud/README.md @@ -14,9 +14,14 @@ Self-hosted file sync, sharing, and collaboration platform. This stack runs Next ## Getting Started 1. Set `NEXTCLOUD_DOMAIN` and change every `ChangeThisPassword` in `sample.env` -2. Start the stack: `docker compose up -d` -3. In NPM, add a proxy host for `NEXTCLOUD_DOMAIN` → `http://nextcloud:80` with SSL enabled -4. Open https://NEXTCLOUD_DOMAIN and create the admin account (the database fields are pre-filled from the environment) +2. Copy the MariaDB tuning file to the data directory **before the first start**. If it's missing, Docker creates a directory at that path and `nextcloud-db` fails to start: + ```bash + mkdir -p /data/nextcloud/db-conf + cp config/nextcloud-tuning.cnf /data/nextcloud/db-conf/ + ``` +3. Start the stack: `docker compose up -d` +4. In NPM, add a proxy host for `NEXTCLOUD_DOMAIN` → `http://nextcloud:80` with SSL enabled +5. Open https://NEXTCLOUD_DOMAIN and create the admin account (the database fields are pre-filled from the environment) To test without NPM, open http://HOST_IP:8084. Set `NEXTCLOUD_DOMAIN=HOST_IP` and `NEXTCLOUD_OVERWRITEPROTOCOL=http` first. Otherwise Nextcloud rejects the untrusted domain and redirects you to https links that don't work. @@ -40,6 +45,7 @@ To test without NPM, open http://HOST_IP:8084. Set `NEXTCLOUD_DOMAIN=HOST_IP` an ## Volume Notes /var/lib/mysql – host path /data/nextcloud/db (MariaDB data) + /etc/mysql/conf.d/nextcloud-tuning.cnf – host path /data/nextcloud/db-conf/nextcloud-tuning.cnf (read-only MariaDB tuning; copy from config/ in this repo, restart nextcloud-db after edits) /data – host path /var/cache/nextcloud/redis (Redis cache, file locks and sessions; safe to lose, users are logged out) /var/www/html – host path /data/nextcloud/data (Nextcloud app, config and user files; shared by nextcloud and nextcloud-cron) diff --git a/nextcloud/compose.yaml b/nextcloud/compose.yaml index 5253dc4..aa5c83b 100644 --- a/nextcloud/compose.yaml +++ b/nextcloud/compose.yaml @@ -4,6 +4,7 @@ services: restart: ${MARIADB_RESTART:-unless-stopped} volumes: - ${VOL_PATH:-/data}/nextcloud/db:/var/lib/mysql + - ${VOL_PATH:-/data}/nextcloud/db-conf/nextcloud-tuning.cnf:/etc/mysql/conf.d/nextcloud-tuning.cnf:ro environment: - MARIADB_DATABASE=${NEXTCLOUD_DB:-nextcloud} - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-ChangeThisPassword} diff --git a/nextcloud/config/nextcloud-tuning.cnf b/nextcloud/config/nextcloud-tuning.cnf new file mode 100644 index 0000000..c2a415f --- /dev/null +++ b/nextcloud/config/nextcloud-tuning.cnf @@ -0,0 +1,4 @@ +[mariadb] +slow_query_log = ON +long_query_time = 2 +innodb_log_file_size = 256M \ No newline at end of file