Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install plugin ratelimit #220

Open
lpellegr opened this issue Sep 18, 2019 · 13 comments
Open

Cannot install plugin ratelimit #220

lpellegr opened this issue Sep 18, 2019 · 13 comments

Comments

@lpellegr
Copy link

Here is the command used:

docker build --build-arg plugins=ratelimit -t local/caddy github.com/abiosoft/caddy-docker.git

and the ouput error:

can't load package: package caddy:
ratelimit.go:2:10: invalid import path: ""
error at 'building caddy'

The plugin name ratelimit is found when I test with caddyplug install ratelimit.

Any idea what the problem is? how can I build this great caddy image with the ratelimit plugin?

@jeslinmx
Copy link

jeslinmx commented Sep 19, 2019

Did something upstream break the build system? I was getting this with plugins="git,login,jwt" and so I tried:

  caddy:
    image: abiosoft/caddy
    build:
      context: https://github.com/abiosoft/caddy-docker.git
      # args:
        # - plugins="git,login,jwt"
        # - enable_telemetry="false"
    restart: unless-stopped
    ...

i.e. default build variables. I got:

...
can't load package: package caddy: 
cors.go:2:10: invalid import path: ""
error at 'building caddy'
ERROR: Service 'caddy' failed to build: The command '/bin/sh -c VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh' returned a non-zero code: 1

@lpellegr
Copy link
Author

@abiosoft Any idea what the problem is?

@andrewandante
Copy link

I'm experiencing this too, with cors, expires and git plugins. I've tried updating from 1.0.1 to 1.0.3 and no luck.

Has previously been working on a slight variation of the Dockerfile-no-stats, now with no changes it suddenly won't build.

@andrewandante
Copy link

For reference, my dockerfile is

#
# Builder copied and amended from https://github.com/abiosoft/caddy-docker/blob/master/Dockerfile-no-stats
#
FROM abiosoft/caddy:builder as builder

ARG version="1.0.3"
ARG plugins="realip,expires,cache,ipfilter"

# process wrapper
RUN go get -v github.com/abiosoft/parent

RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=false /bin/sh /usr/bin/builder.sh

#
# Final stage
#
FROM alpine:3.10
LABEL maintainer "Abiola Ibrahim <abiola89@gmail.com>"

ARG version="1.0.3"
LABEL caddy_version="$version"

# Let's Encrypt Agreement
ENV ACME_AGREE="false"

# Telemetry Stats
ENV ENABLE_TELEMETRY="false"

RUN apk add --no-cache \
    ca-certificates \
    git \
    mailcap \
    openssh-client \
    tzdata

# install caddy
COPY --from=builder /install/caddy /usr/bin/caddy

# validate install
RUN /usr/bin/caddy -version
RUN /usr/bin/caddy -plugins

## Only expose 80
EXPOSE 80
WORKDIR /srv

# Set up our config and log file dirs
COPY ./conf/Caddyfile /etc/Caddyfile
RUN mkdir -p /etc/caddy/imports
COPY ./conf/imports/* /etc/caddy/imports/
COPY ./healthz.html /srv/healthz/index.html
COPY ./healthz.html /srv/index.html
COPY ./forbidden.html /srv/forbidden.html

# install process wrapper
COPY --from=builder /go/bin/parent /bin/parent

ENTRYPOINT ["/bin/parent", "caddy"]
CMD ["--conf", "/etc/Caddyfile", "--log", "stdout", "--agree=$ACME_AGREE"]

and my error output is similar:

go: extracting gopkg.in/yaml.v2 v2.2.2
can't load package: package caddy:
expires.go:2:10: invalid import path: ""
error at 'building caddy'
ERROR: Service 'caddy' failed to build: The command '/bin/sh -c VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=false /bin/sh /usr/bin/builder.sh' returned a non-zero code: 1

@abiosoft
Copy link
Owner

Let me try to reproduce this.

@lpellegr
Copy link
Author

@abiosoft Did you succeed to reproduce the issue?

@flecno
Copy link

flecno commented Sep 26, 2019

I have the same problem since last week. But I'm wondering that this breaks because there was no new changes in the builder image.

@andrewandante
Copy link

Small update from me - I had to rebuild it quickly, so ended up using the Dockerfile from https://hub.docker.com/r/productionwentdown/caddy/dockerfile as my base. However, what I did notice was this: productionwentdown/caddy#4 (comment)

Basically, you have to use the full name of the package, such as "github.com/captncraig/caddy-realip"

Mine is now up and running so I won't be re-trying this one, but it might be worth a quick test with the full plugin name, to see if that fixes it.

@abiosoft
Copy link
Owner

Some things have changed since the release of Caddy 2 beta. I'm working on updating caddy-docker to be compatible with Caddy 2. After that, these issues would be resolved.

@mcfilib
Copy link

mcfilib commented Oct 7, 2019

i've started seeing the same with other plugins too but wasn't able to get it working with @andrewandante's workaround.

@abiosoft anything we can do to help?

@lpellegr
Copy link
Author

lpellegr commented Oct 7, 2019

FYI, the change proposed in #223 as a workaround allows building an image with the desired plugins.

@mcfilib
Copy link

mcfilib commented Oct 7, 2019

@lpellegr aha, thanks for pointing that out!

@elsbrock
Copy link

Can confirm this fixes the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants