nextcloud: add MariaDB tuning config mount

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
code
2026-10-10 23:53:59 +00:00
co-authored by Claude Opus 5.5
parent bf366492b8
commit 9391d5e584
3 changed files with 14 additions and 3 deletions
+9 -3
View File
@@ -14,9 +14,14 @@ Self-hosted file sync, sharing, and collaboration platform. This stack runs Next
## Getting Started ## Getting Started
1. Set `NEXTCLOUD_DOMAIN` and change every `ChangeThisPassword` in `sample.env` 1. Set `NEXTCLOUD_DOMAIN` and change every `ChangeThisPassword` in `sample.env`
2. Start the stack: `docker compose up -d` 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:
3. In NPM, add a proxy host for `NEXTCLOUD_DOMAIN` → `http://nextcloud:80` with SSL enabled ```bash
4. Open https://NEXTCLOUD_DOMAIN and create the admin account (the database fields are pre-filled from the environment) 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. 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 ## Volume Notes
/var/lib/mysql – host path /data/nextcloud/db (MariaDB data) /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) /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) /var/www/html – host path /data/nextcloud/data (Nextcloud app, config and user files; shared by nextcloud and nextcloud-cron)
+1
View File
@@ -4,6 +4,7 @@ services:
restart: ${MARIADB_RESTART:-unless-stopped} restart: ${MARIADB_RESTART:-unless-stopped}
volumes: volumes:
- ${VOL_PATH:-/data}/nextcloud/db:/var/lib/mysql - ${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: environment:
- MARIADB_DATABASE=${NEXTCLOUD_DB:-nextcloud} - MARIADB_DATABASE=${NEXTCLOUD_DB:-nextcloud}
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-ChangeThisPassword} - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-ChangeThisPassword}
+4
View File
@@ -0,0 +1,4 @@
[mariadb]
slow_query_log = ON
long_query_time = 2
innodb_log_file_size = 256M