Loki: Can't install fluent-plugin-grafana-loki

Created on 5 Jul 2019  路  12Comments  路  Source: grafana/loki

gem install fluent-plugin-grafana-loki, as described in the fluent plugin README, errors, as illustrated by this docker build:

$ docker build . <<EOF
FROM fluent/fluentd:v1.4-debian-2

USER root

RUN gem install fluent-plugin-grafana-loki

USER fluent
EOF
Sending build context to Docker daemon  13.31kB
Step 1/4 : FROM fluent/fluentd:v1.4-debian-2
 ---> 48ed3b8e9450
Step 2/4 : USER root
 ---> Running in 28b51bb6a786
Removing intermediate container 28b51bb6a786
 ---> 2c778bec3cbc
Step 3/4 : RUN gem install fluent-plugin-grafana-loki
 ---> Running in 852d185ecfe0
ERROR:  While executing gem ... (Gem::Package::PathError)
    installing into parent path /usr/local/bundle/LICENSE of /usr/local/bundle/gems/fluent-plugin-grafana-loki-1.0.0 is not allowed
The command '/bin/sh -c gem install fluent-plugin-grafana-loki' returned a non-zero code: 1
kinbug

Most helpful comment

let me bump the version number and publish the new gem

All 12 comments

Dockerfile illustrating temporary workaround (install from source):

FROM fluent/fluentd:v1.4-debian-2

USER root

RUN apt-get update \
    && apt-get install -y --no-install-recommends git \
    && rm -rf /var/lib/apt/lists/*

#Install fluent-plugin-grafana-loki from source
#https://github.com/grafana/loki/issues/719
RUN rm -rf /tmp/loki \
    && git clone --depth 1 https://github.com/grafana/loki.git /tmp/loki \
    && cd /tmp/loki/fluentd/fluent-plugin-grafana-loki \
    && sed -i "s|^  spec.files.*|  spec.files = Dir.glob('{bin,lib}/**/*')|" fluent-plugin-grafana-loki.gemspec \
    && gem build fluent-plugin-grafana-loki.gemspec \
    && gem install fluent-plugin-grafana-loki-*.gem \
    && cd /tmp \
    && rm -rf /tmp/loki

USER fluent

I think this is related to this: https://github.com/grafana/loki/pull/682

Ah, yes, didn鈥檛 see that PR before opening. I can close as a duplicate, but it might be useful to have the workaround code available until #682 is merged.

how about now ?

I still see this issue:

ERROR:  While executing gem ... (Gem::Package::PathError)
    installing into parent path /opt/td-agent/embedded/lib/ruby/gems/2.4.0/LICENSE of /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-grafana-loki-1.0.0 is not allowed

I think that version bump will be needed as here: https://rubygems.org/gems/fluent-plugin-grafana-loki/ we still have old 1.0.0 version which is same as here: https://github.com/grafana/loki/blob/master/fluentd/fluent-plugin-grafana-loki/fluent-plugin-grafana-loki.gemspec#L5

/cc @briangann Can you help me out here ? How do we handle gems ?

let me bump the version number and publish the new gem

I tried it just now and see the same problem:

root@fluentd:~# gem install fluent-plugin-grafana-loki
Fetching: fluent-plugin-grafana-loki-1.0.0.gem (100%)
ERROR:  While executing gem ... (Gem::Package::PathError)
    installing into parent path /var/lib/gems/2.3.0/LICENSE of /var/lib/gems/2.3.0/gems/fluent-plugin-grafana-loki-1.0.0 is not allowed

This is under Ubuntu 16.04.5.

root@fluentd:~# ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

Probably not worth bumping the version number until #749 is fixed anyway

do we need to bump it again ?

Yes. #750 / #751 did not change any gem packaging.

Can someone tell me which image of Fluentd do I have to use finally which includes the loki-gem to deploy flunetd as a daemonset?

Was this page helpful?
0 / 5 - 0 ratings