dokku / plugn

Hook system that lets users extend your application with plugins
MIT License
82 stars 22 forks source link

Issue with docker-based install, plugin-list, and restarting dokku container #51

Closed pickettd closed 5 months ago

pickettd commented 3 years ago

Description of problem

I'm using the docker-based install instructions for a local dev/test environment. I am able to use the plugin-list file in order to have the dokku system install a plugin when it first runs (in my test case I am trying mongo). However if I stop the dokku container and then try to restart the dokku container, I get an error that the plugin installer is trying to install a plugin that is already installed.

How reproducible

Every time I use plugin-list with a docker-based install and want to restart the dokku container

Steps to Reproduce

  1. echo "mongo: https://github.com/dokku/dokku-mongo.git" > /var/lib/dokku/plugin-list
  2. docker container run \ --env DOKKU_HOSTNAME=dokku.me \ --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.24.3

3.docker stop dokku

  1. docker start dokku

Actual Results

The dokku container won't restart in step 4 (has an error from the plugin installer about mongo already existing)

Expected Results

I would expect to be able to restart the stopped dokku container and continue using it. My suggested fix is to change /etc/my_init.d/10_dokku_init in the plugin-install section to check if the files are already present. If they are present, maybe uninstall them? Or if they are present, maybe skip the plugin install?

Environment Information

dokku report output

root@33e2743ea83a:/tmp# dokku report -----> uname: Linux 33e2743ea83a 4.19.128-microsoft-standard dokku/dokku#1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux -----> memory: total used free shared buff/cache available Mem: 25590 1678 6987 400 16925 23218 Swap: 7168 0 7168 -----> docker version: Client: Version: 19.03.6 API version: 1.40 Go version: go1.12.17 Git commit: 369ce74a3c Built: Fri Dec 18 12:21:44 2020 OS/Arch: linux/amd64 Experimental: false

   Server: Docker Engine - Community
    Engine:
     Version:          20.10.5
     API version:      1.41 (minimum version 1.12)
     Go version:       go1.13.15
     Git commit:       363e9a8
     Built:            Tue Mar  2 20:15:47 2021
     OS/Arch:          linux/amd64
     Experimental:     false
    containerd:
     Version:          1.4.3
     GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
    runc:
     Version:          1.0.0-rc92
     GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
    docker-init:
     Version:          0.19.0
     GitCommit:        de40ad0

-----> docker daemon info: Client: Debug Mode: true

   Server:
    Containers: 8

WARNING: No blkio throttle.read_bps_device support WARNING: No blkio throttle.write_bps_device support WARNING: No blkio throttle.read_iops_device support WARNING: No blkio throttle.write_iops_device support WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled Running: 1 Paused: 0 Stopped: 7 Images: 20 Server Version: 20.10.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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff init version: de40ad0 Security Options: seccomp Profile: default Kernel Version: 4.19.128-microsoft-standard Operating System: Docker Desktop OSType: linux Architecture: x86_64 CPUs: 12 Total Memory: 24.99GiB Name: docker-desktop ID: CFNM:7NYX:GBLL:45HZ:IVBC:DCUV:ZUIM:7CQF:CFAH:BPC7:E5S7:VWMP 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

-----> git version: git version 2.17.1 -----> sigil version: 0.6.0 -----> herokuish version: herokuish: 0.5.26 buildpacks: heroku-buildpack-multi v1.0.0 heroku-buildpack-ruby v224 heroku-buildpack-nodejs v183 heroku-buildpack-clojure v87 heroku-buildpack-python v191 heroku-buildpack-java v69 heroku-buildpack-gradle v35 heroku-buildpack-scala v89 heroku-buildpack-play v26 heroku-buildpack-php v189 heroku-buildpack-go v152 buildpack-nginx v14 buildpack-null v3 -----> dokku version: dokku version 0.24.2 -----> plugn version: plugn: 0.6.1 -----> dokku plugins: 00_dokku-standard 0.24.2 enabled dokku core standard plugin app-json 0.24.2 enabled dokku core app-json pluginplugin apps 0.24.2 enabled dokku core apps plugin builder 0.24.2 enabled dokku core builder plugin builder-dockerfile 0.24.2 enabled dokku core builder-dockerfile plugin builder-herokuish 0.24.2 enabled dokku core builder-herokuish plugin builder-pack 0.24.2 enabled dokku core builder-pack plugin buildpacks 0.24.2 enabled dokku core buildpacks plugin certs 0.24.2 enabled dokku core certificate management plugin checks 0.24.2 enabled dokku core checks plugin common 0.24.2 enabled dokku core common plugin config 0.24.2 enabled dokku core config plugin cron 0.24.2 enabled dokku core cron plugin docker-options 0.24.2 enabled dokku core docker-options plugin domains 0.24.2 enabled dokku core domains plugin enter 0.24.2 enabled dokku core enter plugin git 0.24.2 enabled dokku core git plugin logs 0.24.2 enabled dokku core logs plugin mongo 1.11.6 enabled dokku mongo service plugin network 0.24.2 enabled dokku core network plugin nginx-vhosts 0.24.2 enabled dokku core nginx-vhosts plugin plugin 0.24.2 enabled dokku core plugin plugin proxy 0.24.2 enabled dokku core proxy plugin ps 0.24.2 enabled dokku core ps plugin repo 0.24.2 enabled dokku core repo plugin resource 0.24.2 enabled dokku core resource plugin shell 0.24.2 enabled dokku core shell plugin ssh-keys 0.24.2 enabled dokku core ssh-keys plugin storage 0.24.2 enabled dokku core storage plugin tags 0.24.2 enabled dokku core tags plugin tar 0.24.2 enabled dokku core tar plugin

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

Docker-install WSL2 Ubuntu-20.04

Additional information

Right now I'm using something like this in my 10_dokku_init file as a workaround but I'm not sure what the right solution is exactly:

if [[ -f /mnt/dokku/plugin-list ]]; then
    while read line; do
      if [[! -e /var/lib/dokku/plugins/available/"$(echo "$line" | cut -d':' -f1)"]]; then
        dokku plugin:install "$(echo "$line" | awk '{print $2}')" "$(echo "$line" | cut -d':' -f1)"
      fi
    done </mnt/dokku/plugin-list
  fi
josegonzalez commented 3 years ago

Okay the fix here is actually to change plugn to handle an existing plugin:

josegonzalez commented 5 months ago

@killjoy1221 would you be willing to take a look at this issue?