dokku / dokku-elasticsearch

an elasticsearch plugin for dokku
MIT License
94 stars 35 forks source link

[create] panic: runtime error: invalid memory address or nil pointer dereference #75

Closed StephanMeijer closed 4 years ago

StephanMeijer commented 5 years ago
root@xyz:~$ dokku elasticsearch:destroy snowstorm-es
 !     WARNING: Potentially Destructive Action
 !     This command will destroy snowstorm-es Elasticsearch service.
 !     To proceed, type "snowstorm-es"

> snowstorm-es
=====> Deleting snowstorm-es
=====> Stopping container
       Container stopped
       Removing container
       Removing data
=====> Elasticsearch container deleted: snowstorm-es
root@xyz~$ dokku elasticsearch:create snowstorm-es
=====> Extracting config files
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x562f7fb377f8]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ValidateOutputPath(0x7ffe2f194085, 0x1, 0xc0002b4180, 0x20)
        /go/src/github.com/docker/cli/cli/command/utils.go:142 +0x118
github.com/docker/cli/cli/command/container.copyFromContainer(0x562f815d18c0, 0xc00005a128, 0x562f81613cc0, 0xc0003460f0, 0x0, 0x7ffe2f194064, 0x20, 0x7ffe2f194085, 0x1, 0x7ffe2f194023, ...)
        /go/src/github.com/docker/cli/cli/command/container/cp.go:131 +0xd2
github.com/docker/cli/cli/command/container.runCopy(0x562f81613cc0, 0xc0003460f0, 0x7ffe2f194023, 0x61, 0x7ffe2f194085, 0x1, 0x0, 0x0, 0xc000035c58)
        /go/src/github.com/docker/cli/cli/command/container/cp.go:102 +0x3b4
github.com/docker/cli/cli/command/container.NewCopyCommand.func1(0xc0001d4f00, 0xc0002b4140, 0x2, 0x2, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/container/cp.go:67 +0xe3
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc0001d4f00, 0xc0001c5f90, 0x2, 0x2, 0xc0001d4f00, 0xc0001c5f90)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x467
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0002c7180, 0xc0001c5f80, 0x3, 0x3)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x2ee
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800
main.runDocker(0xc0003460f0, 0x562f8157c440, 0xc000010020)
        /go/src/github.com/docker/cli/cmd/docker/docker.go:281 +0x1d5
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:292 +0xf3
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
StephanMeijer commented 5 years ago
root@xyz$ export ELASTICSEARCH_IMAGE="elasticsearch"
root@xyz$ export ELASTICSEARCH_IMAGE_VERSION="6.8.2"
root@xyz$ dokku elasticsearch:destroy snowstorm-es
 !     WARNING: Potentially Destructive Action
 !     This command will destroy snowstorm-es Elasticsearch service.
 !     To proceed, type "snowstorm-es"

> snowstorm-es
=====> Deleting snowstorm-es
 !     Service is already stopped
       Removing data
=====> Elasticsearch container deleted: snowstorm-es
root@xyz$ dokku elasticsearch:create snowstorm-es
=====> Extracting config files
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x558d1366e7f8]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ValidateOutputPath(0x7ffe9f409085, 0x1, 0xc0005e9460, 0x20)
        /go/src/github.com/docker/cli/cli/command/utils.go:142 +0x118
github.com/docker/cli/cli/command/container.copyFromContainer(0x558d151088c0, 0xc0000ca020, 0x558d1514acc0, 0xc0002140f0, 0x0, 0x7ffe9f409064, 0x20, 0x7ffe9f409085, 0x1, 0x7ffe9f409023, ...)
        /go/src/github.com/docker/cli/cli/command/container/cp.go:131 +0xd2
github.com/docker/cli/cli/command/container.runCopy(0x558d1514acc0, 0xc0002140f0, 0x7ffe9f409023, 0x61, 0x7ffe9f409085, 0x1, 0x0, 0x0, 0xc000271c58)
        /go/src/github.com/docker/cli/cli/command/container/cp.go:102 +0x3b4
github.com/docker/cli/cli/command/container.NewCopyCommand.func1(0xc0005ce280, 0xc0005e9420, 0x2, 0x2, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/container/cp.go:67 +0xe3
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc0005ce280, 0xc0005ded60, 0x2, 0x2, 0xc0005ce280, 0xc0005ded60)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x467
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0003c6f00, 0xc0005ded50, 0x3, 0x3)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x2ee
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800
main.runDocker(0xc0002140f0, 0x558d150b3440, 0xc0000cc010)
        /go/src/github.com/docker/cli/cmd/docker/docker.go:281 +0x1d5
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:292 +0xf3
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
josegonzalez commented 5 years ago

That seems like a docker failure, not something we have in our codebase. Mind restarting your docker daemon and trying again?

jonian commented 5 years ago

@josegonzalez It is a docker failure. I downgraded docker to 18.09.8 and the issue is not present.

NOBLES5E commented 5 years ago

also get this error (docker 19.03.2).

estebanutz commented 5 years ago

I'm having the same issue here, so is the solution to downgrade docker? Thanks!

estebanutz commented 5 years ago

I'm running docker 19.03.2

josegonzalez commented 5 years ago

What is the output of dokku report?

estebanutz commented 5 years ago

@josegonzalez I'm running dokku 0.16.4, docker 19.03.2 and this is the report:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x556d62044c78]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ValidateOutputPath(0x7fff45c22159, 0x1, 0xc000382da0, 0x20)
    /go/src/github.com/docker/cli/cli/command/utils.go:142 +0x118
github.com/docker/cli/cli/command/container.copyFromContainer(0x556d63adf540, 0xc00005a0e8, 0x556d63b21940, 0xc0000be0f0, 0x0, 0x7fff45c22138, 0x20, 0x7fff45c22159, 0x1, 0x7fff45c220f7, ...)
    /go/src/github.com/docker/cli/cli/command/container/cp.go:131 +0xd2
github.com/docker/cli/cli/command/container.runCopy(0x556d63b21940, 0xc0000be0f0, 0x7fff45c220f7, 0x61, 0x7fff45c22159, 0x1, 0x0, 0x0, 0xc0001a5c58)
    /go/src/github.com/docker/cli/cli/command/container/cp.go:102 +0x3b4
github.com/docker/cli/cli/command/container.NewCopyCommand.func1(0xc000238a00, 0xc000382d60, 0x2, 0x2, 0x0, 0x0)
    /go/src/github.com/docker/cli/cli/command/container/cp.go:67 +0xe3
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc000238a00, 0xc000252310, 0x2, 0x2, 0xc000238a00, 0xc000252310)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x467
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000136c80, 0xc000252300, 0x3, 0x3)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x2ee
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800
main.runDocker(0xc0000be0f0, 0x556d63a8a080, 0xc000010028)
    /go/src/github.com/docker/cli/cmd/docker/docker.go:281 +0x1d5
main.main()
    /go/src/github.com/docker/cli/cmd/docker/docker.go:292 +0xf3
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
estebanutz commented 5 years ago
-----> uname: Linux inti-s1 4.15.0-69-generic #78-Ubuntu SMP Wed Nov 6 11:30:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
-----> memory: 
                     total        used        free      shared  buff/cache   available
       Mem:           1993        1161          91           1         740         660
       Swap:             0           0           0
-----> docker version: 
       Client: Docker Engine - Community
        Version:           19.03.2
        API version:       1.40
        Go version:        go1.12.8
        Git commit:        6a30dfc
        Built:             Thu Aug 29 05:29:11 2019
        OS/Arch:           linux/amd64
        Experimental:      false

       Server: Docker Engine - Community
        Engine:
         Version:          19.03.2
         API version:      1.40 (minimum version 1.12)
         Go version:       go1.12.8
         Git commit:       6a30dfc
         Built:            Thu Aug 29 05:27:45 2019
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          1.2.6
         GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
        runc:
         Version:          1.0.0-rc8
         GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
        docker-init:
         Version:          0.18.0
         GitCommit:        fec3683
-----> docker daemon info: 
       Client:
        Debug Mode: true

       Server:
        Containers: 33
         Running: 13
         Paused: 0
         Stopped: 20
        Images: 53
        Server Version: 19.03.2
        Storage Driver: overlay2
         Backing Filesystem: extfs
         Supports d_type: true
         Native Overlay Diff: true
        Logging Driver: json-file
        Cgroup Driver: cgroupfs
        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: runc
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
        runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
        init version: fec3683
        Security Options:
         apparmor
         seccomp
          Profile: default
        Kernel Version: 4.15.0-69-generic
        Operating System: Ubuntu 18.04.3 LTS
        OSType: linux
        Architecture: x86_64
        CPUs: 1
        Total Memory: 1.947GiB
        Name: inti-s1
        ID: PVXZ:BL7L:4NW2:CZUQ:XMW3:J77T:UN65:QTZP:STXG:ZCFR:FOA7:QIAY
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
        Registry: https://index.docker.io/v1/
        Labels:
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false

-----> sigil version: 0.4.0
-----> herokuish version: 
       herokuish: 0.5.3
       buildpacks:
         heroku-buildpack-multi     v1.0.0
         heroku-buildpack-ruby      v201
         heroku-buildpack-nodejs    v161
         heroku-buildpack-clojure   v84
         heroku-buildpack-python    v154
         heroku-buildpack-java      v63
         heroku-buildpack-gradle    v30
         heroku-buildpack-scala     v85
         heroku-buildpack-play      v26
         heroku-buildpack-php       v159
         heroku-buildpack-go        v126
         buildpack-nginx            v12
-----> dokku version: dokku version 0.16.4
-----> dokku plugins: 
       plugn: 0.3.2
         00_dokku-standard    0.16.4 enabled    dokku core standard plugin
         20_events            0.16.4 enabled    dokku core events logging plugin
         app-json             0.16.4 enabled    dokku core app-json plugin
         apps                 0.16.4 enabled    dokku core apps plugin
         build-env            0.16.4 enabled    dokku core build-env plugin
         buildpacks           0.16.4 enabled    dokku core buildpacks plugin
         certs                0.16.4 enabled    dokku core certificate management plugin
         checks               0.16.4 enabled    dokku core checks plugin
         common               0.16.4 enabled    dokku core common plugin
         config               0.16.4 enabled    dokku core config plugin
         docker-options       0.16.4 enabled    dokku core docker-options plugin
         domains              0.16.4 enabled    dokku core domains plugin
         elasticsearch        1.9.1 enabled    dokku elasticsearch service plugin
         enter                0.16.4 enabled    dokku core enter plugin
         git                  0.16.4 enabled    dokku core git plugin
         letsencrypt          0.8.8 enabled    Automated installation of let's encrypt TLS certificates
         logs                 0.16.4 enabled    dokku core logs plugin
         mysql                1.4.10 enabled    dokku mysql service plugin
         network              0.16.4 enabled    dokku core network plugin
         nginx-vhosts         0.16.4 enabled    dokku core nginx-vhosts plugin
         plugin               0.16.4 enabled    dokku core plugin plugin
         proxy                0.16.4 enabled    dokku core proxy plugin
         ps                   0.16.4 enabled    dokku core ps plugin
         repo                 0.16.4 enabled    dokku core repo plugin
         resource             0.16.4 enabled    dokku core resource plugin
         scheduler-docker-local 0.16.4 enabled    dokku core scheduler-docker-local plugin
         shell                0.16.4 enabled    dokku core shell plugin
         ssh-keys             0.16.4 enabled    dokku core ssh-keys plugin
         storage              0.16.4 enabled    dokku core storage plugin
         tags                 0.16.4 enabled    dokku core tags plugin
         tar                  0.16.4 enabled    dokku core tar plugin
jonian commented 4 years ago

The issue is present with Docker 19.03.5.

root@xyz:~# dokku elasticsearch:start statica
=====> Starting container
=====> Extracting config files
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x55750ed54cf8]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ValidateOutputPath(0x7ffeaa7b7716, 0x1, 0xc000382d80, 0x20)
    /go/src/github.com/docker/cli/cli/command/utils.go:142 +0x118
github.com/docker/cli/cli/command/container.copyFromContainer(0x5575105f2d00, 0xc0000520d8, 0x5575106351a0, 0xc0000d20f0, 0x0, 0x7ffeaa7b76f5, 0x20, 0x7ffeaa7b7716, 0x1, 0x7ffeaa7b76b4, ...)
    /go/src/github.com/docker/cli/cli/command/container/cp.go:131 +0xd2
github.com/docker/cli/cli/command/container.runCopy(0x5575106351a0, 0xc0000d20f0, 0x7ffeaa7b76b4, 0x61, 0x7ffeaa7b7716, 0x1, 0x0, 0x0, 0xc00025dc58)
    /go/src/github.com/docker/cli/cli/command/container/cp.go:102 +0x3b4
github.com/docker/cli/cli/command/container.NewCopyCommand.func1(0xc000230a00, 0xc000382d40, 0x2, 0x2, 0x0, 0x0)
    /go/src/github.com/docker/cli/cli/command/container/cp.go:67 +0xe3
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc000230a00, 0xc000246340, 0x2, 0x2, 0xc000230a00, 0xc000246340)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x467
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0000ce500, 0xc000246330, 0x3, 0x3)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x2ee
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
    /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800
main.runDocker(0xc0000d20f0, 0x55751059d840, 0xc000010028)
    /go/src/github.com/docker/cli/cmd/docker/docker.go:281 +0x1d5
main.main()
    /go/src/github.com/docker/cli/cmd/docker/docker.go:292 +0xf3
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

Dokku report:

-----> uname: Linux xyz 4.19.0-6-cloud-amd64 _#1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
-----> memory: 
                     total        used        free      shared  buff/cache   available
       Mem:            989         139         475           2         374         713
       Swap:          4095           0        4095
-----> docker version: 
       Client: Docker Engine - Community
        Version:           19.03.5
        API version:       1.40
        Go version:        go1.12.12
        Git commit:        633a0ea838
        Built:             Wed Nov 13 07:25:38 2019
        OS/Arch:           linux/amd64
        Experimental:      false

       Server: Docker Engine - Community
        Engine:
         Version:          19.03.5
         API version:      1.40 (minimum version 1.12)
         Go version:       go1.12.12
         Git commit:       633a0ea838
         Built:            Wed Nov 13 07:24:09 2019
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          1.2.10
         GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
        runc:
         Version:          1.0.0-rc8+dev
         GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
        docker-init:
         Version:          0.18.0
         GitCommit:        fec3683
-----> docker daemon info: 
WARNING: No swap limit support
       Client:
        Debug Mode: true

       Server:
        Containers: 0
         Running: 0
         Paused: 0
         Stopped: 0
        Images: 46
        Server Version: 19.03.5
        Storage Driver: overlay2
         Backing Filesystem: extfs
         Supports d_type: true
         Native Overlay Diff: true
        Logging Driver: json-file
        Cgroup Driver: cgroupfs
        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: runc
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
        runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
        init version: fec3683
        Security Options:
         apparmor
         seccomp
          Profile: default
        Kernel Version: 4.19.0-6-cloud-amd64
        Operating System: Debian GNU/Linux 10 (buster)
        OSType: linux
        Architecture: x86_64
        CPUs: 1
        Total Memory: 989.9MiB
        Name: xyz
        ID: IWAL:6WPQ:26JJ:OXQZ:Y2YG:FI5B:VM7O:G6S7:XOIV:Q5IF:JZOG:SJT7
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
        Registry: https://index.docker.io/v1/
        Labels:
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false

-----> sigil version: 0.4.0
-----> herokuish version: 
       herokuish: 0.5.3
       buildpacks:
         heroku-buildpack-multi     v1.0.0
         heroku-buildpack-ruby      v201
         heroku-buildpack-nodejs    v161
         heroku-buildpack-clojure   v84
         heroku-buildpack-python    v154
         heroku-buildpack-java      v63
         heroku-buildpack-gradle    v30
         heroku-buildpack-scala     v85
         heroku-buildpack-play      v26
         heroku-buildpack-php       v159
         heroku-buildpack-go        v126
         buildpack-nginx            v12
-----> dokku version: dokku version 0.19.10
-----> dokku plugins: 
       plugn: 0.3.2
         00_dokku-standard    0.19.10 enabled    dokku core standard plugin
         20_events            0.19.10 enabled    dokku core events logging plugin
         app-json             0.19.10 enabled    dokku core app-json plugin
         apps                 0.19.10 enabled    dokku core apps plugin
         builder-dockerfile   0.19.10 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.19.10 enabled    dokku core builder-herokuish plugin
         buildpacks           0.19.10 enabled    dokku core buildpacks plugin
         certs                0.19.10 enabled    dokku core certificate management plugin
         checks               0.19.10 enabled    dokku core checks plugin
         common               0.19.10 enabled    dokku core common plugin
         config               0.19.10 enabled    dokku core config plugin
         docker-options       0.19.10 enabled    dokku core docker-options plugin
         domains              0.19.10 enabled    dokku core domains plugin
         elasticsearch        1.9.2 enabled    dokku elasticsearch service plugin
         enter                0.19.10 enabled    dokku core enter plugin
         git                  0.19.10 enabled    dokku core git plugin
         http-auth            0.4.0 enabled    HTTP authentication for apps
         letsencrypt          0.9.1 enabled    Automated installation of let's encrypt TLS certificates
         logs                 0.19.10 enabled    dokku core logs plugin
         maintenance          0.5.0 enabled    Maintenance mode for apps
         network              0.19.10 enabled    dokku core network plugin
         nginx-vhosts         0.19.10 enabled    dokku core nginx-vhosts plugin
         plugin               0.19.10 enabled    dokku core plugin plugin
         postgres             1.9.2 enabled    dokku postgres service plugin
         proxy                0.19.10 enabled    dokku core proxy plugin
         ps                   0.19.10 enabled    dokku core ps plugin
         redirect             0.6.2 enabled    Plugin for managing application redirects
         redis                1.10.1 enabled    dokku redis service plugin
         repo                 0.19.10 enabled    dokku core repo plugin
         resource             0.19.10 enabled    dokku core resource plugin
         scheduler-docker-local 0.19.10 enabled    dokku core scheduler-docker-local plugin
         shell                0.19.10 enabled    dokku core shell plugin
         ssh-keys             0.19.10 enabled    dokku core ssh-keys plugin
         storage              0.19.10 enabled    dokku core storage plugin
         tags                 0.19.10 enabled    dokku core tags plugin
         tar                  0.19.10 enabled    dokku core tar plugin
         trace                0.19.10 enabled    dokku core trace plugin
slava-vishnyakov commented 4 years ago

Seems to be related to https://github.com/docker/cli/issues/2219

slava-vishnyakov commented 4 years ago

Is there a workaround for now? If I install ElasticSearch as a separate Docker container - how would I link it my dokku app? If I use config:set then dokku app fails upon restart (of docker or system), because of the changes in the docker IP of ES.

josegonzalez commented 4 years ago

Downgrade Docker to 18.09.8 and continue complaining on that Docker issue? 😂

slava-vishnyakov commented 4 years ago

It really doesn't sound safe to downgrade through a major release :)

But, seriously, is there a way to link a Docker container that posts its ip as SOMETHING_IP to a running dokku app (and correctly updates it on reboots, restarts, etc..)? It seems like it would be a GREAT feature. I'd even try to PR it, if I had any idea how :)

slava-vishnyakov commented 4 years ago

Sidenote: Oh, cool, there's already a PR in Docker to possibly fix it: https://github.com/docker/cli/pull/2221

slava-vishnyakov commented 4 years ago

The PR has been merged, so let's hope this fixes it.

lebalz commented 4 years ago

@dfurber nice work! Would you mind to open a pull request into this repo with this fix?

nampdn commented 4 years ago

Hello, is this issue resolved?

slava-vishnyakov commented 4 years ago

No, sadly with the latest Docker 19.03.6 it's still an issue I forgot to update other components: apt install docker-ce docker-ce-cli containerd.io

Actually, the problem now is different:

# dokku elasticsearch:create lollipop
=====> Extracting config files
stat -: permission denied
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

# dokku -v
dokku version 0.19.13
slava-vishnyakov commented 4 years ago

Trace output:

+ dokku_log_info2 'Extracting config files'
+ declare 'desc=log info2 formatter'
+ echo '=====> Extracting config files'
=====> Extracting config files
++ docker create elasticsearch:6.8.5
+ local TEMP_DOCKER_CONTAINER_ID=bd98b4a84235dc60e097e7002d60c2701b2636f0f011d1580acd1da6a12b11a7
+ docker cp bd98b4a84235dc60e097e7002d60c2701b2636f0f011d1580acd1da6a12b11a7:/usr/share/elasticsearch/config/ -
+ tar -x -C /var/lib/dokku/services/elasticsearch/lollipop/config --strip-components=1
stat -: permission denied
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
nampdn commented 4 years ago

@slava-vishnyakov is this fixable in our scope? I'll take a look if possible

slava-vishnyakov commented 4 years ago

Yes, I think so.

I think the image for ElasticSearch has changed and this line:

https://github.com/dokku/dokku-elasticsearch/blob/860d9c282c7a691ef2539757ca5a4a087a28b285/functions#L83

no longer finds the config files to copy to the outside directory.

That's my guess. I'll also try to take a look, but can't promise when.

slava-vishnyakov commented 4 years ago

No, seems to be something else:

Here's the output of docker cp e8f4a03a72e4850773f0b3d1e2dfde64585108eba8b46ab7c9abb555f24708f8:/usr/share/elasticsearch/config/ -

stat -: permission denied

That's weird. - is supposed to be STDOUT, why would it have permission denied and who calls stat?... Maybe it's docker cp.. in that case maybe it's fixable by a workaround using a tempfile...

slava-vishnyakov commented 4 years ago

Ok, yeah, I've got it working by changing it to use temp directory instead of stdin:

docker cp "${TEMP_DOCKER_CONTAINER_ID}:/usr/share/elasticsearch/config/" /tmp/1; cp /tmp/1/* "$SERVICE_HOST_ROOT/config/"

Though, it needs some improvement, because using a hardcoded /tmp/ name is not a good idea (especially if we run two :creates in parallel) and we need to cleanup afterwards.

slava-vishnyakov commented 4 years ago

Ok, so this works:

local TEMP_CONFIG_DIR=$(mktemp -d -t dokku-elasticsearch-XXXXXXXXXX)
docker cp "${TEMP_DOCKER_CONTAINER_ID}:/usr/share/elasticsearch/config/" "$TEMP_CONFIG_DIR"
cp -r "${TEMP_CONFIG_DIR}/config/"* "$SERVICE_HOST_ROOT/config/"
rm -rf "$TEMP_CONFIG_DIR"

instead of

docker cp "${TEMP_DOCKER_CONTAINER_ID}:/usr/share/elasticsearch/config/" - | \
  tar -x -C "$SERVICE_HOST_ROOT/config" --strip-components=1

@josegonzalez Got any opinion on whether this is a good idea? docker cp ... - seems to no longer work due to stat -: permission denied

P.S. If anyone wants to use this as a workaround: vi /var/lib/dokku/plugins/available/elasticsearch/functions - change the line 83, then elacticsearch:create, then git reset --hard in /var/lib/dokku/plugins/available/elasticsearch/.