dokku / plugn

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

Add warnings to report ouput when registered plugin triggers are not all executable #53

Closed tianhuil closed 2 years ago

tianhuil commented 3 years ago

Description of problem

I wrote a Dokkku plugin here dokku-docker-monorepo which is based on dokku-monorepo. However, it isn't even being detected. I'm installing both the same way but dokku-monorepo is detected by dokku (and works correctly) while dokku-docker-monorepo is not. Am I missing something?

How reproducible

Follow the instructions at dokku-docker-monorepo and (dokku-monorepo) to compare.

Actual Results

I do not see "Docker Monorepo Plugin installed" printed to the screen.

Expected Results

I expect to see "Docker Monorepo Plugin installed" printed to the screen, which it should do unconditionally (see https://github.com/tianhuil/dokku-docker-monorepo/blob/main/post-extract).

Environment Information

dokku report APP_NAME output

The build fails and did not update the app so I don't think this is important.

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

Running on Digital Ocean:

➜  ~ dokku report
-----> uname: Linux tianhuil2 5.4.0-72-generic dokku/dokku#80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
                     total        used        free      shared  buff/cache   available
       Mem:          16012        1915        1968         151       12129       13798
       Swap:             0           0           0
-----> docker version:
       Client: Docker Engine - Community
        Version:           20.10.5
        API version:       1.41
        Go version:        go1.13.15
        Git commit:        55c4c88
        Built:             Tue Mar  2 20:18:20 2021
        OS/Arch:           linux/amd64
        Context:           default
        Experimental:      true

       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:16:15 2021
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          v1.3.7
         GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
        runc:
         Version:          1.0.0-rc93
         GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
        docker-init:
         Version:          0.19.0
         GitCommit:        de40ad0
-----> docker daemon info:
       Client:
        Context:    default
        Debug Mode: true
        Plugins:
         app: Docker App (Docker Inc., v0.9.1-beta3)
         buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

       Server:
        Containers: 76
         Running: 4
         Paused: 0
         Stopped: 72
        Images: 220
        Server Version: 20.10.5
        Storage Driver: overlay2
WARNING: No swap limit support
         Backing Filesystem: extfs
         Supports d_type: true
         Native Overlay Diff: true
        Logging Driver: json-file
        Cgroup Driver: cgroupfs
        Cgroup Version: 1
        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.runtime.v1.linux runc io.containerd.runc.v2
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
        runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
        init version: de40ad0
        Security Options:
         apparmor
         seccomp
          Profile: default
        Kernel Version: 5.4.0-72-generic
        Operating System: Ubuntu 20.04.1 LTS
        OSType: linux
        Architecture: x86_64
        CPUs: 8
        Total Memory: 15.64GiB
        Name: tianhuil2
        ID: 6UDG:LT6K:VJMZ:VGBJ:4LLF:QAXE:TNS5:4X35:MFYS:2RBS:KLLT:6TCB
        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.25.1
-----> sigil version: 0.6.0
-----> herokuish version:
       herokuish: 0.5.27
       buildpacks:
         heroku-buildpack-multi     v1.0.0
         heroku-buildpack-ruby      v225
         heroku-buildpack-nodejs    v183
         heroku-buildpack-clojure   v87
         heroku-buildpack-python    v191
         heroku-buildpack-java      v69
         heroku-buildpack-gradle    v35
         heroku-buildpack-scala     v90
         heroku-buildpack-play      v26
         heroku-buildpack-php       v190
         heroku-buildpack-go        v153
         buildpack-nginx            v14
         buildpack-null             v3
-----> dokku version: dokku version 0.24.7
-----> plugn version: plugn: 0.6.1
-----> dokku plugins:
         00_dokku-standard    0.24.7 enabled    dokku core standard plugin
         20_events            0.24.7 enabled    dokku core events logging plugin
         app-json             0.24.7 enabled    dokku core app-json plugin
         apps                 0.24.7 enabled    dokku core apps plugin
         builder              0.24.7 enabled    dokku core builder plugin
         builder-dockerfile   0.24.7 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.24.7 enabled    dokku core builder-herokuish plugin
         builder-pack         0.24.7 enabled    dokku core builder-pack plugin
         buildpacks           0.24.7 enabled    dokku core buildpacks plugin
         certs                0.24.7 enabled    dokku core certificate management plugin
         checks               0.24.7 enabled    dokku core checks plugin
         common               0.24.7 enabled    dokku core common plugin
         config               0.24.7 enabled    dokku core config plugin
         cron                 0.24.7 enabled    dokku core cron plugin
         docker-monorepo      0.0.1 enabled    Deploy all apps from a monorepo specified by Dockerfiles.
         docker-options       0.24.7 enabled    dokku core docker-options plugin
         domains              0.24.7 enabled    dokku core domains plugin
         enter                0.24.7 enabled    dokku core enter plugin
         git                  0.24.7 enabled    dokku core git plugin
         letsencrypt          0.11.9 enabled    Automated installation of let's encrypt TLS certificates
         logs                 0.24.7 enabled    dokku core logs plugin
         monorepo             0.1.0 enabled    Deploy all apps from a monorepo.
         network              0.24.7 enabled    dokku core network plugin
         nginx-vhosts         0.24.7 enabled    dokku core nginx-vhosts plugin
         plugin               0.24.7 enabled    dokku core plugin plugin
         postgres             1.12.0 enabled    dokku postgres service plugin
         proxy                0.24.7 enabled    dokku core proxy plugin
         ps                   0.24.7 enabled    dokku core ps plugin
         repo                 0.24.7 enabled    dokku core repo plugin
         resource             0.24.7 enabled    dokku core resource plugin
         scheduler-docker-local 0.24.7 enabled    dokku core scheduler-docker-local plugin
         shell                0.24.7 enabled    dokku core shell plugin
         ssh-keys             0.24.7 enabled    dokku core ssh-keys plugin
         storage              0.24.7 enabled    dokku core storage plugin
         tags                 0.24.7 enabled    dokku core tags plugin
         tar                  0.24.7 enabled    dokku core tar plugin
         trace                0.24.7 enabled    dokku core trace plugin

Additional information

josegonzalez commented 3 years ago

Can you include the output of a deploy after enabling trace mode via dokku trace:on?

tianhuil commented 3 years ago

Thanks for the quick response @josegonzalez: here it is: https://gist.github.com/tianhuil/7b9935bb9c372f50a825ac6642b4da0e

josegonzalez commented 3 years ago

Oh I see what is going on. The post-extract file is not executable, so it is being skipped. You need to do chmod +x on it, commit that, upgrade the plugin, and then it should work.

tianhuil commented 3 years ago

Thanks so much @josegonzalez! Should have caught that one.

Does it make sense for dokku to warn if it encounters a non-executable file in an extension (with trace being off?). For example: "Encountered apparent hook file post-extract in extension dokku-docker-monorepo that was not executable and is ignored. Run chmod +x post-extract to make it executable." It seems that if a hook file exists, the user probably intended that it should be run and it's not only because of an oversight.

josegonzalez commented 3 years ago

I was thinking about this and have decided that while it would be useful, the proper place to log it would be in plugn.