Skip to content

Commit b5a201a

Browse files
committed
20210809 MariaDB + Nextcloud - old-menu branch - PR 2 of 3
1. Adds Dockerfile to MariaDB template to add stability patches recommended in: * [StackOverflow](https://stackoverflow.com/questions/61809270/how-to-discover-why-mariadb-crashes) * [Discord](https://discord.com/channels/638610460567928832/638610461109256194/825049573520965703) Note: * I have been running these patches for three months and they definitely improve stability (zero crashes in nextcloud_db). The Discord link above contains a similar stability report for MariaDB. 2. Alters service definitions for both MariaDB and Nextcloud to: * build using the Dockerfile * add a volume mapping to support backup/restore of MariaDB database. Note: * it was a conscious decision to place the db_backup folder in `./volumes/CONTAINER` rather than mimic the arrangement for influxdb. It simplifies the backup/restore design. 3. Adds port mapping 9322:3306 to nextcloud_db service definition. This is needed so "restore" routines can tell when the MariaDB service is open for business. Note: * MariaDB already exposes 3306:3306.
1 parent c2d7825 commit b5a201a

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.templates/mariadb/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Download base image
2+
FROM ghcr.io/linuxserver/mariadb
3+
4+
# apply stability patches recommended in
5+
#
6+
# https://discord.com/channels/638610460567928832/638610461109256194/825049573520965703
7+
# https://stackoverflow.com/questions/61809270/how-to-discover-why-mariadb-crashes
8+
RUN sed -i.bak \
9+
-e "s/^thread_cache_size/# thread_cache_size/" \
10+
-e "s/^read_buffer_size/# read_buffer_size/" \
11+
/defaults/my.cnf
12+
13+
# EOF

.templates/mariadb/service.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
mariadb:
2-
image: linuxserver/mariadb
2+
build: ./.templates/mariadb/.
33
container_name: mariadb
44
env_file:
55
- ./services/mariadb/mariadb.env
66
volumes:
77
- ./volumes/mariadb/config:/config
8+
- ./volumes/mariadb/db_backup:/backup
89
ports:
910
- "3306:3306"
1011
restart: unless-stopped

.templates/nextcloud/service.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
nextcloud_db:
1818
container_name: nextcloud_db
19-
image: ghcr.io/linuxserver/mariadb
19+
build: ./.templates/mariadb/.
2020
restart: unless-stopped
2121
environment:
2222
- TZ=Etc/UTC
@@ -26,5 +26,8 @@
2626
- MYSQL_PASSWORD=user_password
2727
- MYSQL_DATABASE=nextcloud
2828
- MYSQL_USER=nextcloud
29+
ports:
30+
- "9322:3306"
2931
volumes:
3032
- ./volumes/nextcloud/db:/config
33+
- ./volumes/nextcloud/db_backup:/backup

0 commit comments

Comments
 (0)