dokku / dokku-postgres

a postgres plugin for dokku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database not created on Ubuntu 20.04 ARM64

lsorba opened this issue · comments

Description of problem

dokku postgres:create creates the docker container, runs well together with an app but the database is not created automatically.

I mentionned it first here dokku/dokku#4974 (comment)

How reproducible

Always on Ubuntu 20.04 arm64, the following gives the same result

  • dokku postgres:create test
  • dokku postgres:create test --image "arm64v8/postgres
  • dokku postgres:create test --custom-env "LC_ALL=C.UTF-8"
       Waiting for container to be ready
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error

Steps to Reproduce

  1. dokku postgres:create test
  2. dokku postgres:enter test
  3. psql -U postgres
  4. \l

Actual Results

                                 List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
-----------+----------+----------+------------+------------+-----------------------
 postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
(3 rows)

Expected Results

                                 List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
-----------+----------+----------+------------+------------+-----------------------
 postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 test  | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 

Environment Information

dokku report output

-----> uname: Linux instance-20211211-1425 5.13.0-1021-oracle #26~20.04.1-Ubuntu SMP Mon Mar 7 14:30:17 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

How (deb/make/rpm) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:

Oracle Cloud Ampere / Ubuntu 20.04

wget https://raw.githubusercontent.com/dokku/dokku/v0.27.0/bootstrap.sh
sudo DOKKU_TAG=v0.27.0 bash bootstrap.sh

Additional information

ubuntu@instance:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal
        Kernel Version: 5.13.0-1021-oracle
        Operating System: Ubuntu 20.04.4 LTS
        OSType: linux
        Architecture: aarch64
        CPUs: 1
ubuntu@instance:~$ env
SHELL=/bin/bash
PWD=/home/ubuntu
LOGNAME=ubuntu
HOME=/home/ubuntu
LANG=C.UTF-8

Image forced to arm64v8

dokku postgres:create test --image "arm64v8/postgres"  --image-version "14"
ubuntu@instance-20211211-1425:~$ dokku postgres:info test
=====> test postgres service information
       Config dir:          /var/lib/dokku/services/postgres/test/data
       Config options:                               
       Data dir:            /var/lib/dokku/services/postgres/test/data
       Dsn:                 postgres://postgres:8d0d181d18924562f498da868a5a7588@dokku-postgres-test:5432/test
       Exposed ports:       -                        
       Id:                  2dfcc44fa72ab5f1faeba4e571b3adae7d208be0db91abfbe0d28d15676dfd25
       Internal ip:         172.17.0.3               
       Links:               -                        
       Service root:        /var/lib/dokku/services/postgres/test
       Status:              running                  
       Version:             arm64v8/postgres:14    

ubuntu@instance:~$ dokku postgres:enter test
-----> Filesystem changes may not persist after container restarts
root@2dfcc44fa72a:/# uname -a
Linux 2dfcc44fa72a 5.13.0-1021-oracle #26~20.04.1-Ubuntu SMP Mon Mar 7 14:30:17 UTC 2022 aarch64 GNU/Linux

Image chosen by docker (arm64)

dokku postgres:create test2
ubuntu@instance:~$ dokku postgres:info test2
=====> test2 postgres service information
       Config dir:          /var/lib/dokku/services/postgres/test2/data
       Config options:                               
       Data dir:            /var/lib/dokku/services/postgres/test2/data
       Dsn:                 postgres://postgres:02b6852e62a4d76a08e0497ee019946f@dokku-postgres-test2:5432/test2
       Exposed ports:       -                        
       Id:                  26fe657ab463e0afc0d35f18450990e2da2c548afe59b3380a7a8b1eab891541
       Internal ip:         172.17.0.5               
       Links:               -                        
       Service root:        /var/lib/dokku/services/postgres/test2
       Status:              running                  
       Version:             postgres:14.1 

ubuntu@instance:~$ dokku postgres:enter test2
-----> Filesystem changes may not persist after container restarts
root@26fe657ab463:/# uname -a
Linux 26fe657ab463 5.13.0-1021-oracle #26~20.04.1-Ubuntu SMP Mon Mar 7 14:30:17 UTC 2022 aarch64 GNU/Linux

Trace

Click to see the trace

ubuntu@instance:~$ dokku postgres:create test --trace
+ export DOKKU_HOST_ROOT=/home/dokku
+ DOKKU_HOST_ROOT=/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOCKER_BIN=docker
+ DOCKER_BIN=docker
+ export DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ export DOKKU_CNB_BUILDER=heroku/buildpacks
+ DOKKU_CNB_BUILDER=heroku/buildpacks
+ 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=2390484
+ DOKKU_PID=2390484
+ 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 test --trace
+ 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 ]]
+ [[ test == \-\-\a\p\p ]]
+ [[ test =~ ^--.* ]]
+ next_index=3
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ export DOKKU_TRACE=1
+ DOKKU_TRACE=1
+ [[ false == \t\r\u\e ]]
+ [[ --trace == \-\-\a\p\p ]]
+ [[ --trace =~ ^--.* ]]
+ flags=' --trace'
+ next_index=4
+ [[ -z --trace ]]
+ 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
+ [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ 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 test --trace
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=ubuntu
+ SSH_USER=ubuntu
+ export SSH_NAME=default
+ SSH_NAME=default
++ 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 test --trace
+ 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 test --trace
+ source /var/lib/dokku/plugins/enabled/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=14.1
+++ POSTGRES_IMAGE_VERSION=14.1
+++ export POSTGRES_ROOT=/var/lib/dokku/services/postgres
+++ POSTGRES_ROOT=/var/lib/dokku/services/postgres
+++ export POSTGRES_HOST_ROOT=/var/lib/dokku/services/postgres
+++ POSTGRES_HOST_ROOT=/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/services/postgres
+++ PLUGIN_DATA_HOST_ROOT=/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=14.1
+++ PLUGIN_IMAGE_VERSION=14.1
+++ 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.31.1-uclibc
+++ PLUGIN_BUSYBOX_IMAGE=busybox:1.31.1-uclibc
+++ export PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.3.3
+++ PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.3.3
+++ export PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.10.3
+++ PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.10.3
+++ export PLUGIN_WAIT_IMAGE=dokku/wait:0.4.3
+++ PLUGIN_WAIT_IMAGE=dokku/wait:0.4.3
+++ 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=14.1
++++ POSTGRES_IMAGE_VERSION=14.1
++++ export POSTGRES_ROOT=/var/lib/dokku/services/postgres
++++ POSTGRES_ROOT=/var/lib/dokku/services/postgres
++++ export POSTGRES_HOST_ROOT=/var/lib/dokku/services/postgres
++++ POSTGRES_HOST_ROOT=/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/services/postgres
++++ PLUGIN_DATA_HOST_ROOT=/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=14.1
++++ PLUGIN_IMAGE_VERSION=14.1
++++ 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.31.1-uclibc
++++ PLUGIN_BUSYBOX_IMAGE=busybox:1.31.1-uclibc
++++ export PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.3.3
++++ PLUGIN_AMBASSADOR_IMAGE=dokku/ambassador:0.3.3
++++ export PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.10.3
++++ PLUGIN_S3BACKUP_IMAGE=dokku/s3backup:0.10.3
++++ export PLUGIN_WAIT_IMAGE=dokku/wait:0.4.3
++++ PLUGIN_WAIT_IMAGE=dokku/wait:0.4.3
++++ export POSTGRES_CONFIG_OPTIONS=
++++ POSTGRES_CONFIG_OPTIONS=
+++ 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/plugins/enabled/common/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 test --trace
+ 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=test CREATE_FLAGS_LIST
+ service_create test --trace
+ local SERVICE=test
+ is_valid_service_name test
+ declare 'desc=validate a service name'
+ declare SERVICE=test
+ [[ -z test ]]
+ [[ test =~ ^[A-Za-z0-9_-]+$ ]]
+ return 0
+ [[ -z test ]]
+ [[ ! -d /var/lib/dokku/services/postgres/test ]]
+ SERVICE_ROOT=/var/lib/dokku/services/postgres/test
+ LINKS_FILE=/var/lib/dokku/services/postgres/test/LINKS
+ service_parse_args --trace
+ declare 'desc=cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in "$@"
+ shift
+ case "$arg" in
+ set -- --trace
+ OPTIND=1
+ getopts a:c:C:d:i:I:m:p:q:R:r:s:u: opt
/var/lib/dokku/plugins/enabled/postgres/subcommands/create: illegal option -- -
+ case "$opt" in
+ getopts a:c:C:d:i:I:m:p:q:R:r:s:u: opt
/var/lib/dokku/plugins/enabled/postgres/subcommands/create: illegal option -- t
+ case "$opt" in
+ getopts a:c:C:d:i:I:m:p:q:R:r:s:u: opt
+ case "$opt" in
+ export SERVICE_ROOT_PASSWORD=ace
+ SERVICE_ROOT_PASSWORD=ace
+ getopts a:c:C:d:i:I:m:p:q:R:r:s:u: opt
+ shift 1
+ service_image_exists test
+ declare 'desc=check if the current image exists'
+ declare SERVICE=test
+ local plugin_image=postgres
+ local plugin_image_version=14.1
+ [[ -f /var/lib/dokku/services/postgres/test/IMAGE ]]
+ [[ -f /var/lib/dokku/services/postgres/test/IMAGE_VERSION ]]
+ local IMAGE=postgres:14.1
++ docker images -q postgres:14.1
+ [[ 193e0347e554 == '' ]]
+ return 0
+ plugn trigger service-action pre-create test
+ mkdir -p /var/lib/dokku/services/postgres/test
+ mkdir -p /var/lib/dokku/services/postgres/test/data
+ touch /var/lib/dokku/services/postgres/test/LINKS
++ openssl rand -hex 16
+ PASSWORD=e7c65a4f67c6a324823b1109a783889f
+ [[ -n '' ]]
+ echo e7c65a4f67c6a324823b1109a783889f
+ chmod 640 /var/lib/dokku/services/postgres/test/PASSWORD
+ service_commit_config test
+ declare SERVICE=test
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test
+ 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 14.1 ]]
+ echo 14.1
+ write_database_name test
+ declare 'desc=write a sanitized database name'
+ declare SERVICE=test
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test
+ tr .- _
+ echo test
+ plugn trigger service-action post-create test
+ service_create_container test
+ local SERVICE=test
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test
+ local SERVICE_HOST_ROOT=/var/lib/dokku/services/postgres/test
++ get_service_name test
++ declare 'desc=retrieve a docker service label'
++ declare SERVICE=test
++ echo dokku.postgres.test
+ local SERVICE_NAME=dokku.postgres.test
++ service_password test
++ declare 'desc=fetch the password for a service'
++ declare SERVICE=test
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test
++ local PASSWORD_FILE=/var/lib/dokku/services/postgres/test/PASSWORD
++ [[ -f /var/lib/dokku/services/postgres/test/PASSWORD ]]
++ cat /var/lib/dokku/services/postgres/test/PASSWORD
+ local PASSWORD=e7c65a4f67c6a324823b1109a783889f
++ get_database_name test
++ declare 'desc=retrieve a sanitized database name'
++ declare SERVICE=test
++ local SERVICE_ROOT=/var/lib/dokku/services/postgres/test
++ [[ ! -f /var/lib/dokku/services/postgres/test/DATABASE_NAME ]]
++ cat /var/lib/dokku/services/postgres/test/DATABASE_NAME
+ local DATABASE_NAME=test
+ local PREVIOUS_ID
+ [[ -f /var/lib/dokku/services/postgres/test/CONFIG_OPTIONS ]]
++ cat /var/lib/dokku/services/postgres/test/CONFIG_OPTIONS
+ export CONFIG_OPTIONS=
+ CONFIG_OPTIONS=
+ [[ -f /var/lib/dokku/services/postgres/test/SERVICE_MEMORY ]]
+ [[ -n '' ]]
+ [[ -f /var/lib/dokku/services/postgres/test/SHM_SIZE ]]
+ [[ -n '' ]]
+ [[ -f /var/lib/dokku/services/postgres/test/IMAGE ]]
++ cat /var/lib/dokku/services/postgres/test/IMAGE
+ PLUGIN_IMAGE=postgres
+ [[ -f /var/lib/dokku/services/postgres/test/IMAGE_VERSION ]]
++ cat /var/lib/dokku/services/postgres/test/IMAGE_VERSION
+ PLUGIN_IMAGE_VERSION=14.1
++ docker run --name dokku.postgres.test -v /var/lib/dokku/services/postgres/test/data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=e7c65a4f67c6a324823b1109a783889f --env-file=/var/lib/dokku/services/postgres/test/ENV -d --restart always --label dokku=service --label dokku.service=postgres postgres:14.1
+ ID=d09fdc3f4e7030769f8c6b98375180cb9a8f76c258a2c4a64f0e7111ae197851
+ echo d09fdc3f4e7030769f8c6b98375180cb9a8f76c258a2c4a64f0e7111ae197851
+ 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
+ docker run --rm --link dokku.postgres.test:postgres dokku/wait:0.4.3 -p 5432
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error

Docker logs

ubuntu@instance-20211211-1425:~$ docker logs dokku.postgres.test 
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2022-03-26 22:24:41.355 UTC [48] LOG:  starting PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2022-03-26 22:24:41.357 UTC [48] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-03-26 22:24:41.364 UTC [49] LOG:  database system was shut down at 2022-03-26 22:24:41 UTC
2022-03-26 22:24:41.369 UTC [48] LOG:  database system is ready to accept connections
 done
server started

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2022-03-26 22:24:41.480 UTC [48] LOG:  received fast shutdown request
waiting for server to shut down....2022-03-26 22:24:41.484 UTC [48] LOG:  aborting any active transactions
2022-03-26 22:24:41.490 UTC [48] LOG:  background worker "logical replication launcher" (PID 55) exited with exit code 1
2022-03-26 22:24:41.490 UTC [50] LOG:  shutting down
2022-03-26 22:24:41.508 UTC [48] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2022-03-26 22:24:41.602 UTC [1] LOG:  starting PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2022-03-26 22:24:41.602 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-03-26 22:24:41.602 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2022-03-26 22:24:41.606 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-03-26 22:24:41.611 UTC [60] LOG:  database system was shut down at 2022-03-26 22:24:41 UTC
2022-03-26 22:24:41.617 UTC [1] LOG:  database system is ready to accept connections

Thank you for your awesome project and support !

The container is running well, once the database has been created manually, it works fine.

--edit typo/format

This issue seems to be related to dokku/docker-wait, as its docker image only supports linux/amd64.

In theory, the fix should be just a matter of running the build workflow for dokku/docker-wait as it seems configured to build to linux/arm64, although this process never was executed before.

After that, we only need to update the image version used on dokku-postgres.

export PLUGIN_WAIT_IMAGE="dokku/wait:0.4.3"

cloning the dokku/docker-wait repo, and running docker build . -t dokku/wait:0.4.3 worked for me to resolve the issue.

What should the image version used on dokku-postgres be changed to? 'latest' ?

@josegonzalez would be great to get this fixed. Dokku works great on RPi but Postgres is pretty key for a lot of uses!

Does this work now for anyone that has tried?

Does this work now for anyone that has tried?

@josegonzalez we're almost there, this project is using dokku/wait 0.4.3 and we need to update to the new version.

I did a test using the dokku/wait 0.5.0 on a fork and it fixes this issue.

ubuntu@arm:~$ sudo dokku postgres:create test
       Waiting for container to be ready
       Creating container database
       Securing connection to database
=====> Postgres container created: test
=====> test postgres service information
       Config dir:          /var/lib/dokku/services/postgres/test/data
       Config options:
       Data dir:            /var/lib/dokku/services/postgres/test/data
       Dsn:                 postgres://postgres:f75a6e23906d07ce4a5ba1793b4b062d@dokku-postgres-test:5432/test
       Exposed ports:       -
       Id:                  45d095d456c4dd7ca7e26b6ff81de17d2af47331b01b875c860c1eca57a11a93
       Internal ip:         172.17.0.6
       Links:               -
       Service root:        /var/lib/dokku/services/postgres/test
       Status:              running
       Version:             postgres:14.4

@josegonzalez @elfpie I was experiencing the same error with a raspberry pi. elfpie's branch solved it

The change to a newer version of the images we depend upon has been merged.