Skip to content

Document how to build with Docker #5

@jperville

Description

@jperville

Hi @deadtrickster , can you document how to build the plugin so that it can be installed with a specific version of the RabbitMQ docker image? I need to build the plugin because of your last comment prometheus-erl/prometheus_rabbitmq_exporter#12 (comment)

I tried to run ./rebar3 build as explained in the README.md, but I think I am missing some dependencies. Read on for how to reproduce.

I have written this Dockerfile:

# lock rabbitma image version to same we use in our compile image
FROM rabbitmq:3.6.8

ENV REVISION=v1.0.2

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y git && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN git clone https://github.com/deadtrickster/prometheus_process_collector.git
/usr/src/prometheus_process_collector && cd /usr/src/prometheus_process_collector && git checkout ${REVISION}

WORKDIR /usr/src/prometheus_process_collector

# copied from https://github.com/deadtrickster/prometheus_process_collector/blob/master/.travis.yml
RUN ./elvis rock && ./rebar3 compile

# Reset the rabbitmq image entrypoint so that we can debug
ENTRYPOINT /bin/bash

When I build the image, the "rebar3 compile" step fails with the following messages:

Unable to run pre hooks for 'compile', command 'compile' in namespace 'protobuf' not found

The full docker build trace is below:

Sending build context to Docker daemon 15.36 kB
Step 1/7 : FROM rabbitmq:3.6.8
 ---> 8cdcbee37f62
Step 2/7 : ENV REVISION v1.0.2
 ---> Using cache
 ---> 047355fe35cd
Step 3/7 : RUN apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y git &&     apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Using cache
 ---> bc2531a58382
Step 4/7 : RUN git clone https://github.com/deadtrickster/prometheus_process_collector.git /usr/src/prometheus_process_collector && cd /usr/src/prometheus_process_collector && git checkout ${REVISION}
 ---> Using cache
 ---> d75fc7f36e66
Step 5/7 : WORKDIR /usr/src/prometheus_process_collector
 ---> Using cache
 ---> b793622e7bd0
Step 6/7 : RUN ./elvis rock && ./rebar3 compile
 ---> Running in cc5ef474a9e6
Loading files...
Loading src/prometheus_process_collector.erl
Applying rules...
# src/prometheus_process_collector.erl [OK]
Loading files...
Applying rules...
Loading files...
Loading rebar.config
Applying rules...
# rebar.config [OK]
Loading files...
Loading elvis.config
Applying rules...
# elvis.config [OK]
===> Package prometheus-3.1.0 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Writing registry to /var/lib/rabbitmq/.cache/rebar3/hex/default/registry
===> Generating package index...
===> [ldb:0.0.3] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.7] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ishikawa:0.0.1] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.5] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.6] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [partisan:0.2.0] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [cloudi_service_oauth1:1.5.1] Only existing version of cloudi_service_db_riak is 1.3.3 which does not match constraint ~> 1.5.1. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.2] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [partisan:0.1.1] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.1] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.9] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.8] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.4] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> [ldb:0.0.10] Only existing version of acceptor_pool is 1.0.0-rc.0 which does not match constraint ~> 1.0.0-rc.0. Using anyway, but it is not guaranteed to work.
===> Writing index to /var/lib/rabbitmq/.cache/rebar3/hex/default/packages.idx
===> Verifying dependencies...
===> Fetching prometheus ({pkg,<<"prometheus">>,<<"3.1.0">>})
===> Downloaded package, caching at /var/lib/rabbitmq/.cache/rebar3/hex/default/packages/prometheus-3.1.0.tar
===> Fetching rebar3_gpb_plugin ({pkg,<<"rebar3_gpb_plugin">>,<<"1.7.3">>})
===> Downloaded package, caching at /var/lib/rabbitmq/.cache/rebar3/hex/default/packages/rebar3_gpb_plugin-1.7.3.tar
===> Fetching gpb ({pkg,<<"gpb">>,<<"3.24.4">>})
===> Downloaded package, caching at /var/lib/rabbitmq/.cache/rebar3/hex/default/packages/gpb-3.24.4.tar
===> Compiling gpb
/usr/lib/erlang/lib/parsetools-2.1.4/include/leexinc.hrl: no such file or directory
===> Compiling /usr/src/prometheus_process_collector/_build/default/plugins/gpb/src/gpb_scan.xrl failed
/usr/lib/erlang/lib/parsetools-2.1.4/include/leexinc.hrl:none: no such file or directory

===> Plugin {rebar3_gpb_plugin,"1.7.3"} not available. It will not be used.
===> Fetching coveralls ({git,"https://github.com/markusn/coveralls-erl",
                              "master"})
===> WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.
===> Compiling coveralls
===> Compiling prometheus
===> Unable to run pre hooks for 'compile', command 'compile' in namespace 'protobuf' not found.
The command '/bin/sh -c ./elvis rock && ./rebar3 compile' returned a non-zero code: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions