mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
Config: Require MariaDB v11.4 to use SSL for backups #4837
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
8aa0cc95ea
commit
6128bf4e47
4 changed files with 31 additions and 22 deletions
|
|
@ -2,6 +2,27 @@
|
|||
## Setup: https://docs.photoprism.app/developer-guide/setup/ ##
|
||||
|
||||
services:
|
||||
## MariaDB 11.4 Database Server
|
||||
## Docs: https://mariadb.com/docs/reference/
|
||||
## Release Notes: https://mariadb.com/kb/en/release-notes-mariadb-11-4-series/
|
||||
mariadb-11-4:
|
||||
image: mariadb:11.4
|
||||
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
|
||||
- seccomp:unconfined
|
||||
- apparmor:unconfined
|
||||
command: --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"
|
||||
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 11.3 Database Server
|
||||
## Docs: https://mariadb.com/docs/reference/
|
||||
## Release Notes: https://mariadb.com/kb/en/release-notes-mariadb-11-3-series/
|
||||
|
|
@ -13,8 +34,6 @@ services:
|
|||
command: --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:
|
||||
|
|
@ -36,8 +55,6 @@ services:
|
|||
command: --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:
|
||||
|
|
@ -58,8 +75,6 @@ services:
|
|||
command: --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:
|
||||
- "4002:4001" # database port (host:container)
|
||||
volumes:
|
||||
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
|
||||
environment:
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ func (c *Config) DatabaseSsl() bool {
|
|||
switch c.DatabaseDriver() {
|
||||
case MySQL:
|
||||
// see https://mariadb.org/mission-impossible-zero-configuration-ssl/
|
||||
return c.IsDatabaseVersion("v11.3")
|
||||
return c.IsDatabaseVersion("v11.4")
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,29 +2,22 @@ package clean
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/txt"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var VersionRegexp = regexp.MustCompile("(\\d+\\.)(\\d+\\.)(\\*|\\d+)")
|
||||
|
||||
// Version parses and returns a semantic version string.
|
||||
func Version(s string) string {
|
||||
if s == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
if strings.Contains(s, ":") {
|
||||
split := strings.Split(s, ":")
|
||||
|
||||
if len(split) > 1 {
|
||||
s = split[1]
|
||||
}
|
||||
}
|
||||
|
||||
if v := strings.Split(s, "."); len(v) < 3 {
|
||||
return ""
|
||||
// Find version string with regular expression
|
||||
// and return it with "v" prefix if found.
|
||||
if v := VersionRegexp.FindString(s); v != "" {
|
||||
return fmt.Sprintf("v%s", v)
|
||||
} else {
|
||||
patch, _, _ := strings.Cut(v[2], "+")
|
||||
return fmt.Sprintf("v%d.%d.%d", txt.UInt(Numeric(v[0])), txt.UInt(Numeric(v[1])), txt.UInt(patch))
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ func TestVersion(t *testing.T) {
|
|||
t.Run("MariaDB", func(t *testing.T) {
|
||||
assert.Equal(t, "v10.5.1", Version("10.5.1"))
|
||||
assert.Equal(t, "v10.5.7", Version("v10.5.7"))
|
||||
assert.Equal(t, "v11.4.5", Version("11.4.5-MariaDB-ubu2404"))
|
||||
assert.Equal(t, "v10.5.5", Version("MariaDB-1:10.5.5+maria~focal"))
|
||||
})
|
||||
t.Run("Empty", func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue