"github.com/mholt/caddy/caddytls"
// This is where other plugins get plugged in (imported)
_ "github.com/hacdias/filemanager"
_ "github.com/miekg/caddy-prometheus"
)
I performed a go get for each of those plugin github URLs. Then, while still within src/github.com/mholt/caddy/caddy I ran go run build.go to create the caddy binary. Next I ran caddy -plugins and didn’t see either of the two plugins listed. Running the caddy binary works fine without directives for the plugins, using the prometheus directive results in the following message:
no action found for directive ‘prometheus’ with server type ‘http’ (missing a plugin?)
Perhaps that wiki page is out of date?
Do something crazy, like delete a huge swath of code in run.go, save it, and run build.go. If it doesn’t throw a compile error, then something is definitely wrong with your environment…
I tried deleting stuff and it errored out so I went nuclear and deleted everything in $GOPATH to try a fresh start.
Still couldn’t get the wiki steps to work but I did get it to work when I copy and pasted this:
go get github.com/mholt/caddy
go get github.com/caddyserver/builds
cd "$GOPATH/src/github.com/mholt/caddy/caddy"
cat <<EOF>caddymain/plugins.go
package caddymain
import (
_ "github.com/hacdias/filemanager"
_ "github.com/miekg/caddy-prometheus"
)
EOF
go get -u -v -f ... || echo "Updated dependencies"
go run build.go
EXCEPT that only http.prometheus worked, http.filemanager does not. That is, I can see prometheus with caddy -plugins and using the directive works, the metrics page works, but filemanager does not show up anywhere and gives me the message “no action found for directive ‘filemanager’ with server type ‘http’ (missing a plugin?)”.
Not sure what that says about the wiki’s method of building caddy, but either way I think there is a issue with the filemanager plugin. I think I’ll raise an issue with them tomorrow.
If your build still fails, you can clone my repo at github.com/ulrichSchreiner/caddy-http and add this import to the plugins.go file. you will get a container with a caddy binary and a filemanager plugin.