Develop: Honor MARIADB_PORT and POSTGRES_PORT overrides #5590

This commit is contained in:
Michael Mayer 2026-05-20 09:44:12 +00:00
parent edfd01460c
commit f7085cfb1d
18 changed files with 127 additions and 61 deletions

View file

@ -22,5 +22,9 @@
# TRAEFIK_HTTP_PORT=80 # TRAEFIK_HTTP_PORT=80
# TRAEFIK_HTTPS_PORT=443 # TRAEFIK_HTTPS_PORT=443
# Public base URL PhotoPrism advertises in share links, OIDC & PWA URIs. # Public base URL used in share links, OIDC & PWA URIs.
# PHOTOPRISM_SITE_URL=https://app.localssl.dev/ # PHOTOPRISM_SITE_URL=https://app.localssl.dev/
# Ports to which MariaDB and PostgreSQL should bind.
# MARIADB_PORT=4001
# POSTGRES_PORT=5432

View file

@ -2,5 +2,4 @@
user=root user=root
password=photoprism password=photoprism
host=mariadb host=mariadb
port=4001
skip-ssl=true skip-ssl=true

View file

@ -25,4 +25,9 @@ WORKDIR "/go/src/github.com/photoprism/photoprism"
COPY . . COPY . .
COPY --chown=root:root /scripts/dist/ /scripts/ COPY --chown=root:root /scripts/dist/ /scripts/
# Re-install the dev "mariadb" client config so a custom MARIADB_PORT in .env
# is honored even when the base image was built before the port=<n> line was
# removed (no-op once the next dated base image picks up the new .my.cnf).
COPY --chown=root:root --chmod=644 .my.cnf /etc/my.cnf
RUN sudo /scripts/install-yt-dlp.sh RUN sudo /scripts/install-yt-dlp.sh

View file

@ -528,7 +528,7 @@ run-test-hub:
env PHOTOPRISM_TEST_HUB="true" $(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop,debug" -timeout 20m ./pkg/... ./internal/... env PHOTOPRISM_TEST_HUB="true" $(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop,debug" -timeout 20m ./pkg/... ./internal/...
run-test-mariadb: run-test-mariadb:
$(info Running all Go tests on MariaDB...) $(info Running all Go tests on MariaDB...)
PHOTOPRISM_TEST_DRIVER="mysql" PHOTOPRISM_TEST_DSN="root:photoprism@tcp(mariadb:4001)/acceptance?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" $(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop" -timeout 20m ./pkg/... ./internal/... PHOTOPRISM_TEST_DRIVER="mysql" PHOTOPRISM_TEST_DSN="root:photoprism@tcp(mariadb:$${MARIADB_PORT:-4001})/acceptance?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" $(GOTEST) -parallel 1 -count 1 -cpu 1 -tags="slow,develop" -timeout 20m ./pkg/... ./internal/...
run-test-pkg: run-test-pkg:
$(info Running all Go tests in "/pkg"...) $(info Running all Go tests in "/pkg"...)
$(GOTEST) -parallel 2 -count 1 -cpu 2 -tags="slow,develop" -timeout 20m ./pkg/... $(GOTEST) -parallel 2 -count 1 -cpu 2 -tags="slow,develop" -timeout 20m ./pkg/...

View file

@ -34,14 +34,15 @@ services:
PHOTOPRISM_HTTP_HOST: "0.0.0.0" PHOTOPRISM_HTTP_HOST: "0.0.0.0"
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # Improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # Improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
MYSQL_TCP_PORT: "${MARIADB_PORT:-4001}" # default port used by the "mariadb" client (see .my.cnf)
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "root" PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
PHOTOPRISM_TEST_DRIVER: "sqlite" PHOTOPRISM_TEST_DRIVER: "sqlite"
PHOTOPRISM_TEST_DSN: ".test.db" PHOTOPRISM_TEST_DSN: ".test.db"
# PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s" # PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:${MARIADB_PORT:-4001})/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s"
PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets" PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets"
PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage" PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage"
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals" PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals"
@ -92,11 +93,11 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined - seccomp:unconfined
- apparmor:unconfined - apparmor:unconfined
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 command: --port=${MARIADB_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: expose:
- "4001" - "${MARIADB_PORT:-4001}"
ports: ports:
- "4001:4001" # database port (host:container) - "${MARIADB_PORT:-4001}:${MARIADB_PORT:-4001}" # database port (host:container)
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -124,5 +125,5 @@ volumes:
## Create shared "photoprism" network for connecting with services in other compose.yaml files ## Create shared "photoprism" network for connecting with services in other compose.yaml files
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
driver: bridge driver: bridge

View file

@ -28,7 +28,7 @@ services:
- "traefik:dummy-webdav.localssl.dev" - "traefik:dummy-webdav.localssl.dev"
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.docker.network=photoprism" - "traefik.docker.network=${COMPOSE_NETWORK_NAME:-photoprism}"
- "traefik.http.services.photoprism.loadbalancer.server.port=2342" - "traefik.http.services.photoprism.loadbalancer.server.port=2342"
- "traefik.http.services.photoprism.loadbalancer.server.scheme=http" - "traefik.http.services.photoprism.loadbalancer.server.scheme=http"
- "traefik.http.routers.photoprism.entrypoints=websecure" - "traefik.http.routers.photoprism.entrypoints=websecure"
@ -94,13 +94,14 @@ services:
PHOTOPRISM_HTTP_HOST: "0.0.0.0" PHOTOPRISM_HTTP_HOST: "0.0.0.0"
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
MYSQL_TCP_PORT: "${MARIADB_PORT:-4001}" # default port used by the "mariadb" client (see .my.cnf)
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "root" PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
PHOTOPRISM_TEST_DRIVER: "sqlite" PHOTOPRISM_TEST_DRIVER: "sqlite"
# PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s" # PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:${MARIADB_PORT:-4001})/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s"
PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets" PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets"
PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage" PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage"
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals" PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals"
@ -195,5 +196,5 @@ volumes:
## Create shared "photoprism" network for connecting with services in other compose.yaml files ## Create shared "photoprism" network for connecting with services in other compose.yaml files
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
driver: bridge driver: bridge

View file

@ -12,7 +12,7 @@ services:
- "2344:2342" # HTTP port (host:container) - "2344:2342" # HTTP port (host:container)
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.docker.network=photoprism" - "traefik.docker.network=${COMPOSE_NETWORK_NAME:-photoprism}"
- "traefik.http.services.latest.loadbalancer.server.port=2342" - "traefik.http.services.latest.loadbalancer.server.port=2342"
- "traefik.http.routers.latest.entrypoints=websecure" - "traefik.http.routers.latest.entrypoints=websecure"
- "traefik.http.routers.latest.rule=Host(`latest.localssl.dev`)" - "traefik.http.routers.latest.rule=Host(`latest.localssl.dev`)"
@ -38,7 +38,7 @@ services:
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "root" PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
@ -69,5 +69,5 @@ services:
## Join shared "photoprism" network ## Join shared "photoprism" network
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
external: true external: true

View file

@ -14,7 +14,7 @@ services:
- "2345:2342" # HTTP port (host:container) - "2345:2342" # HTTP port (host:container)
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.docker.network=photoprism" - "traefik.docker.network=${COMPOSE_NETWORK_NAME:-photoprism}"
- "traefik.http.services.latest.loadbalancer.server.port=2342" - "traefik.http.services.latest.loadbalancer.server.port=2342"
- "traefik.http.routers.latest.entrypoints=websecure" - "traefik.http.routers.latest.entrypoints=websecure"
- "traefik.http.routers.latest.rule=Host(`local.localssl.dev`)" - "traefik.http.routers.latest.rule=Host(`local.localssl.dev`)"
@ -39,7 +39,7 @@ services:
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "local" PHOTOPRISM_DATABASE_NAME: "local"
PHOTOPRISM_DATABASE_USER: "local" PHOTOPRISM_DATABASE_USER: "local"
PHOTOPRISM_DATABASE_PASSWORD: "local" PHOTOPRISM_DATABASE_PASSWORD: "local"
@ -76,5 +76,5 @@ services:
## Join shared "photoprism" network ## Join shared "photoprism" network
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
external: true external: true

View file

@ -10,9 +10,9 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined - seccomp:unconfined
- apparmor: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 command: --port=${MARIADB_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: expose:
- "4001" - "${MARIADB_PORT:-4001}"
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -31,9 +31,9 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined - seccomp:unconfined
- apparmor: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 command: --port=${MARIADB_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: expose:
- "4001" - "${MARIADB_PORT:-4001}"
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -52,9 +52,9 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined - seccomp:unconfined
- apparmor: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 command: --port=${MARIADB_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: expose:
- "4001" - "${MARIADB_PORT:-4001}"
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -72,9 +72,9 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined - seccomp:unconfined
- apparmor:unconfined - apparmor:unconfined
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 command: --port=${MARIADB_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: expose:
- "4001" - "${MARIADB_PORT:-4001}"
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -90,9 +90,9 @@ services:
## see https://jira.mariadb.org/browse/MDEV-25362 ## see https://jira.mariadb.org/browse/MDEV-25362
mariadb-10-5-5: mariadb-10-5-5:
image: mariadb:10.5.5 image: mariadb:10.5.5
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 command: --port=${MARIADB_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: expose:
- "4001" # database port (internal) - "${MARIADB_PORT:-4001}" # database port (internal)
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -105,9 +105,9 @@ services:
## Docs: https://mariadb.com/docs/reference/cs10.3/ ## Docs: https://mariadb.com/docs/reference/cs10.3/
mariadb-10-3: mariadb-10-3:
image: mariadb:10.3 image: mariadb:10.3
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 command: --port=${MARIADB_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: expose:
- "4001" # database port (internal) - "${MARIADB_PORT:-4001}" # database port (internal)
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -120,9 +120,9 @@ services:
## Docs: https://mariadb.com/docs/reference/cs10.2/ ## Docs: https://mariadb.com/docs/reference/cs10.2/
mariadb-10-2: mariadb-10-2:
image: mariadb:10.2 image: mariadb:10.2
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 command: --port=${MARIADB_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: expose:
- "4001" # database port (internal) - "${MARIADB_PORT:-4001}" # database port (internal)
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -134,9 +134,9 @@ services:
## MariaDB 10.1 Database Server ## MariaDB 10.1 Database Server
mariadb-10-1: mariadb-10-1:
image: mariadb:10.1 image: mariadb:10.1
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 command: --port=${MARIADB_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: expose:
- "4001" # database port (internal) - "${MARIADB_PORT:-4001}" # database port (internal)
volumes: volumes:
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
environment: environment:
@ -148,5 +148,5 @@ services:
## Join shared "photoprism" network ## Join shared "photoprism" network
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
external: true external: true

View file

@ -6,9 +6,9 @@ services:
## Docs: https://dev.mysql.com/doc/refman/8.0/en/ ## Docs: https://dev.mysql.com/doc/refman/8.0/en/
mysql: mysql:
image: mysql:8 image: mysql:8
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 command: --port=${MARIADB_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: expose:
- "4001" # database port (internal) - "${MARIADB_PORT:-4001}" # database port (internal)
environment: environment:
MYSQL_DATABASE: "photoprism" MYSQL_DATABASE: "photoprism"
MYSQL_USER: "photoprism" MYSQL_USER: "photoprism"
@ -18,5 +18,5 @@ services:
## Join shared "photoprism" network ## Join shared "photoprism" network
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
external: true external: true

View file

@ -31,7 +31,7 @@ services:
- "traefik:dummy-webdav.localssl.dev" - "traefik:dummy-webdav.localssl.dev"
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.docker.network=photoprism" - "traefik.docker.network=${COMPOSE_NETWORK_NAME:-photoprism}"
- "traefik.http.services.photoprism.loadbalancer.server.port=2342" - "traefik.http.services.photoprism.loadbalancer.server.port=2342"
- "traefik.http.services.photoprism.loadbalancer.server.scheme=http" - "traefik.http.services.photoprism.loadbalancer.server.scheme=http"
- "traefik.http.routers.photoprism.entrypoints=websecure" - "traefik.http.routers.photoprism.entrypoints=websecure"
@ -97,13 +97,14 @@ services:
PHOTOPRISM_HTTP_HOST: "0.0.0.0" PHOTOPRISM_HTTP_HOST: "0.0.0.0"
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
MYSQL_TCP_PORT: "${MARIADB_PORT:-4001}" # default port used by the "mariadb" client (see .my.cnf)
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "root" PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
PHOTOPRISM_TEST_DRIVER: "sqlite" PHOTOPRISM_TEST_DRIVER: "sqlite"
# PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s" # PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:${MARIADB_PORT:-4001})/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s"
PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets" PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets"
PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage" PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage"
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals" PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals"
@ -178,7 +179,7 @@ services:
# - "11434:11434" # - "11434:11434"
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.docker.network=photoprism" - "traefik.docker.network=${COMPOSE_NETWORK_NAME:-photoprism}"
- "traefik.http.services.ollama.loadbalancer.server.port=11434" - "traefik.http.services.ollama.loadbalancer.server.port=11434"
- "traefik.http.routers.ollama.rule=Host(`ollama.localssl.dev`)" - "traefik.http.routers.ollama.rule=Host(`ollama.localssl.dev`)"
- "traefik.http.routers.ollama.entrypoints=websecure" - "traefik.http.routers.ollama.entrypoints=websecure"
@ -267,5 +268,5 @@ volumes:
## Create shared "photoprism" network for connecting with services in other compose.yaml files ## Create shared "photoprism" network for connecting with services in other compose.yaml files
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
driver: bridge driver: bridge

View file

@ -12,7 +12,7 @@ services:
- "2344:2342" # HTTP port (host:container) - "2344:2342" # HTTP port (host:container)
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.docker.network=photoprism" - "traefik.docker.network=${COMPOSE_NETWORK_NAME:-photoprism}"
- "traefik.http.services.preview.loadbalancer.server.port=2342" - "traefik.http.services.preview.loadbalancer.server.port=2342"
- "traefik.http.routers.preview.entrypoints=websecure" - "traefik.http.routers.preview.entrypoints=websecure"
- "traefik.http.routers.preview.rule=Host(`preview.localssl.dev`)" - "traefik.http.routers.preview.rule=Host(`preview.localssl.dev`)"
@ -38,7 +38,7 @@ services:
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "root" PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
@ -69,5 +69,5 @@ services:
## Join shared "photoprism" network ## Join shared "photoprism" network
networks: networks:
default: default:
name: photoprism name: ${COMPOSE_NETWORK_NAME:-photoprism}
external: true external: true

View file

@ -101,13 +101,14 @@ services:
PHOTOPRISM_HTTP_HOST: "0.0.0.0" PHOTOPRISM_HTTP_HOST: "0.0.0.0"
PHOTOPRISM_HTTP_PORT: 2342 PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip") PHOTOPRISM_HTTP_COMPRESSION: "zstd,gzip" # improves transfer speed and bandwidth utilization (none, gzip, zstd, or comma-separated list e.g. "zstd,gzip")
MYSQL_TCP_PORT: "${MARIADB_PORT:-4001}" # default port used by the "mariadb" client (see .my.cnf)
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001" PHOTOPRISM_DATABASE_SERVER: "mariadb:${MARIADB_PORT:-4001}"
PHOTOPRISM_DATABASE_NAME: "photoprism" PHOTOPRISM_DATABASE_NAME: "photoprism"
PHOTOPRISM_DATABASE_USER: "root" PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
PHOTOPRISM_TEST_DRIVER: "sqlite" PHOTOPRISM_TEST_DRIVER: "sqlite"
# PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s" # PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:${MARIADB_PORT:-4001})/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s"
PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets" PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets"
PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage" PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage"
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals" PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals"
@ -186,12 +187,21 @@ services:
security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
- seccomp:unconfined - seccomp:unconfined
- apparmor: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 command:
- "--port=${MARIADB_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: expose:
- "4001" # 3306 isn't used intentionally to avoid conflicts and confuse port scanners - "${MARIADB_PORT:-4001}" # does not default to 3306 in order to avoid conflicts and confuse port scanners
## Publish the MariaDB port on the host for direct access from the host: ## Publish the MariaDB port on the host for direct access from the host:
ports: ports:
- "${SERVICES_BIND_HOST:-127.0.0.1}:4001:4001" # MariaDB - "${SERVICES_BIND_HOST:-127.0.0.1}:${MARIADB_PORT:-4001}:${MARIADB_PORT:-4001}" # MariaDB
volumes: volumes:
- "mariadb:/var/lib/mysql" - "mariadb:/var/lib/mysql"
- "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql"
@ -209,10 +219,10 @@ services:
postgres: postgres:
image: postgres:18-alpine image: postgres:18-alpine
expose: expose:
- "5432" - "${POSTGRES_PORT:-5432}"
## Publish the PostgreSQL port on the host for direct access from the host: ## Publish the PostgreSQL port on the host for direct access from the host:
ports: ports:
- "${SERVICES_BIND_HOST:-127.0.0.1}:5432:5432" # PostgreSQL - "${SERVICES_BIND_HOST:-127.0.0.1}:${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}" # PostgreSQL
volumes: volumes:
- "postgres:/var/lib/postgresql" - "postgres:/var/lib/postgresql"
- "./scripts/sql/postgresql-init.sql:/docker-entrypoint-initdb.d/init.sql" - "./scripts/sql/postgresql-init.sql:/docker-entrypoint-initdb.d/init.sql"
@ -220,6 +230,7 @@ services:
POSTGRES_DB: photoprism POSTGRES_DB: photoprism
POSTGRES_USER: photoprism POSTGRES_USER: photoprism
POSTGRES_PASSWORD: photoprism POSTGRES_PASSWORD: photoprism
PGPORT: "${POSTGRES_PORT:-5432}"
PGDATA: /var/lib/postgresql/18/docker PGDATA: /var/lib/postgresql/18/docker
## Qdrant (Vector Database) ## Qdrant (Vector Database)
@ -449,7 +460,7 @@ services:
KC_HOSTNAME_STRICT: "false" KC_HOSTNAME_STRICT: "false"
KC_PROXY: "edge" KC_PROXY: "edge"
KC_DB: "mariadb" KC_DB: "mariadb"
KC_DB_URL: "jdbc:mariadb://mariadb:4001/keycloak" KC_DB_URL: "jdbc:mariadb://mariadb:${MARIADB_PORT:-4001}/keycloak"
KC_DB_USERNAME: "keycloak" KC_DB_USERNAME: "keycloak"
KC_DB_PASSWORD: "keycloak" KC_DB_PASSWORD: "keycloak"

View file

@ -119,7 +119,8 @@ func NewTestOptionsForPath(dbName, dataPath string) *Options {
// Obtain test database credentials. // Obtain test database credentials.
// //
// Example PHOTOPRISM_TEST_DSN for MariaDB / MySQL: // Example PHOTOPRISM_TEST_DSN for MariaDB / MySQL (the port matches the dev
// MariaDB service, which defaults to 4001 unless MARIADB_PORT overrides it):
// - "photoprism:photoprism@tcp(mariadb:4001)/photoprism?parseTime=true" // - "photoprism:photoprism@tcp(mariadb:4001)/photoprism?parseTime=true"
dbName = PkgNameRegexp.ReplaceAllString(dbName, "") dbName = PkgNameRegexp.ReplaceAllString(dbName, "")
testDriver := os.Getenv("PHOTOPRISM_TEST_DRIVER") testDriver := os.Getenv("PHOTOPRISM_TEST_DRIVER")

View file

@ -1,6 +1,8 @@
package migrate package migrate
import ( import (
"fmt"
"os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"testing" "testing"
@ -28,9 +30,14 @@ func TestDialectMysql(t *testing.T) {
log = logrus.StandardLogger() log = logrus.StandardLogger()
log.SetLevel(logrus.TraceLevel) log.SetLevel(logrus.TraceLevel)
port := os.Getenv("MARIADB_PORT")
if port == "" {
port = "4001"
}
db, err := gorm.Open( db, err := gorm.Open(
"mysql", "mysql",
"migrate:migrate@tcp(mariadb:4001)/migrate?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true", fmt.Sprintf("migrate:migrate@tcp(mariadb:%s)/migrate?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true", port),
) )
if err != nil || db == nil { if err != nil || db == nil {

View file

@ -6,7 +6,7 @@ The provisioner package manages per-instance MariaDB schemas and users for clust
### Development Workflow ### Development Workflow
- Configuration lives in `database.go`. The admin connection string is `ProvisionDSN` (default `root:photoprism@tcp(mariadb:4001)/photoprism`). Query parameters are optional when configuring the portal flag/env (`database-provision-dsn`), for example `charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s`. - Configuration lives in `database.go`. The admin connection string is `ProvisionDSN`; the default targets the dev MariaDB service (`root:photoprism@tcp(mariadb:<port>)/photoprism`) using the port from the `MARIADB_PORT` environment variable (falls back to `4001`). Query parameters are optional when configuring the portal flag/env (`database-provision-dsn`), for example `charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true&timeout=15s`.
- `EnsureCredentials` accepts the technical node UUID/name identifiers, creates the schema if needed, and returns credentials plus rotation metadata. `DropCredentials` revokes grants, drops the user, and removes the schema. Both functions require a context; prefer `context.WithTimeout` in callers. - `EnsureCredentials` accepts the technical node UUID/name identifiers, creates the schema if needed, and returns credentials plus rotation metadata. `DropCredentials` revokes grants, drops the user, and removes the schema. Both functions require a context; prefer `context.WithTimeout` in callers.
- Identifier generation is centralized in `GenerateCredentials`. Call it instead of handcrafting database or user names so tests, CLI, and API stay aligned. The resulting identifiers follow `<prefix>d<hmac11>` for schemas and `<prefix>u<hmac11>` for users. Portal deployments may override the prefix via the `database-provision-prefix` flag; defaults are `cluster_d…` / `cluster_u…`. - Identifier generation is centralized in `GenerateCredentials`. Call it instead of handcrafting database or user names so tests, CLI, and API stay aligned. The resulting identifiers follow `<prefix>d<hmac11>` for schemas and `<prefix>u<hmac11>` for users. Portal deployments may override the prefix via the `database-provision-prefix` flag; defaults are `cluster_d…` / `cluster_u…`.
@ -28,7 +28,7 @@ The provisioner package manages per-instance MariaDB schemas and users for clust
### MariaDB Troubleshooting ### MariaDB Troubleshooting
- Connect from the dev container using `mariadb` (already configured to reach `mariadb:4001`). Common snippets: - Connect from the dev container using `mariadb` (configured via `.my.cnf` to reach the dev MariaDB service; the default port is `4001` unless `MARIADB_PORT` overrides it in `.env`). Common snippets:
```bash ```bash
cat <<'SQL' | mariadb cat <<'SQL' | mariadb
SHOW DATABASES LIKE 'cluster_d%'; -- adjust prefix if database-provision-prefix overrides the default SHOW DATABASES LIKE 'cluster_d%'; -- adjust prefix if database-provision-prefix overrides the default

View file

@ -5,7 +5,9 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"os"
"regexp" "regexp"
"strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -13,15 +15,26 @@ import (
_ "github.com/go-sql-driver/mysql" // register MySQL driver _ "github.com/go-sql-driver/mysql" // register MySQL driver
) )
// devDatabasePort returns the dev MariaDB port, honoring MARIADB_PORT when set so
// the provisioner stays aligned with compose.yaml overrides.
func devDatabasePort() int {
if v := os.Getenv("MARIADB_PORT"); v != "" {
if n, err := strconv.Atoi(v); err == nil && n > 0 && n < 65536 {
return n
}
}
return 4001
}
// ProvisionDSN specifies the admin DSN used for auto-provisioning, for example: // ProvisionDSN specifies the admin DSN used for auto-provisioning, for example:
// root:insecure@tcp(127.0.0.1:3306)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true // root:insecure@tcp(127.0.0.1:3306)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true
var ProvisionDSN = "root:photoprism@tcp(mariadb:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" var ProvisionDSN = fmt.Sprintf("root:photoprism@tcp(mariadb:%d)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true", devDatabasePort())
// DatabaseHost is the hostname of the admin server used for provisioning operations. // DatabaseHost is the hostname of the admin server used for provisioning operations.
var DatabaseHost = "mariadb" var DatabaseHost = "mariadb"
// DatabasePort is the port of the admin server used for provisioning operations. // DatabasePort is the port of the admin server used for provisioning operations.
var DatabasePort = 4001 var DatabasePort = devDatabasePort()
// DatabaseDriver indicates the SQL driver used for provisioning (independent from the app DB driver). // DatabaseDriver indicates the SQL driver used for provisioning (independent from the app DB driver).
var DatabaseDriver = "mysql" var DatabaseDriver = "mysql"

View file

@ -11,6 +11,29 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
// --- devDatabasePort ---------------------------------------------------------
func TestDevDatabasePort(t *testing.T) {
t.Run("Default", func(t *testing.T) {
t.Setenv("MARIADB_PORT", "")
assert.Equal(t, 4001, devDatabasePort())
})
t.Run("Override", func(t *testing.T) {
t.Setenv("MARIADB_PORT", "4002")
assert.Equal(t, 4002, devDatabasePort())
})
t.Run("InvalidNonNumeric", func(t *testing.T) {
t.Setenv("MARIADB_PORT", "not-a-port")
assert.Equal(t, 4001, devDatabasePort())
})
t.Run("InvalidOutOfRange", func(t *testing.T) {
t.Setenv("MARIADB_PORT", "0")
assert.Equal(t, 4001, devDatabasePort())
t.Setenv("MARIADB_PORT", "70000")
assert.Equal(t, 4001, devDatabasePort())
})
}
// --- Quoting helpers --------------------------------------------------------- // --- Quoting helpers ---------------------------------------------------------
func TestQuoteIdent_Valid(t *testing.T) { func TestQuoteIdent_Valid(t *testing.T) {