speedplane
speedplane

Reputation: 16141

Easy Way to Install RabbitMQ on Ubuntu Xenial (Ubuntu 16.04)

Are there any clear, concise instructions for creating a Docker container with rabbitmq on Xenial that actually work?

I'm running rabbitmq in a Docker container and for some reason, installing it is a nightmare. Every time Erlang or rabbitmq has some update, one becomes incompatible with the other, and I get cryptic dependency issues. The rabbitmq installation page does not provide step-by-step instructions, and every permutation I've tried has some sort of error (see below for the latest).

Dockerfile:

RUN  wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
RUN dpkg -i erlang-solutions_1.0_all.deb
RUN apt-get update
# Then install rabbitmq.
RUN echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | \
    tee /etc/apt/sources.list.d/bintray.rabbitmq.list && \
    wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc | \
    apt-key add -

Cryptic rabbitmq error:

=SUPERVISOR REPORT==== 26-Jun-2018::03:04:55.163161 ===
    supervisor: {local,'Elixir.Logger.Supervisor'}
    errorContext: start_error
    reason: noproc

Upvotes: 0

Views: 1026

Answers (3)

Luke Bakken
Luke Bakken

Reputation: 9667

When you install using the Erlang Solutions packages, apt will install the latest version of Erlang that they provide. At this time, that is version 21, which is not yet supported by RabbitMQ. This is why you are getting that Elixir error.

If you search the rabbitmq-users mailing list for the string Elixir.Logger.Supervisor, you will hit this discussion, which also explains the cause of this problem.

To install the latest supported version of Erlang on Ubuntu, apt requires you to not only specify the meta-package version you want but also all of the dependencies with their versions. This is unfortunate, but can be accomplished by running this command:

apt-get install erlang-nox=1:20.3-1 \
    $(apt-cache show erlang-nox=1:20.3-1 | grep Depends | \
        tr ' ' '\n' | grep erlang | \
        grep -v erlang-base-hipe | tr -d ',' | sed 's/$/=1:20.3-1/')

See Roger's answer that involves pinning!

Upvotes: 0

speedplane
speedplane

Reputation: 16141

The two answers posted here are admirable, but they don't answer the original question: provide a Dockerfile that installs compatible versions of Erlang and rabbitmq.

Below is such a solution (took much trial and error). It installs erlang 1:20.3.6 and rabbitmq 3.7.6. Changing the version should only require a change to the last line of this Dockerfile.

# Install Erlang + Rabbitmq
# Install the erlang downloader
RUN wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \
    dpkg -i erlang-solutions_1.0_all.deb
# Add the rabbitmq source list
RUN echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | \
    tee /etc/apt/sources.list.d/bintray.rabbitmq.list && \
    wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | apt-key add -
# Check which rabbitmq/erlang versions are compatible and isntall:
#       https://www.rabbitmq.com/which-erlang.html
RUN apt-get update && \
    apt-get install -y esl-erlang=1:20.3.6 rabbitmq-server=3.7.6-1

Upvotes: 2

Roger Lipscombe
Roger Lipscombe

Reputation: 91965

To pin the Erlang version to one that RabbitMQ currently supports, create /etc/apt/preferences.d/erlang containing the following:

Package: esl-erlang erlang*
Pin: version 1:20.3*
Pin-Priority: 999

(per https://askubuntu.com/a/926030/158095)

Upvotes: 0

Related Questions