Config: Make PhotoPrism compatible with MariaDB 11 #3443

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-06-02 17:07:10 +02:00
parent ef49ebe5a9
commit bff649469d
17 changed files with 49 additions and 24 deletions

View file

@ -150,7 +150,7 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --port=4001 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --port=4001 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
expose:
- "4001" # database port (internal)
volumes:

View file

@ -4,6 +4,29 @@ version: '3.5'
## Setup: https://docs.photoprism.app/developer-guide/setup/ ##
services:
## MariaDB 11.0 Database Server
## Docs: https://mariadb.com/docs/reference/
## Release Notes: https://mariadb.com/kb/en/mariadb-11-0-0-release-notes/
mariadb-11-0:
image: mariadb:11.0-rc
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: mariadbd --port=4001 --innodb-strict-mode=1 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
expose:
- "4001"
ports:
- "4003:4001" # database port (host:container)
volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment:
MARIADB_AUTO_UPGRADE: "1"
MARIADB_INITDB_SKIP_TZINFO: "1"
MARIADB_DATABASE: "photoprism"
MARIADB_USER: "photoprism"
MARIADB_PASSWORD: "photoprism"
MARIADB_ROOT_PASSWORD: "photoprism"
## MariaDB 10.8 Database Server
## Docs: https://mariadb.com/kb/en/release-notes-mariadb-108-series/
mariadb-10-8:
@ -11,7 +34,7 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --port=4001 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --port=4001 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
expose:
- "4001"
ports:

View file

@ -133,7 +133,7 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --port=4001 --innodb-strict-mode=1 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --port=4001 --innodb-strict-mode=1 --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
expose:
- "4001"
ports:

View file

@ -121,7 +121,7 @@ func backupAction(ctx *cli.Context) error {
switch conf.DatabaseDriver() {
case config.MySQL, config.MariaDB:
cmd = exec.Command(
conf.MysqldumpBin(),
conf.MariadbDumpBin(),
"--protocol", "tcp",
"-h", conf.DatabaseHost(),
"-P", conf.DatabasePortString(),

View file

@ -129,7 +129,7 @@ func restoreAction(ctx *cli.Context) error {
switch conf.DatabaseDriver() {
case config.MySQL, config.MariaDB:
cmd = exec.Command(
conf.MysqlBin(),
conf.MariadbBin(),
"--protocol", "tcp",
"-h", conf.DatabaseHost(),
"-P", conf.DatabasePortString(),

View file

@ -591,14 +591,14 @@ func (c *Config) TestdataPath() string {
return filepath.Join(c.StoragePath(), "testdata")
}
// MysqlBin returns the mysql executable file name.
func (c *Config) MysqlBin() string {
return findBin("", "mysql")
// MariadbBin returns the mariadb executable file name.
func (c *Config) MariadbBin() string {
return findBin("", "mariadb")
}
// MysqldumpBin returns the mysqldump executable file name.
func (c *Config) MysqldumpBin() string {
return findBin("", "mysqldump")
// MariadbDumpBin returns the mariadb-dump executable file name.
func (c *Config) MariadbDumpBin() string {
return findBin("", "mariadb-dump")
}
// SqliteBin returns the sqlite executable file name.

View file

@ -417,14 +417,14 @@ func TestConfig_AssetsPath2(t *testing.T) {
}
}
func TestConfig_MysqlBin(t *testing.T) {
func TestConfig_MariadbBin(t *testing.T) {
c := NewConfig(CliTestContext())
assert.Contains(t, c.MysqlBin(), "mysql")
assert.Contains(t, c.MariadbBin(), "mariadb")
}
func TestConfig_MysqldumpBin(t *testing.T) {
func TestConfig_MariadbDumpBin(t *testing.T) {
c := NewConfig(CliTestContext())
assert.Contains(t, c.MysqldumpBin(), "mysqldump")
assert.Contains(t, c.MariadbDumpBin(), "mariadb-dump")
}
func TestConfig_SqliteBin(t *testing.T) {

View file

@ -175,6 +175,8 @@ func (c *Config) Report() (rows [][]string, cols []string) {
{"database-password", strings.Repeat("*", utf8.RuneCountInString(c.DatabasePassword()))},
{"database-conns", fmt.Sprintf("%d", c.DatabaseConns())},
{"database-conns-idle", fmt.Sprintf("%d", c.DatabaseConnsIdle())},
{"mariadb-bin", c.MariadbBin()},
{"mariadb-dump-bin", c.MariadbDumpBin()},
// File Converters.
{"sips-bin", c.SipsBin()},

View file

@ -14,7 +14,7 @@
## MariaDB SQL Dump
The following dump was created by running `mysqldump --no-data --skip-add-locks --skip-comments --skip-opt --skip-set-charset photoprism > mariadb.sql` in a terminal:
The following dump was created by running `mariadb-dump --no-data --skip-add-locks --skip-comments --skip-opt --skip-set-charset photoprism > mariadb.sql` in a terminal:
↪ [mariadb.sql](mariadb.sql)

View file

@ -115,7 +115,7 @@ services:
security_opt:
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
volumes:
- "./database:/var/lib/mysql" # DO NOT REMOVE

View file

@ -198,7 +198,7 @@ services:
security_opt:
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
volumes:
- "./database:/var/lib/mysql" # DO NOT REMOVE

View file

@ -114,7 +114,7 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
volumes:
- "./database:/var/lib/mysql" # DO NOT REMOVE

View file

@ -88,7 +88,7 @@ services:
- apparmor:unconfined
## --lower-case-table-names=1 stores tables in lowercase and compares names in a case-insensitive manner
## see https://mariadb.com/kb/en/server-system-variables/#lower_case_table_names
command: mysqld --lower-case-table-names=1 --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --lower-case-table-names=1 --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
volumes:
- "database:/var/lib/mysql" # Named volume "database" is defined at the bottom (DO NOT REMOVE)
environment:

View file

@ -118,7 +118,7 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
volumes:
- "./database:/var/lib/mysql" # DO NOT REMOVE

View file

@ -96,7 +96,7 @@ services:
security_opt:
- seccomp:unconfined
- apparmor:unconfined
command: mysqld --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
volumes:
- "./database:/var/lib/mysql" # DO NOT REMOVE

View file

@ -96,7 +96,7 @@ services:
- apparmor:unconfined
## --lower-case-table-names=1 stores tables in lowercase and compares names in a case-insensitive manner
## see https://mariadb.com/kb/en/server-system-variables/#lower_case_table_names
command: mysqld --innodb-buffer-pool-size=512M --lower-case-table-names=1 --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
command: mariadbd --innodb-buffer-pool-size=512M --lower-case-table-names=1 --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
volumes:
- "database:/var/lib/mysql" # Named volume "database" is defined at the bottom (DO NOT REMOVE)
environment:

View file

@ -108,7 +108,7 @@ services:
- apparmor:unconfined
## --lower-case-table-names=1 stores tables in lowercase and compares names in a case-insensitive manner
## see https://mariadb.com/kb/en/server-system-variables/#lower_case_table_names
command: mysqld --innodb-buffer-pool-size=2G --lower-case-table-names=1 --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=180
command: mariadbd --innodb-buffer-pool-size=2G --lower-case-table-names=1 --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=180
volumes:
- "./database:/var/lib/mysql"
environment: