dokku / dokku-postgres

a postgres plugin for dokku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dokku-postgres fails to start on a fresh dokku installation using docker (

ProGM opened this issue · comments

Description of problem

If you fresh-install dokku using the docker installation steps, then install postgres, the process fails with the following error:

2023-08-10 15:56:45.261 UTC [1] FATAL:  could not load server certificate file "server.crt": SSL error code 2147483650
2023-08-10 15:56:45.261 UTC [1] LOG:  database system is shut down

How reproducible

Tested on Linux Red Hat and on MacOS and it's consistent.

I've also tested on a fresh EC2 instance with Ubuntu 22. Same issue.

Steps to Reproduce

  1. Install dokku using: https://dokku.com/docs/getting-started/install/docker/
  2. Run docker exec -it dokku bash
  3. Run dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
  4. Run dokku postgres:create test
  5. The test database will fail to start with the following error:
2023-08-10 15:56:45.261 UTC [1] FATAL:  could not load server certificate file "server.crt": SSL error code 2147483650
2023-08-10 15:56:45.261 UTC [1] LOG:  database system is shut down

Environment Information

This is not related to a specific app. It happens also if you don't have any (fresh installation)

Output of dokku report:

-----> uname: Linux 35ee32d6c8c4 5.19.0-1025-aws #26~22.04.1-Ubuntu SMP Mon Apr 24 01:58:15 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
                     total        used        free      shared  buff/cache   available
       Mem:            965         326          71           1         568         456
       Swap:             0           0           0
-----> docker version:
       Client: Docker Engine - Community
        Version:           24.0.5
        API version:       1.43
        Go version:        go1.20.6
        Git commit:        ced0996
        Built:             Fri Jul 21 20:35:23 2023
        OS/Arch:           linux/amd64
        Context:           default

       Server: Docker Engine - Community
        Engine:
         Version:          24.0.5
         API version:      1.43 (minimum version 1.12)
         Go version:       go1.20.6
         Git commit:       a61e2b4
         Built:            Fri Jul 21 20:35:18 2023
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          1.6.22
         GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
        runc:
         Version:          1.1.8
         GitCommit:        v1.1.8-0-g82f18fe
        docker-init:
         Version:          0.19.0
         GitCommit:        de40ad0
-----> docker daemon info:
       Client: Docker Engine - Community
        Version:    24.0.5
        Context:    default
        Debug Mode: true
        Plugins:
         compose: Docker Compose (Docker Inc.)
           Version:  v2.20.2
           Path:     /usr/libexec/docker/cli-plugins/docker-compose

       Server:
        Containers: 6
         Running: 2
         Paused: 0
         Stopped: 4
        Images: 10
        Server Version: 24.0.5
        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: 8165feabfdfe38c65b599c4993d227328c231fca
        runc version: v1.1.8-0-g82f18fe
        init version: de40ad0
        Security Options:
         apparmor
         seccomp
          Profile: builtin
         cgroupns
        Kernel Version: 5.19.0-1025-aws
        Operating System: Ubuntu 22.04.2 LTS
        OSType: linux
        Architecture: x86_64
        CPUs: 1
        Total Memory: 965.7MiB
        Name: ip-172-31-21-251
        ID: ff634fc4-4cd0-48b8-b099-abcf77b6ad5f
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
         File Descriptors: 45
         Goroutines: 66
         System Time: 2023-08-10T16:40:14.625394069Z
         EventsListeners: 1
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false

-----> git version: git version 2.25.1
-----> sigil version: 0.9.0build+bc921b7
-----> herokuish version:
 !     Herokuish image gliderlabs/herokuish:latest-20 is not available
-----> dokku version: dokku version 0.30.10
-----> plugn version: plugn: 0.12.0build+3a27594
-----> dokku plugins:
         00_dokku-standard    0.30.10 enabled    dokku core standard plugin
         20_events            0.30.10 enabled    dokku core events logging plugin
         app-json             0.30.10 enabled    dokku core app-json plugin
         apps                 0.30.10 enabled    dokku core apps plugin
         builder              0.30.10 enabled    dokku core builder plugin
         builder-dockerfile   0.30.10 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.30.10 enabled    dokku core builder-herokuish plugin
         builder-lambda       0.30.10 enabled    dokku core builder-lambda plugin
         builder-null         0.30.10 enabled    dokku core builder-null plugin
         builder-pack         0.30.10 enabled    dokku core builder-pack plugin
         buildpacks           0.30.10 enabled    dokku core buildpacks plugin
         caddy-vhosts         0.30.10 enabled    dokku core caddy-vhosts plugin
         certs                0.30.10 enabled    dokku core certificate management plugin
         checks               0.30.10 enabled    dokku core checks plugin
         common               0.30.10 enabled    dokku core common plugin
         config               0.30.10 enabled    dokku core config plugin
         cron                 0.30.10 enabled    dokku core cron plugin
         docker-options       0.30.10 enabled    dokku core docker-options plugin
         domains              0.30.10 enabled    dokku core domains plugin
         enter                0.30.10 enabled    dokku core enter plugin
         git                  0.30.10 enabled    dokku core git plugin
         haproxy-vhosts       0.30.10 enabled    dokku core haproxy-vhosts plugin
         logs                 0.30.10 enabled    dokku core logs plugin
         network              0.30.10 enabled    dokku core network plugin
         nginx-vhosts         0.30.10 enabled    dokku core nginx-vhosts plugin
         plugin               0.30.10 enabled    dokku core plugin plugin
         postgres             1.34.0 enabled    dokku postgres service plugin
         proxy                0.30.10 enabled    dokku core proxy plugin
         ps                   0.30.10 enabled    dokku core ps plugin
         redis                1.35.0 enabled    dokku redis service plugin
         registry             0.30.10 enabled    dokku core registry plugin
         repo                 0.30.10 enabled    dokku core repo plugin
         resource             0.30.10 enabled    dokku core resource plugin
         run                  0.30.10 enabled    dokku core run plugin
         scheduler            0.30.10 enabled    dokku core scheduler plugin
         scheduler-docker-local 0.30.10 enabled    dokku core scheduler-docker-local plugin
         scheduler-null       0.30.10 enabled    dokku core scheduler-null plugin
         shell                0.30.10 enabled    dokku core shell plugin
         ssh-keys             0.30.10 enabled    dokku core ssh-keys plugin
         storage              0.30.10 enabled    dokku core storage plugin
         trace                0.30.10 enabled    dokku core trace plugin
         traefik-vhosts       0.30.10 enabled    dokku core traefik-vhosts plugin

Additional information

Dokku version: 0.30.10

Output of dokku postgres:create test2:

ubuntu@ip-172-31-21-251:~$ sudo docker exec dokku dokku postgres:create test2
+ export DOKKU_HOST_ROOT=/var/lib/dokku/home/dokku
+ DOKKU_HOST_ROOT=/var/lib/dokku/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOCKER_BIN=/usr/local/bin/docker
+ DOCKER_BIN=/usr/local/bin/docker
+ export DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ export DOKKU_CNB_BUILDER=heroku/buildpacks:20
+ DOKKU_CNB_BUILDER=heroku/buildpacks:20
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_SYSTEM_GROUP=dokku
+ DOKKU_SYSTEM_GROUP=dokku
+ export DOKKU_SYSTEM_USER=dokku
+ DOKKU_SYSTEM_USER=dokku
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_PID=11187
+ DOKKU_PID=11187
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export 'DOKKU_GLOBAL_BUILD_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_BUILD_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ export 'DOKKU_GLOBAL_RUN_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_RUN_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args postgres:create test2
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ local flags
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ postgres:create == \-\-\a\p\p ]]
+ [[ postgres:create =~ ^--.* ]]
+ next_index=2
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ test2 == \-\-\a\p\p ]]
+ [[ test2 =~ ^--.* ]]
+ next_index=3
+ [[ -z '' ]]
++ sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
++ echo -e ''
+ export DOKKU_GLOBAL_FLAGS=
+ DOKKU_GLOBAL_FLAGS=
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ postgres:create =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
+ [[ '' == \t\r\u\e ]]
++ LC_ALL=C
++ /usr/bin/tty
++ true
+ [[ not a tty == \n\o\t\ \a\ \t\t\y ]]
+ return 1
+ DOKKU_QUIET_OUTPUT=1
++ id -un
+ [[ root != \d\o\k\k\u ]]
+ unset TMP TMPDIR TEMP TEMPDIR
+ [[ ! postgres:create =~ plugin:* ]]
+ [[ postgres:create != \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ postgres:create != \s\s\h\-\k\e\y\s\:\r\e\m\o\v\e ]]
++ id -un
+ export SSH_USER=root
+ SSH_USER=root
+ sudo -u dokku -E -H /usr/bin/dokku postgres:create test2
+ export DOKKU_HOST_ROOT=/var/lib/dokku/home/dokku
+ DOKKU_HOST_ROOT=/var/lib/dokku/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOCKER_BIN=/usr/local/bin/docker
+ DOCKER_BIN=/usr/local/bin/docker
+ export DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ export DOKKU_CNB_BUILDER=heroku/buildpacks:20
+ DOKKU_CNB_BUILDER=heroku/buildpacks:20
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_SYSTEM_GROUP=dokku
+ DOKKU_SYSTEM_GROUP=dokku
+ export DOKKU_SYSTEM_USER=dokku
+ DOKKU_SYSTEM_USER=dokku
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_PID=11201
+ DOKKU_PID=11201
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export 'DOKKU_GLOBAL_BUILD_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_BUILD_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ export 'DOKKU_GLOBAL_RUN_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_RUN_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args postgres:create test2
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ local flags
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ postgres:create == \-\-\a\p\p ]]
+ [[ postgres:create =~ ^--.* ]]
+ next_index=2
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ test2 == \-\-\a\p\p ]]
+ [[ test2 =~ ^--.* ]]
+ next_index=3
+ [[ -z '' ]]
++ sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
++ echo -e ''
+ export DOKKU_GLOBAL_FLAGS=
+ DOKKU_GLOBAL_FLAGS=
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ postgres:create =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
+ [[ '' == \t\r\u\e ]]
++ LC_ALL=C
++ /usr/bin/tty
++ true
+ [[ not a tty == \n\o\t\ \a\ \t\t\y ]]
+ return 1
+ DOKKU_QUIET_OUTPUT=1
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ postgres:create =~ ^plugin:.* ]]
+ [[ postgres:create == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ postgres:create == \s\s\h\-\k\e\y\s\:\r\e\m\o\v\e ]]
+ [[ -n '' ]]
+ dokku_auth postgres:create test2
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=root
+ SSH_USER=root
+ export SSH_NAME=default
+ SSH_NAME=default
+ export DOKKU_COMMAND=postgres:create
+ DOKKU_COMMAND=postgres:create
++ wc -l
++ find /var/lib/dokku/plugins/enabled/20_events/user-auth
+ local user_auth_count=1
+ [[ 1 == 0 ]]
+ [[ 1 == 1 ]]
+ [[ -f /var/lib/dokku/plugins/enabled/20_events/user-auth ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd postgres:create test2
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=postgres:create
+ local PLUGIN_CMD=postgres:create
+ local implemented=0
+ local script
+ argv=("$@")
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/postgres
+ [[ /var/lib/dokku/plugins/available/postgres == *core-plugins* ]]
+ [[ -x /var/lib/dokku/plugins/enabled/postgres:create/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/postgres:create/subcommands/postgres:create ]]
+ [[ -x /var/lib/dokku/plugins/enabled/postgres/subcommands/create ]]
+ [[ -n create ]]
+ /var/lib/dokku/plugins/enabled/postgres/subcommands/create postgres:create test2
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/postgres/subcommands/create
+++ cd /var/lib/dokku/plugins/enabled/postgres/subcommands
+++ pwd
++ dirname /var/lib/dokku/plugins/enabled/postgres/subcommands
+ source /var/lib/dokku/plugins/enabled/postgres/functions
++++ dirname /var/lib/dokku/plugins/enabled/postgres/functions
+++ cd /var/lib/dokku/plugins/enabled/postgres
+++ pwd
++ source /var/lib/dokku/plugins/enabled/postgres/config
+++++ dirname /var/lib/dokku/plugins/enabled/postgres/config
++++ cd /var/lib/dokku/plugins/enabled/postgres
++++ pwd
+++ _DIR=/var/lib/dokku/plugins/enabled/postgres
+++ export POSTGRES_IMAGE=postgres
+++ POSTGRES_IMAGE=postgres
+++ export POSTGRES_IMAGE_VERSION=15.3
+++ POSTGRES_IMAGE_VERSION=15.3
+++ export POSTGRES_ROOT=/var/lib/dokku/services/postgres
+++ POSTGRES_ROOT=/var/lib/dokku/services/postgres
+++ export DOKKU_LIB_HOST_ROOT=/var/lib/dokku/var/lib/dokku
+++ DOKKU_LIB_HOST_ROOT=/var/lib/dokku/var/lib/dokku
+++ export POSTGRES_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
+++ POSTGRES_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
+++ PLUGIN_UNIMPLEMENTED_SUBCOMMANDS=()
+++ export PLUGIN_UNIMPLEMENTED_SUBCOMMANDS
+++ export PLUGIN_COMMAND_PREFIX=postgres
+++ PLUGIN_COMMAND_PREFIX=postgres
+++ export PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/postgres
+++ PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/postgres
+++ export PLUGIN_DATA_ROOT=/var/lib/dokku/services/postgres
+++ PLUGIN_DATA_ROOT=/var/lib/dokku/services/postgres
+++ export PLUGIN_DATA_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
+++ PLUGIN_DATA_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
+++ PLUGIN_DATASTORE_PORTS=(5432)
+++ export PLUGIN_DATASTORE_PORTS
+++ export PLUGIN_DATASTORE_WAIT_PORT=5432
+++ PLUGIN_DATASTORE_WAIT_PORT=5432
+++ export PLUGIN_DEFAULT_ALIAS=DATABASE
+++ PLUGIN_DEFAULT_ALIAS=DATABASE
+++ export PLUGIN_DISABLE_PULL=
+++ PLUGIN_DISABLE_PULL=
+++ export PLUGIN_DISABLE_PULL_VARIABLE=POSTGRES_DISABLE_PULL
+++ PLUGIN_DISABLE_PULL_VARIABLE=POSTGRES_DISABLE_PULL
+++ export PLUGIN_ALT_ALIAS=DOKKU_POSTGRES
+++ PLUGIN_ALT_ALIAS=DOKKU_POSTGRES
+++ export PLUGIN_IMAGE=postgres
+++ PLUGIN_IMAGE=postgres
+++ export PLUGIN_IMAGE_VERSION=15.3
+++ PLUGIN_IMAGE_VERSION=15.3
+++ export PLUGIN_SCHEME=postgres
+++ PLUGIN_SCHEME=postgres
+++ export PLUGIN_SERVICE=Postgres
+++ PLUGIN_SERVICE=Postgres
+++ export PLUGIN_VARIABLE=POSTGRES
+++ PLUGIN_VARIABLE=POSTGRES
+++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins
+++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins
+++ export PLUGIN_CONFIG_SUFFIX=data
+++ PLUGIN_CONFIG_SUFFIX=data
+++ [[ -n 1 ]]
+++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
+++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
+++ export PLUGIN_BUSYBOX_IMAGE=busybox:1.34.1-uclibc
+++ PLUGIN_BUSYBOX_IMAGE=busybox:1.34.1-uclibc
+++ export PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.5.0
+++ PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.5.0
+++ export PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.14.0
+++ PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.14.0
+++ export PLUGIN_WAIT_IMAGE=dokku/wait:0.6.0
+++ PLUGIN_WAIT_IMAGE=dokku/wait:0.6.0
+++ export POSTGRES_CONFIG_OPTIONS=
+++ POSTGRES_CONFIG_OPTIONS=
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/postgres/functions
+++ cd /var/lib/dokku/plugins/enabled/postgres
+++ pwd
++ source /var/lib/dokku/plugins/enabled/postgres/common-functions
+++++ dirname /var/lib/dokku/plugins/enabled/postgres/common-functions
++++ cd /var/lib/dokku/plugins/enabled/postgres
++++ pwd
+++ source /var/lib/dokku/plugins/enabled/postgres/config
++++++ dirname /var/lib/dokku/plugins/enabled/postgres/config
+++++ cd /var/lib/dokku/plugins/enabled/postgres
+++++ pwd
++++ _DIR=/var/lib/dokku/plugins/enabled/postgres
++++ export POSTGRES_IMAGE=postgres
++++ POSTGRES_IMAGE=postgres
++++ export POSTGRES_IMAGE_VERSION=15.3
++++ POSTGRES_IMAGE_VERSION=15.3
++++ export POSTGRES_ROOT=/var/lib/dokku/services/postgres
++++ POSTGRES_ROOT=/var/lib/dokku/services/postgres
++++ export DOKKU_LIB_HOST_ROOT=/var/lib/dokku/var/lib/dokku
++++ DOKKU_LIB_HOST_ROOT=/var/lib/dokku/var/lib/dokku
++++ export POSTGRES_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
++++ POSTGRES_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
++++ PLUGIN_UNIMPLEMENTED_SUBCOMMANDS=()
++++ export PLUGIN_UNIMPLEMENTED_SUBCOMMANDS
++++ export PLUGIN_COMMAND_PREFIX=postgres
++++ PLUGIN_COMMAND_PREFIX=postgres
++++ export PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/postgres
++++ PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/postgres
++++ export PLUGIN_DATA_ROOT=/var/lib/dokku/services/postgres
++++ PLUGIN_DATA_ROOT=/var/lib/dokku/services/postgres
++++ export PLUGIN_DATA_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
++++ PLUGIN_DATA_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres
++++ PLUGIN_DATASTORE_PORTS=(5432)
++++ export PLUGIN_DATASTORE_PORTS
++++ export PLUGIN_DATASTORE_WAIT_PORT=5432
++++ PLUGIN_DATASTORE_WAIT_PORT=5432
++++ export PLUGIN_DEFAULT_ALIAS=DATABASE
++++ PLUGIN_DEFAULT_ALIAS=DATABASE
++++ export PLUGIN_DISABLE_PULL=
++++ PLUGIN_DISABLE_PULL=
++++ export PLUGIN_DISABLE_PULL_VARIABLE=POSTGRES_DISABLE_PULL
++++ PLUGIN_DISABLE_PULL_VARIABLE=POSTGRES_DISABLE_PULL
++++ export PLUGIN_ALT_ALIAS=DOKKU_POSTGRES
++++ PLUGIN_ALT_ALIAS=DOKKU_POSTGRES
++++ export PLUGIN_IMAGE=postgres
++++ PLUGIN_IMAGE=postgres
++++ export PLUGIN_IMAGE_VERSION=15.3
++++ PLUGIN_IMAGE_VERSION=15.3
++++ export PLUGIN_SCHEME=postgres
++++ PLUGIN_SCHEME=postgres
++++ export PLUGIN_SERVICE=Postgres
++++ PLUGIN_SERVICE=Postgres
++++ export PLUGIN_VARIABLE=POSTGRES
++++ PLUGIN_VARIABLE=POSTGRES
++++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins
++++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins
++++ export PLUGIN_CONFIG_SUFFIX=data
++++ PLUGIN_CONFIG_SUFFIX=data
++++ [[ -n 1 ]]
++++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
++++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
++++ export PLUGIN_BUSYBOX_IMAGE=busybox:1.34.1-uclibc
++++ PLUGIN_BUSYBOX_IMAGE=busybox:1.34.1-uclibc
++++ export PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.5.0
++++ PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.5.0
++++ export PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.14.0
++++ PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.14.0
++++ export PLUGIN_WAIT_IMAGE=dokku/wait:0.6.0
++++ PLUGIN_WAIT_IMAGE=dokku/wait:0.6.0
++++ export POSTGRES_CONFIG_OPTIONS=
++++ POSTGRES_CONFIG_OPTIONS=
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/property-functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+++ source /var/lib/dokku/plugins/available/config/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++++ source /var/lib/dokku/core-plugins/available/common/functions
+++++ set -eo pipefail
+++++ [[ -n 1 ]]
+++++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/core-plugins/available/common/property-functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ [[ -f /var/lib/dokku/plugins/available/docker-options/functions ]]
++ source /var/lib/dokku/plugins/available/docker-options/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+++ AVAILABLE_PHASES=(build deploy run)
+ service-create-cmd postgres:create test2
+ declare 'desc=create a Postgres service'
+ argv=("$@")
+ local cmd=postgres:create argv
+ [[ postgres:create == \p\o\s\t\g\r\e\s\:\c\r\e\a\t\e ]]
+ shift 1
+ CREATE_FLAGS_LIST=("${@:2}")
+ declare SERVICE=test2 CREATE_FLAGS_LIST
+ service_create test2
+ local SERVICE=test2
+ is_valid_service_name test2
+ declare 'desc=validate a service name'
+ declare SERVICE=test2
+ [[ -z test2 ]]
+ [[ test2 =~ ^[A-Za-z0-9_-]+$ ]]
+ return 0
+ [[ -z test2 ]]
+ [[ ! -d /var/lib/dokku/services/postgres/test2 ]]
+ SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+ LINKS_FILE=/var/lib/dokku/services/postgres/test2/LINKS
+ service_parse_args
+ declare 'desc=cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ OPTIND=1
+ getopts na:c:C:d:i:I:m:n:N:p:P:q:R:r:s:S:u: opt
+ shift 0
+ service_image_exists test2
+ declare 'desc=check if the current image exists'
+ declare SERVICE=test2 PLUGIN_IMAGE=postgres PLUGIN_IMAGE_VERSION=15.3
+ local plugin_image=postgres
+ local plugin_image_version=15.3
+ [[ -z postgres ]]
+ [[ -z 15.3 ]]
+ local IMAGE=postgres:15.3
++ /usr/local/bin/docker image ls -q postgres:15.3
+ [[ 8769343ac885 == '' ]]
+ return 0
+ plugn trigger service-action pre-create postgres test2
+ mkdir -p /var/lib/dokku/services/postgres/test2
+ mkdir -p /var/lib/dokku/services/postgres/test2/data
+ touch /var/lib/dokku/services/postgres/test2/LINKS
++ openssl rand -hex 16
+ PASSWORD=3eb640c60561d85ae8f9afc3148bb45d
+ [[ -n '' ]]
+ echo 3eb640c60561d85ae8f9afc3148bb45d
+ chmod 640 /var/lib/dokku/services/postgres/test2/PASSWORD
+ service_commit_config test2
+ declare SERVICE=test2
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+ local CONFIG_VARIABLE=POSTGRES_CONFIG_OPTIONS
+ local ENV_VARIABLE=POSTGRES_CUSTOM_ENV
+ custom_env=
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo ''
+ config_options=
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo ''
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n postgres ]]
+ echo postgres
+ [[ -n 15.3 ]]
+ echo 15.3
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ write_database_name test2
+ declare 'desc=write a sanitized database name'
+ declare SERVICE=test2
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+ tr .- _
+ echo test2
+ plugn trigger service-action post-create postgres test2
+ service_create_container test2
+ local SERVICE=test2
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+ local SERVICE_HOST_ROOT=/var/lib/dokku/var/lib/dokku/services/postgres/test2
++ get_service_name test2
++ declare 'desc=retrieve a docker service label'
++ declare SERVICE=test2
++ echo dokku.postgres.test2
+ local SERVICE_NAME=dokku.postgres.test2
++ service_password test2
++ declare 'desc=fetch the password for a service'
++ declare SERVICE=test2
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
++ local PASSWORD_FILE=/var/lib/dokku/services/postgres/test2/PASSWORD
++ [[ -f /var/lib/dokku/services/postgres/test2/PASSWORD ]]
++ cat /var/lib/dokku/services/postgres/test2/PASSWORD
+ local PASSWORD=3eb640c60561d85ae8f9afc3148bb45d
++ get_database_name test2
++ declare 'desc=retrieve a sanitized database name'
++ declare SERVICE=test2
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
++ [[ ! -f /var/lib/dokku/services/postgres/test2/DATABASE_NAME ]]
++ cat /var/lib/dokku/services/postgres/test2/DATABASE_NAME
+ local DATABASE_NAME=test2
+ local PREVIOUS_ID
+ [[ -f /var/lib/dokku/services/postgres/test2/CONFIG_OPTIONS ]]
++ cat /var/lib/dokku/services/postgres/test2/CONFIG_OPTIONS
+ export CONFIG_OPTIONS=
+ CONFIG_OPTIONS=
++ service_dns_hostname test2
++ declare 'desc=retrieve the alias of a service'
++ declare SERVICE=test2
+++ get_service_name test2
+++ declare 'desc=retrieve a docker service label'
+++ declare SERVICE=test2
+++ echo dokku.postgres.test2
++ local SERVICE_NAME=dokku.postgres.test2
++ tr ._ -
++ echo dokku.postgres.test2
+ local network_alias=dokku-postgres-test2
+ rm -f /var/lib/dokku/services/postgres/test2/ID
+ declare -a DOCKER_ARGS
+ DOCKER_ARGS=()
+ DOCKER_ARGS+=("--cidfile=$SERVICE_ROOT/ID")
+ DOCKER_ARGS+=("--env-file=$SERVICE_ROOT/ENV")
+ DOCKER_ARGS+=("--env=POSTGRES_PASSWORD=$PASSWORD")
+ DOCKER_ARGS+=("--hostname=$SERVICE_NAME")
+ DOCKER_ARGS+=("--label=dokku.service=$PLUGIN_COMMAND_PREFIX")
+ DOCKER_ARGS+=("--label=dokku=service")
+ DOCKER_ARGS+=("--name=$SERVICE_NAME")
+ DOCKER_ARGS+=("--restart=always")
+ DOCKER_ARGS+=("--volume=$SERVICE_HOST_ROOT/data:/var/lib/postgresql/data")
+ declare -a LINK_CONTAINER_DOCKER_ARGS
+ LINK_CONTAINER_DOCKER_ARGS=()
+ LINK_CONTAINER_DOCKER_ARGS+=("--rm")
+ LINK_CONTAINER_DOCKER_ARGS+=("--link")
+ LINK_CONTAINER_DOCKER_ARGS+=("$SERVICE_NAME:$network_alias")
+ [[ -f /var/lib/dokku/services/postgres/test2/SERVICE_MEMORY ]]
+ [[ -n '' ]]
+ [[ -f /var/lib/dokku/services/postgres/test2/SHM_SIZE ]]
+ [[ -n '' ]]
+ [[ -f /var/lib/dokku/services/postgres/test2/IMAGE ]]
++ cat /var/lib/dokku/services/postgres/test2/IMAGE
+ PLUGIN_IMAGE=postgres
+ [[ -f /var/lib/dokku/services/postgres/test2/IMAGE_VERSION ]]
++ cat /var/lib/dokku/services/postgres/test2/IMAGE_VERSION
+ PLUGIN_IMAGE_VERSION=15.3
++ fn-plugin-property-get postgres test2 initial-network
++ declare 'desc=returns the value for a given property'
++ declare PLUGIN=postgres APP=test2 KEY=initial-network DEFAULT=
++ fn-plugin-property-get-default postgres test2 initial-network ''
++ declare 'desc=returns the value for a given property with a specified default value'
++ declare PLUGIN=postgres APP=test2 KEY=initial-network DEFAULT=
++ /var/lib/dokku/core-plugins/available/common/prop get-with-default postgres test2 initial-network ''
+ local network=
+ [[ -n '' ]]
+ suppress_output /usr/local/bin/docker container create --cidfile=/var/lib/dokku/services/postgres/test2/ID --env-file=/var/lib/dokku/services/postgres/test2/ENV --env=POSTGRES_PASSWORD=3eb640c60561d85ae8f9afc3148bb45d --hostname=dokku.postgres.test2 --label=dokku.service=postgres --label=dokku=service --name=dokku.postgres.test2 --restart=always --volume=/var/lib/dokku/var/lib/dokku/services/postgres/test2/data:/var/lib/postgresql/data postgres:15.3
+ declare 'desc=suppress all output from a given command unless there is an error'
+ local TMP_COMMAND_OUTPUT
++ mktemp /tmp/dokku-11201-suppress_output.XXXXXX
+ TMP_COMMAND_OUTPUT=/tmp/dokku-11201-suppress_output.xIAulB
+ trap 'rm -rf '\''/tmp/dokku-11201-suppress_output.xIAulB'\'' >/dev/null' RETURN
+ /usr/local/bin/docker container create --cidfile=/var/lib/dokku/services/postgres/test2/ID --env-file=/var/lib/dokku/services/postgres/test2/ENV --env=POSTGRES_PASSWORD=3eb640c60561d85ae8f9afc3148bb45d --hostname=dokku.postgres.test2 --label=dokku.service=postgres --label=dokku=service --name=dokku.postgres.test2 --restart=always --volume=/var/lib/dokku/var/lib/dokku/services/postgres/test2/data:/var/lib/postgresql/data postgres:15.3
+ return 0
++ rm -rf /tmp/dokku-11201-suppress_output.xIAulB
++ fn-plugin-property-get postgres test2 post-create-network
++ declare 'desc=returns the value for a given property'
++ declare PLUGIN=postgres APP=test2 KEY=post-create-network DEFAULT=
++ fn-plugin-property-get-default postgres test2 post-create-network ''
++ declare 'desc=returns the value for a given property with a specified default value'
++ declare PLUGIN=postgres APP=test2 KEY=post-create-network DEFAULT=
++ /var/lib/dokku/core-plugins/available/common/prop get-with-default postgres test2 post-create-network ''
+ [[ -n '' ]]
++ cat /var/lib/dokku/services/postgres/test2/ID
+ suppress_output /usr/local/bin/docker container start 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ declare 'desc=suppress all output from a given command unless there is an error'
+ local TMP_COMMAND_OUTPUT
++ mktemp /tmp/dokku-11201-suppress_output.XXXXXX
+ TMP_COMMAND_OUTPUT=/tmp/dokku-11201-suppress_output.7VOO8Z
+ trap 'rm -rf '\''/tmp/dokku-11201-suppress_output.7VOO8Z'\'' >/dev/null' RETURN
+ /usr/local/bin/docker container start 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ return 0
++ rm -rf /tmp/dokku-11201-suppress_output.7VOO8Z
+ service_port_reconcile_status test2
+ declare SERVICE=test2
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+ local PORT_FILE=/var/lib/dokku/services/postgres/test2/PORT
++ get_service_name test2
++ declare 'desc=retrieve a docker service label'
++ declare SERVICE=test2
++ echo dokku.postgres.test2
+ local SERVICE_NAME=dokku.postgres.test2
+ local EXPOSED_NAME=dokku.postgres.test2.ambassador
+ [[ ! -s /var/lib/dokku/services/postgres/test2/PORT ]]
+ /usr/local/bin/docker container inspect dokku.postgres.test2.ambassador
+ return
++ fn-plugin-property-get postgres test2 post-start-network
++ declare 'desc=returns the value for a given property'
++ declare PLUGIN=postgres APP=test2 KEY=post-start-network DEFAULT=
++ fn-plugin-property-get-default postgres test2 post-start-network ''
++ declare 'desc=returns the value for a given property with a specified default value'
++ declare PLUGIN=postgres APP=test2 KEY=post-start-network DEFAULT=
++ /var/lib/dokku/core-plugins/available/common/prop get-with-default postgres test2 post-start-network ''
+ [[ -n '' ]]
+ dokku_log_verbose_quiet 'Waiting for container to be ready'
+ declare 'desc=log verbose formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '       Waiting for container to be ready'
       Waiting for container to be ready
+ suppress_output /usr/local/bin/docker container run --rm --link dokku.postgres.test2:dokku-postgres-test2 dokku/wait:0.6.0 -c dokku-postgres-test2:5432
+ declare 'desc=suppress all output from a given command unless there is an error'
+ local TMP_COMMAND_OUTPUT
++ mktemp /tmp/dokku-11201-suppress_output.XXXXXX
+ TMP_COMMAND_OUTPUT=/tmp/dokku-11201-suppress_output.thU99o
+ trap 'rm -rf '\''/tmp/dokku-11201-suppress_output.thU99o'\'' >/dev/null' RETURN
+ /usr/local/bin/docker container run --rm --link dokku.postgres.test2:dokku-postgres-test2 dokku/wait:0.6.0 -c dokku-postgres-test2:5432
+ return 0
++ rm -rf /tmp/dokku-11201-suppress_output.thU99o
+ dokku_log_verbose_quiet 'Creating container database'
+ declare 'desc=log verbose formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '       Creating container database'
       Creating container database
+ /usr/local/bin/docker container exec dokku.postgres.test2 su - postgres -c 'createdb -E utf8 test2'
       Securing connection to database
+ dokku_log_verbose_quiet 'Securing connection to database'
+ declare 'desc=log verbose formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '       Securing connection to database'
+ service_pause test2
+ declare 'desc=pause a running service'
+ declare SERVICE=test2
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
++ get_service_name test2
++ declare 'desc=retrieve a docker service label'
++ declare SERVICE=test2
++ echo dokku.postgres.test2
+ local SERVICE_NAME=dokku.postgres.test2
++ /usr/local/bin/docker container ps -aq --no-trunc --filter 'name=^/dokku.postgres.test2$'
+ local ID=665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ [[ -z 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e ]]
+ [[ -n 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e ]]
+ dokku_log_info2_quiet 'Pausing container'
+ declare 'desc=log info2 formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '=====> Pausing container'
+ /usr/local/bin/docker container stop dokku.postgres.test2
+ /usr/local/bin/docker container inspect 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ /usr/local/bin/docker container stop dokku.postgres.test2.ambassador
+ true
+ dokku_log_verbose_quiet 'Container paused'
+ declare 'desc=log verbose formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '       Container paused'
+++ dirname /var/lib/dokku/plugins/enabled/postgres/functions
++ cd /var/lib/dokku/plugins/enabled/postgres
++ pwd
+ /var/lib/dokku/plugins/enabled/postgres/scripts/create_ssl_certs.sh /var/lib/dokku/var/lib/dokku/services/postgres/test2
+ /usr/local/bin/docker container run --rm -i -v /var/lib/dokku/var/lib/dokku/services/postgres/test2/data:/var/lib/postgresql/data -v /var/lib/dokku/var/lib/dokku/services/postgres/test2/certs:/var/lib/postgresql/certs postgres:15.3 bash -s
+++ dirname /var/lib/dokku/plugins/enabled/postgres/functions
++ cd /var/lib/dokku/plugins/enabled/postgres
++ pwd
+ rm -rf /var/lib/dokku/var/lib/dokku/services/postgres/test2/certs
++ cat /var/lib/dokku/services/postgres/test2/ID
+ suppress_output /usr/local/bin/docker container start 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ declare 'desc=suppress all output from a given command unless there is an error'
+ local TMP_COMMAND_OUTPUT
++ mktemp /tmp/dokku-11201-suppress_output.XXXXXX
+ TMP_COMMAND_OUTPUT=/tmp/dokku-11201-suppress_output.s8rH4X
+ trap 'rm -rf '\''/tmp/dokku-11201-suppress_output.s8rH4X'\'' >/dev/null' RETURN
+ /usr/local/bin/docker container start 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ return 0
++ rm -rf /tmp/dokku-11201-suppress_output.s8rH4X
+ service_port_reconcile_status test2
+ declare SERVICE=test2
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+ local PORT_FILE=/var/lib/dokku/services/postgres/test2/PORT
++ get_service_name test2
++ declare 'desc=retrieve a docker service label'
++ declare SERVICE=test2
++ echo dokku.postgres.test2
+ local SERVICE_NAME=dokku.postgres.test2
+ local EXPOSED_NAME=dokku.postgres.test2.ambassador
+ [[ ! -s /var/lib/dokku/services/postgres/test2/PORT ]]
+ /usr/local/bin/docker container inspect dokku.postgres.test2.ambassador
+ return
+ dokku_log_info2 'Postgres container created: test2'
+ declare 'desc=log info2 formatter'
+ echo '=====> Postgres container created: test2'
=====> Postgres container created: test2
+ service_info test2
+ declare 'desc=retrieve information about a given service'
+ declare SERVICE=test2 INFO_FLAG=
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
++ service_url test2
++ local SERVICE=test2
+++ service_dns_hostname test2
+++ declare 'desc=retrieve the alias of a service'
+++ declare SERVICE=test2
++++ get_service_name test2
++++ declare 'desc=retrieve a docker service label'
++++ declare SERVICE=test2
++++ echo dokku.postgres.test2
+++ local SERVICE_NAME=dokku.postgres.test2
+++ tr ._ -
+++ echo dokku.postgres.test2
++ local SERVICE_DNS_HOSTNAME=dokku-postgres-test2
+++ get_database_name test2
+++ declare 'desc=retrieve a sanitized database name'
+++ declare SERVICE=test2
+++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+++ [[ ! -f /var/lib/dokku/services/postgres/test2/DATABASE_NAME ]]
+++ cat /var/lib/dokku/services/postgres/test2/DATABASE_NAME
++ local DATABASE_NAME=test2
+++ service_password test2
+++ declare 'desc=fetch the password for a service'
+++ declare SERVICE=test2
+++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+++ local PASSWORD_FILE=/var/lib/dokku/services/postgres/test2/PASSWORD
+++ [[ -f /var/lib/dokku/services/postgres/test2/PASSWORD ]]
+++ cat /var/lib/dokku/services/postgres/test2/PASSWORD
++ local PASSWORD=3eb640c60561d85ae8f9afc3148bb45d
++ echo postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2
+ local SERVICE_URL=postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2
+ local PORT_FILE=/var/lib/dokku/services/postgres/test2/PORT
++ cat /var/lib/dokku/services/postgres/test2/ID
+ local SERVICE_CONTAINER_ID=665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ local flag key valid_flags
+ flag_map=("--config-dir: ${SERVICE_ROOT}/${PLUGIN_CONFIG_SUFFIX}" "--config-options: $(cat "$SERVICE_ROOT/CONFIG_OPTIONS" 2>/dev/null || true)" "--data-dir: ${SERVICE_ROOT}/data" "--dsn: ${SERVICE_URL}" "--exposed-ports: $(service_exposed_ports "$SERVICE")" "--id: ${SERVICE_CONTAINER_ID}" "--internal-ip: $(get_container_ip "${SERVICE_CONTAINER_ID}")" "--initial-network: $(fn-plugin-property-get "$PLUGIN_COMMAND_PREFIX" "$SERVICE" "initial-network")" "--links: $(service_linked_apps "$SERVICE")" "--post-create-network: $(fn-plugin-property-get "$PLUGIN_COMMAND_PREFIX" "$SERVICE" "post-create-network")" "--post-start-network: $(fn-plugin-property-get "$PLUGIN_COMMAND_PREFIX" "$SERVICE" "post-start-network")" "--service-root: ${SERVICE_ROOT}" "--status: $(service_status "$SERVICE")" "--version: $(service_version "$SERVICE")")
++ cat /var/lib/dokku/services/postgres/test2/CONFIG_OPTIONS
++ service_exposed_ports test2
++ declare 'desc=list exposed ports for a service'
++ declare SERVICE=test2
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
++ local PORT_FILE=/var/lib/dokku/services/postgres/test2/PORT
++ [[ ! -f /var/lib/dokku/services/postgres/test2/PORT ]]
++ echo -
++ return 0
++ get_container_ip 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
++ declare 'desc=retrieve the ip address of a container'
++ declare CONTAINER_ID=665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
++ /usr/local/bin/docker container inspect --format '{{ .NetworkSettings.IPAddress }}' 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
++ fn-plugin-property-get postgres test2 initial-network
++ declare 'desc=returns the value for a given property'
++ declare PLUGIN=postgres APP=test2 KEY=initial-network DEFAULT=
++ fn-plugin-property-get-default postgres test2 initial-network ''
++ declare 'desc=returns the value for a given property with a specified default value'
++ declare PLUGIN=postgres APP=test2 KEY=initial-network DEFAULT=
++ /var/lib/dokku/core-plugins/available/common/prop get-with-default postgres test2 initial-network ''
++ service_linked_apps test2
++ declare 'desc=list all apps linked to a service for info output'
++ declare SERVICE=test2
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
++ local LINKS_FILE=/var/lib/dokku/services/postgres/test2/LINKS
++ touch /var/lib/dokku/services/postgres/test2/LINKS
++ [[ -z '' ]]
++ echo -
++ return 0
++ fn-plugin-property-get postgres test2 post-create-network
++ declare 'desc=returns the value for a given property'
++ declare PLUGIN=postgres APP=test2 KEY=post-create-network DEFAULT=
++ fn-plugin-property-get-default postgres test2 post-create-network ''
++ declare 'desc=returns the value for a given property with a specified default value'
++ declare PLUGIN=postgres APP=test2 KEY=post-create-network DEFAULT=
++ /var/lib/dokku/core-plugins/available/common/prop get-with-default postgres test2 post-create-network ''
++ fn-plugin-property-get postgres test2 post-start-network
++ declare 'desc=returns the value for a given property'
++ declare PLUGIN=postgres APP=test2 KEY=post-start-network DEFAULT=
++ fn-plugin-property-get-default postgres test2 post-start-network ''
++ declare 'desc=returns the value for a given property with a specified default value'
++ declare PLUGIN=postgres APP=test2 KEY=post-start-network DEFAULT=
++ /var/lib/dokku/core-plugins/available/common/prop get-with-default postgres test2 post-start-network ''
++ service_status test2
++ declare 'desc=display the status of a service'
++ declare SERVICE=test2
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test2
+++ cat /var/lib/dokku/services/postgres/test2/ID
++ local ID=665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
++ local CONTAINER_STATUS
+++ /usr/local/bin/docker container inspect -f '{{.State.Status}}' 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
++ CONTAINER_STATUS=running
++ [[ -n running ]]
++ echo running
++ return 0
++ service_version test2
++ declare 'desc=display the running version for an image'
++ declare SERVICE=test2
+++ get_service_name test2
+++ declare 'desc=retrieve a docker service label'
+++ declare SERVICE=test2
+++ echo dokku.postgres.test2
++ local SERVICE_NAME=dokku.postgres.test2
++ /usr/local/bin/docker container inspect -f '{{.Config.Image}}' dokku.postgres.test2
+ local flag_map
+ [[ -z '' ]]
+ dokku_log_info2_quiet 'test2 postgres service information'
+ declare 'desc=log info2 formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '=====> test2 postgres service information'
=====> test2 postgres service information
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'config-dir: /var/lib/dokku/services/postgres/test2/data'
+ key='config dir:'
++ printf '%-20s %-25s' 'Config dir:' /var/lib/dokku/services/postgres/test2/data
+ dokku_log_verbose 'Config dir:          /var/lib/dokku/services/postgres/test2/data'
+ declare 'desc=log verbose formatter'
+ echo '       Config dir:          /var/lib/dokku/services/postgres/test2/data'
       Config dir:          /var/lib/dokku/services/postgres/test2/data
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'config-options: '
+ key='config options:'
++ printf '%-20s %-25s' 'Config options:' ''
+ dokku_log_verbose 'Config options:                               '
+ declare 'desc=log verbose formatter'
+ echo '       Config options:                               '
       Config options:
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'data-dir: /var/lib/dokku/services/postgres/test2/data'
+ key='data dir:'
++ printf '%-20s %-25s' 'Data dir:' /var/lib/dokku/services/postgres/test2/data
       Data dir:            /var/lib/dokku/services/postgres/test2/data
+ dokku_log_verbose 'Data dir:            /var/lib/dokku/services/postgres/test2/data'
+ declare 'desc=log verbose formatter'
+ echo '       Data dir:            /var/lib/dokku/services/postgres/test2/data'
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'dsn: postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2'
+ key=dsn:
++ printf '%-20s %-25s' Dsn: postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2
       Dsn:                 postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2
+ dokku_log_verbose 'Dsn:                 postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2'
+ declare 'desc=log verbose formatter'
+ echo '       Dsn:                 postgres://postgres:3eb640c60561d85ae8f9afc3148bb45d@dokku-postgres-test2:5432/test2'
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'exposed-ports: -'
       Exposed ports:       -
+ key='exposed ports:'
++ printf '%-20s %-25s' 'Exposed ports:' -
+ dokku_log_verbose 'Exposed ports:       -                        '
+ declare 'desc=log verbose formatter'
+ echo '       Exposed ports:       -                        '
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'id: 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e'
       Id:                  665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ key=id:
++ printf '%-20s %-25s' Id: 665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e
+ dokku_log_verbose 'Id:                  665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e'
+ declare 'desc=log verbose formatter'
+ echo '       Id:                  665b3a4dd54d5186c70690122c1f65297a24a2926cb646be70e3153afa106a4e'
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
       Internal ip:
++ echo 'internal-ip: '
+ key='internal ip:'
++ printf '%-20s %-25s' 'Internal ip:' ''
+ dokku_log_verbose 'Internal ip:                                  '
+ declare 'desc=log verbose formatter'
+ echo '       Internal ip:                                  '
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'initial-network: '
+ key='initial network:'
++ printf '%-20s %-25s' 'Initial network:' ''
+ dokku_log_verbose 'Initial network:                              '
+ declare 'desc=log verbose formatter'
+ echo '       Initial network:                              '
       Initial network:
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'links: -'
+ key=links:
++ printf '%-20s %-25s' Links: -
+ dokku_log_verbose 'Links:               -                        '
+ declare 'desc=log verbose formatter'
+ echo '       Links:               -                        '
       Links:               -
+ for flag in "${flag_map[@]}"
++ cut -f1 '-d '
++ echo 'post-create-network: '
++ tr - ' '
+ key='post create network:'
++ printf '%-20s %-25s' 'Post create network:' ''
+ dokku_log_verbose 'Post create network:                          '
+ declare 'desc=log verbose formatter'
+ echo '       Post create network:                          '
       Post create network:
+ for flag in "${flag_map[@]}"
++ echo 'post-start-network: '
++ cut -f1 '-d '
++ tr - ' '
+ key='post start network:'
++ printf '%-20s %-25s' 'Post start network:' ''
+ dokku_log_verbose 'Post start network:                           '
+ declare 'desc=log verbose formatter'
+ echo '       Post start network:                           '
       Post start network:
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'service-root: /var/lib/dokku/services/postgres/test2'
+ key='service root:'
++ printf '%-20s %-25s' 'Service root:' /var/lib/dokku/services/postgres/test2
+ dokku_log_verbose 'Service root:        /var/lib/dokku/services/postgres/test2'
+ declare 'desc=log verbose formatter'
+ echo '       Service root:        /var/lib/dokku/services/postgres/test2'
       Service root:        /var/lib/dokku/services/postgres/test2
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'status: running'
+ key=status:
++ printf '%-20s %-25s' Status: running
+ dokku_log_verbose 'Status:              running                  '
+ declare 'desc=log verbose formatter'
+ echo '       Status:              running                  '
       Status:              running
+ for flag in "${flag_map[@]}"
++ tr - ' '
++ cut -f1 '-d '
++ echo 'version: postgres:15.3'
+ key=version:
++ printf '%-20s %-25s' Version: postgres:15.3
+ dokku_log_verbose 'Version:             postgres:15.3            '
+ declare 'desc=log verbose formatter'
+ echo '       Version:             postgres:15.3            '
       Version:             postgres:15.3
++ rm -rf /tmp/dokku-11201-suppress_output.s8rH4X
+ plugn trigger service-action post-create-complete postgres test2
++ rm -rf /tmp/dokku-11201-suppress_output.s8rH4X
++ rm -rf /tmp/dokku-11201-suppress_output.s8rH4X
+ implemented=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -eq 0 ]]
+ exit 0

I wonder if this doesn't work because the mounted path for server.crt isnt the same on the host for docker-based installs.

Maybe?

Dokku on docker mounts the /var/lib/dokku directory in /mnt/dokku inside the container.

From the docs, the startup command is:

docker container run \
  --env DOKKU_HOSTNAME=dokku.me \
  --env DOKKU_HOST_ROOT=/var/lib/dokku/home/dokku \
  --env DOKKU_LIB_HOST_ROOT=/var/lib/dokku/var/lib/dokku \
  --name dokku \
  --publish 3022:22 \
  --publish 8080:80 \
  --publish 8443:443 \
  --volume /var/lib/dokku:/mnt/dokku \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  dokku/dokku:0.30.10

After a short look, the problem was introduced in this PR:

#260

The error is here:
https://github.com/dokku/dokku-postgres/pull/260/files#diff-edc2d49bc616ba015b53812dab17c94cbb85dd694d9f08b82e5cd8ec8467c378R5

the cd command fails silently because there's no set -e, and the key is created in the current directory.

The cd fails because postgres_service_dir is set to /var/lib/dokku/var/lib/dokku/services/[name_of_db], that doesn't exist.

... but, why is the folder /var/lib/dokku/var/lib/dokku in the first place? Is this a bug?

PR upcoming if I figure this out.

TL;DR if you need this to work, just use an older version of the plugin (i.e. 1.33.1)

The first service host Roy should probably be service root.