dokku / dokku-mysql

a mysql plugin for dokku
MIT License
97 stars 39 forks source link

"ERROR: unable to connect" when ran command "dokku mysql:create lollipop" #86

Closed vestayin closed 6 years ago

vestayin commented 6 years ago

I installed dokku-mysql with instruction in this project and tried to create new MySQL database via dokku mysql:create lollipop. However, it always output ERROR: unable to connect at the end of running.

Here is dokku report

-----> uname: Linux dokkuMe 4.13.0-1005-azure #7-Ubuntu SMP Mon Jan 8 21:37:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
              total        used        free      shared  buff/cache   available
Mem:           1907         633         141          31        1132         899
Swap:             0           0           0
-----> docker version:
Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f5
 Built: Wed Jan 10 20:11:05 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:09:37 2018
  OS/Arch:      linux/amd64
  Experimental: false
-----> docker daemon info:
Containers: 13
 Running: 7
 Paused: 0
 Stopped: 6
Images: 27
Server Version: 18.01.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-1005-azure
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.862GiB
Name: dokkuMe
ID: 4GKM:XFEU:FICM:GFOC:HCHY:64TB:4SDV:AJ2U:ASUG:X4Q4:J6UJ:ZLXK
Docker Root Dir: /var/lib/docker
Debug Mode (client): true
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
-----> sigil version: 0.4.0
-----> herokuish version:
herokuish: 0.3.33
buildpacks:
  heroku-buildpack-multi     v1.0.0
  heroku-buildpack-ruby      v170
  heroku-buildpack-nodejs    v111
  heroku-buildpack-clojure   v77
  heroku-buildpack-python    v120
  heroku-buildpack-java      v57
  heroku-buildpack-gradle    v24
  heroku-buildpack-scala     v79
  heroku-buildpack-play      v26
  heroku-buildpack-php       v126
  heroku-buildpack-go        v78
  heroku-buildpack-erlang    fa17af9
  buildpack-nginx            v8
-----> dokku version: 0.11.3
-----> dokku plugins:
plugn: 0.3.0
  00_dokku-standard    0.11.3 enabled    dokku core standard plugin
  20_events            0.11.3 enabled    dokku core events logging plugin
  apps                 0.11.3 enabled    dokku core apps plugin
  build-env            0.11.3 enabled    dokku core build-env plugin
  certs                0.11.3 enabled    dokku core certificate management plugin
  checks               0.11.3 enabled    dokku core checks plugin
  common               0.11.3 enabled    dokku core common plugin
  config               0.11.3 enabled    dokku core config plugin
  docker-options       0.11.3 enabled    dokku core docker-options plugin
  domains              0.11.3 enabled    dokku core domains plugin
  enter                0.11.3 enabled    dokku core enter plugin
  git                  0.11.3 enabled    dokku core git plugin
  logs                 0.11.3 enabled    dokku core logs plugin
  mysql                1.0.0 enabled    dokku mysql service plugin
  named-containers     0.11.3 enabled    dokku core named containers plugin
  network              0.11.3 enabled    dokku core network plugin
  nginx-vhosts         0.11.3 enabled    dokku core nginx-vhosts plugin
  plugin               0.11.3 enabled    dokku core plugin plugin
  postgres             1.0.0 enabled    dokku postgres service plugin
  proxy                0.11.3 enabled    dokku core proxy plugin
  ps                   0.11.3 enabled    dokku core ps plugin
  rabbitmq             1.0.0 enabled    dokku rabbitmq service plugin
  repo                 0.11.3 enabled    dokku core repo plugin
  shell                0.11.3 enabled    dokku core shell plugin
  ssh-keys             0.11.3 enabled    dokku core ssh-keys plugin
  storage              0.11.3 enabled    dokku core storage plugin
  tags                 0.11.3 enabled    dokku core tags plugin
  tar                  0.11.3 enabled    dokku core tar plugin

Here is dokku mysql:create lollipop with dokku trace on.

+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ 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_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 mysql:create lolipop
+ 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
+ [[ mysql:create =~ ^--.* ]]
+ 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
+ [[ loginuser != \d\o\k\k\u ]]
+ [[ ! mysql:create =~ plugin:* ]]
+ [[ ! mysql:create == \s\s\h\-\k\e\y\s\:\a\d\d ]]
++ id -un
+ export SSH_USER=loginuser
+ SSH_USER=loginuser
+ sudo -u dokku -E -H /usr/bin/dokku mysql:create lolipop
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ 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_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 mysql:create lolipop
+ 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
+ [[ mysql:create =~ ^--.* ]]
+ 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 ]]
+ [[ mysql:create =~ ^plugin:.* ]]
+ [[ mysql:create == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ -n '' ]]
+ dokku_auth mysql:create lolipop
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=loginuser
+ SSH_USER=loginuser
+ export SSH_NAME=default
+ SSH_NAME=default
+ plugn trigger user-auth loginuser default mysql:create lolipop
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n 1 ]]
++ basename /var/lib/dokku/plugins/enabled/20_events/user-auth
+ dokku_log_plugn_trigger_call user-auth loginuser default mysql:create lolipop
+ declare 'desc=log plugn trigger calls'
+ local l_hook=user-auth
+ shift
+ dokku_log_event 'INVOKED: user-auth( loginuser default mysql:create lolipop ) NAME= FINGERPRINT='
+ declare 'desc=log dokku events'
+ logger -t dokku -i -- 'INVOKED: user-auth( loginuser default mysql:create lolipop ) NAME= FINGERPRINT='
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ mysql:create =~ (ssh-keys:add|ssh-keys:remove) ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd mysql:create lolipop
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=mysql:create
+ local PLUGIN_CMD=mysql:create
+ local implemented=0
+ local script
+ argv=("$@")
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/mysql
+ [[ /var/lib/dokku/plugins/available/mysql == *core-plugins* ]]
+ [[ -x /var/lib/dokku/plugins/enabled/mysql:create/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/mysql:create/subcommands/mysql:create ]]
+ [[ -x /var/lib/dokku/plugins/enabled/mysql/subcommands/create ]]
+ [[ -n create ]]
+ /var/lib/dokku/plugins/enabled/mysql/subcommands/create mysql:create lolipop
+ source /var/lib/dokku/plugins/enabled/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/mysql/subcommands/create
+++ cd /var/lib/dokku/plugins/enabled/mysql/subcommands
+++ pwd
++ dirname /var/lib/dokku/plugins/enabled/mysql/subcommands
+ source /var/lib/dokku/plugins/enabled/mysql/functions
++++ dirname /var/lib/dokku/plugins/enabled/mysql/functions
+++ cd /var/lib/dokku/plugins/enabled/mysql
+++ pwd
++ source /var/lib/dokku/plugins/enabled/mysql/config
+++ export MYSQL_IMAGE=mysql
+++ MYSQL_IMAGE=mysql
+++ export MYSQL_IMAGE_VERSION=5.7.12
+++ MYSQL_IMAGE_VERSION=5.7.12
+++ export MYSQL_ROOT=/var/lib/dokku/services/mysql
+++ MYSQL_ROOT=/var/lib/dokku/services/mysql
+++ export PLUGIN_COMMAND_PREFIX=mysql
+++ PLUGIN_COMMAND_PREFIX=mysql
+++ export PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/mysql
+++ PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/mysql
+++ export PLUGIN_DATA_ROOT=/var/lib/dokku/services/mysql
+++ PLUGIN_DATA_ROOT=/var/lib/dokku/services/mysql
+++ PLUGIN_DATASTORE_PORTS=(3306)
+++ export PLUGIN_DATASTORE_PORTS
+++ export PLUGIN_DATASTORE_WAIT_PORT=3306
+++ PLUGIN_DATASTORE_WAIT_PORT=3306
+++ export PLUGIN_DEFAULT_ALIAS=DATABASE
+++ PLUGIN_DEFAULT_ALIAS=DATABASE
+++ export PLUGIN_ALT_ALIAS=DOKKU_MYSQL
+++ PLUGIN_ALT_ALIAS=DOKKU_MYSQL
+++ export PLUGIN_IMAGE=mysql
+++ PLUGIN_IMAGE=mysql
+++ export PLUGIN_IMAGE_VERSION=5.7.12
+++ PLUGIN_IMAGE_VERSION=5.7.12
+++ export PLUGIN_SCHEME=mysql
+++ PLUGIN_SCHEME=mysql
+++ export PLUGIN_SERVICE=MySQL
+++ PLUGIN_SERVICE=MySQL
+++ export PLUGIN_VARIABLE=MYSQL
+++ PLUGIN_VARIABLE=MYSQL
+++ 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/mysql/* ]]
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/mysql/functions
+++ cd /var/lib/dokku/plugins/enabled/mysql
+++ pwd
++ source /var/lib/dokku/plugins/enabled/mysql/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-create-cmd mysql:create lolipop
+ declare 'desc=create a MySQL service'
+ argv=("$@")
+ local cmd=mysql:create argv
+ [[ mysql:create == \m\y\s\q\l\:\c\r\e\a\t\e ]]
+ shift 1
+ declare SERVICE=lolipop CREATE_FLAGS_LIST=
+ service_create lolipop
+ local SERVICE=lolipop
+ [[ -z lolipop ]]
+ [[ ! -d /var/lib/dokku/services/mysql/lolipop ]]
+ SERVICE_ROOT=/var/lib/dokku/services/mysql/lolipop
+ LINKS_FILE=/var/lib/dokku/services/mysql/lolipop/LINKS
+ service_parse_args
+ declare 'desc=cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ OPTIND=1
+ getopts a:c:C:d:i:I:m:p:q:r:u: opt
+ shift 0
+ grep -q ' 5.7.12 '
+ grep -e '^mysql '
+ docker images
+ mkdir -p /var/lib/dokku/services/mysql/lolipop
+ mkdir -p /var/lib/dokku/services/mysql/lolipop/data
+ mkdir -p /var/lib/dokku/services/mysql/lolipop/config
+ touch /var/lib/dokku/services/mysql/lolipop/LINKS
+ echo -e '[mysqld]\nperformance_schema = 0'
+ echo -e '[mysqld]\ncharacter-set-server = utf8\ncollation-server = utf8_general_ci'
++ openssl rand -hex 8
+ ROOTPASSWORD=9f7a9106ae9fde3c
++ openssl rand -hex 8
+ PASSWORD=b48042c6bfa0bb17
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo 9f7a9106ae9fde3c
+ echo b48042c6bfa0bb17
+ chmod 640 /var/lib/dokku/services/mysql/lolipop/ROOTPASSWORD /var/lib/dokku/services/mysql/lolipop/PASSWORD
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo ''
+ service_create_container lolipop
+ local SERVICE=lolipop
+ local SERVICE_ROOT=/var/lib/dokku/services/mysql/lolipop
++ get_service_name lolipop
++ declare 'desc=Retrieves a docker service label'
++ declare SERVICE=lolipop
++ echo dokku.mysql.lolipop
+ local SERVICE_NAME=dokku.mysql.lolipop
++ cat /var/lib/dokku/services/mysql/lolipop/ROOTPASSWORD
+ local ROOTPASSWORD=9f7a9106ae9fde3c
++ cat /var/lib/dokku/services/mysql/lolipop/PASSWORD
+ local PASSWORD=b48042c6bfa0bb17
++ docker run --name dokku.mysql.lolipop -v /var/lib/dokku/services/mysql/lolipop/data:/var/lib/mysql -v /var/lib/dokku/services/mysql/lolipop/config:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=9f7a9106ae9fde3c -e MYSQL_USER=mysql -e MYSQL_PASSWORD=b48042c6bfa0bb17 -e MYSQL_DATABASE=lolipop --env-file=/var/lib/dokku/services/mysql/lolipop/ENV -d --restart always --label dokku=service --label dokku.service=mysql mysql:5.7.12
+ ID=b44e3ac7345da6cc2e479f4655b78a9d5d1abfea69e03e5249fdc33122aed421
+ echo b44e3ac7345da6cc2e479f4655b78a9d5d1abfea69e03e5249fdc33122aed421
+ 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.mysql.lolipop:mysql dokkupaas/wait:0.2 -p 3306
  ERROR: unable to connect
josegonzalez commented 6 years ago

This sounds like maybe your server did not have enough resources to start the container. What I would do is look at the container id - in this case b44e3ac7345da6cc2e479f4655b78a9d5d1abfea69e03e5249fdc33122aed421 - and see if there was a reason why it didn't start correctly.