crazy-max/docker-nextcloud

nextcloud `dbhost` have undocumented format

whlsxl opened this issue · 1 comments

whlsxl commented

Support guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

nextcloud doc didn't mention all possible dbhost formats, according to the nextcloud/server code, Nextcloud will check the dbport & dbhost configuration to determine the database configuration.

  1. dbhost => "127.0.0.1:3306"
  2. dbhost => "127.0.0.1" & dbport => 3306
  3. dbhost => "unix:/run/mysqld/mysqld.sock"

All of these configuration formats are accepted and recognized by Nextcloud.

graph TD
    Start --> dbport_exist
    dbport_exist -->|Exists| dbport_number
    dbport_exist -->|Doesn't Exist| dbhost_colon
    dbport_number -->|Is a Number| Assign_port
    dbport_number -->|Not a Number| Assign_unix_socket
    dbhost_colon -->|Contains ':'| dbhost_split 
    dbhost_colon -->|Doesn't Contain ':'| Assign_host
    dbhost_split --> dbhost_port_part
    dbhost_split --> dbhost_host_part
    dbhost_host_part --> Assign_host
    dbhost_port_part -->|Is a Number| Assign_port
    dbhost_port_part -->|Not a Number| Assign_unix_socket

    subgraph Check dbport
    dbport_exist((dbport exists?))
    dbport_number((Is a Number?))
    end

    subgraph Check dbhost
    dbhost_colon((Contains ':'))
    dbhost_split((Split by ':'))
    dbhost_split((Split by ':'))
    dbhost_port_part((Second part Is a Number?))
    dbhost_host_part((First part))
    end

    subgraph Assign Values
    Assign_port((TCP Port))
    Assign_unix_socket((Unix Socket))
    Assign_host((TCP Host))
    end

Loading

Expected behaviour

accept DB_HOST : 192.168.1.1:3306

Actual behaviour

database connection check failed.

Steps to reproduce

set DB_HOST : 192.168.1.1:3306

Docker info

Client: Docker Engine - Community
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.5
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 20
  Running: 18
  Paused: 0
  Stopped: 2
 Images: 56
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-83-generic
 Operating System: Ubuntu 22.04.1 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.617GiB
 Name: liannong
 ID: EJBI:3MBN:FQAJ:BASO:JHTX:G3ST:OVCG:FCTW:UFFV:PJQZ:IW62:D6ZB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Docker Compose config

No response

Logs

Checking mysql database connection...
Waiting 60s for database to be ready...


### Additional info

_No response_

dbhost is set only for autoconfig on first installation:

'dbhost' => '${DB_HOST}',

See https://github.com/crazy-max/docker-nextcloud#first-installation

If you need to change this value after first installation, you need to edit the configuration in /data/config.php.