weixin_39542514
weixin_39542514
2020-12-09 00:12

dokku-postgres: Intermittent "missing" container status when created using "postgres:create servicename"

I used a GraphQL mutation in a locally installed GraphiQL UI to create pgtest, but got an error (that I didn't log and cannot duplicate) when using a mutation to postgres:link the new service to an existing app. Here is some troubleshooting I attempted:


root:/app# dokku postgres:create pgtest
Postgres service pgtest already exists
root:/app# dokku postgres:list
cat: /var/lib/dokku/services/postgres/pgtest/ID: No such file or directory
NAME    VERSION        STATUS   EXPOSED PORTS  LINKS
pgtest  postgres:11.2  missing  -  
root:/app# dokku postgres:start pgtest
 !     Service is already started
root:/app# dokku postgres:list
cat: /var/lib/dokku/services/postgres/pgtest/ID: No such file or directory
NAME       VERSION        STATUS   EXPOSED PORTS  LINKS
pgtest     postgres:11.2  missing  -              -
pgtestcli  postgres:11.2  running  -              -

For comparison purposes, I created a service directly in the container:

root:/app# dokku postgres:create pgtestcli
       Waiting for container to be ready
       Creating container database
       Securing connection to database
=====> Postgres container created: pgtestcli
=====> Container Information
       Config dir:          /var/lib/dokku/services/postgres/pgtestcli/config
       Data dir:            /var/lib/dokku/services/postgres/pgtestcli/data
       Dsn:                 postgres://postgres:6e09057251dac857c20825ad53ac24a4-postgres-pgtestcli:5432/pgtestcli
       Exposed ports:       -                        
       Id:                  01efa245c62606f5317207f06c3580d3789707a396e90b14844d2a8cdbb9a40a
       Internal ip:         172.17.0.21              
       Links:               -                        
       Service root:        /var/lib/dokku/services/postgres/pgtestcli
       Status:              running                  
       Version:             postgres:11.2
root:/app# dokku postgres:list
cat: /var/lib/dokku/services/postgres/pgtest/ID: No such file or directory     
NAME       VERSION        STATUS   EXPOSED PORTS  LINKS
pgtest     postgres:11.2  missing  -              -
pgtestcli  postgres:11.2  running  -              -       

To test the mutation again, I created pgtestagain and it did not duplicate the error:


root:/app# dokku postgres:list
cat: /var/lib/dokku/services/postgres/pgtest/ID: No such file or directory
NAME         VERSION        STATUS   EXPOSED PORTS  LINKS
pgtest       postgres:11.2  missing  -              -
pgtestagain  postgres:11.2  running  -              -
pgtestcli    postgres:11.2  running  -              -    

Here's a trace of the start command for the defective container:


root:/app# dokku --trace postgres:start pgtest
+ export DOKKU_HOST_ROOT=[redacted]
+ DOKKU_HOST_ROOT=[redacted]
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=[redacted]
+ DOKKU_IMAGE=[redacted]
+ 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_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_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_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args postgres:start pgtest
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=2
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=3
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ postgres:start =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ postgres:start =~ ^plugin:.* ]]
+ [[ postgres:start == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ -n '' ]]
+ dokku_auth postgres:start pgtest
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=root
+ SSH_USER=root
+ export SSH_NAME=default
+ SSH_NAME=default
+ plugn trigger user-auth root default postgres:start pgtest
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ dirname /var/lib/dokku/plugins/enabled/acl/user-auth
+ source /var/lib/dokku/plugins/enabled/acl/internal-functions
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ DOKKU_SUPER_USER=not_a_valid_username_due_to_length
+ DOKKU_ACL_USER_COMMANDS='help version ps:help redis:help'
+ DOKKU_ACL_PER_APP_COMMANDS='apps:lock apps:unlock logs logs:failed urls ps ps:rebuild ps:report ps:restart ps:stop ps:start ps:scale git-upload-pack git-upload-archive git-receive-pack git-hook storage:list'
+ DOKKU_ACL_PER_SERVICE_COMMANDS='redis:connect redis:enter redis:export redis:import redis:info redis:logs redis:restart redis:start redis:stop redis:unexpose postgres:connect postgres:enter postgres:export postgres:import postgres:info postgres:logs postgres:restart postgres:start postgres:stop postgres:unexpose'
+ DOKKU_ACL_LINK_COMMANDS='redis:link redis:unlink'
+ SSH_USER=root
+ SSH_NAME=default
+ shift 2
+ [[ -z help version ps:help redis:help ]]
+ [[ root == \r\o\o\t ]]
+ exit 0
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ postgres:start =~ (ssh-keys:add|ssh-keys:remove) ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd postgres:start pgtest
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=postgres:start
+ local PLUGIN_CMD=postgres:start
+ 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:start/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/postgres:start/subcommands/postgres:start ]]
+ [[ -x /var/lib/dokku/plugins/enabled/postgres/subcommands/start ]]
+ [[ -n start ]]
+ /var/lib/dokku/plugins/enabled/postgres/subcommands/start postgres:start pgtest
+ source /var/lib/dokku/plugins/enabled/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/postgres/subcommands/start
+++ 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
+++ export POSTGRES_IMAGE=postgres
+++ POSTGRES_IMAGE=postgres
+++ export POSTGRES_IMAGE_VERSION=11.2
+++ POSTGRES_IMAGE_VERSION=11.2
+++ 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=11.2
+++ PLUGIN_IMAGE_VERSION=11.2
+++ 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
+++ [[ -n 1 ]]
+++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
+++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
+++ [[ -d /var/lib/dokku/services/postgres/* ]]
++ 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
+++ 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-start-cmd postgres:start pgtest
+ declare 'desc=start a previously stopped Postgres service'
+ argv=("$@")
+ local cmd=postgres:start argv
+ [[ postgres:start == \p\o\s\t\g\r\e\s\:\s\t\a\r\t ]]
+ shift 1
+ declare SERVICE=pgtest
+ [[ -z pgtest ]]
+ verify_service_name pgtest
+ declare 'desc=Verifies that a service exists'
+ declare SERVICE=pgtest
+ [[ -z pgtest ]]
+ [[ ! -d /var/lib/dokku/services/postgres/pgtest ]]
+ return 0
+ service_start pgtest
+ local SERVICE=pgtest
+ local QUIET=
+ local SERVICE_ROOT=/var/lib/dokku/services/postgres/pgtest
++ get_service_name pgtest
++ declare 'desc=Retrieves a docker service label'
++ declare SERVICE=pgtest
++ echo dokku.postgres.pgtest
+ local SERVICE_NAME=dokku.postgres.pgtest
++ docker ps -aq --no-trunc --filter status=running --filter 'name=^/dokku.postgres.pgtest$' --format '{{ .ID }}'
+ local ID=af0a42dbe84acde2a0c573cb21ed5d10b71b9dc57ff1ac4cfd8aec557588f0ff
+ [[ -n af0a42dbe84acde2a0c573cb21ed5d10b71b9dc57ff1ac4cfd8aec557588f0ff ]]
+ [[ -z '' ]]
+ dokku_log_warn 'Service is already started'
+ declare 'desc=log warning formatter'
+ echo ' !     Service is already started'
 !     Service is already started
+ return 0
+ implemented=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -eq 0 ]]

该提问来源于开源项目:dokku/dokku-redis

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答