Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

changed the os #18

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
FROM ubuntu:trusty
MAINTAINER Fernando Mayo <[email protected]>
FROM buildpack-deps:stretch-scm
MAINTAINER nest.yt
#MAINTAINER based on work by Fernando Mayo <[email protected]>

# Add scripts
ADD run.sh /run.sh
ADD set_rabbitmq_password.sh /set_rabbitmq_password.sh

# Install RabbitMQ
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F7B8CEA6056E8E56 && \
RUN apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys F7B8CEA6056E8E56 && \
echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y rabbitmq-server pwgen && \
rabbitmq-plugins enable rabbitmq_management && \
apt-get install -y --force-yes rabbitmq-server jq pwgen && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN echo "ERLANGCOOKIE" > /var/lib/rabbitmq/.erlang.cookie
RUN chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
RUN chmod 400 /var/lib/rabbitmq/.erlang.cookie

# Add scripts
ADD run.sh /run.sh
ADD set_rabbitmq_password.sh /set_rabbitmq_password.sh
RUN chmod 755 ./*.sh
rm -rf /var/lib/apt/lists/* && \
rabbitmq-plugins enable rabbitmq_management && \
rabbitmq-plugins enable rabbitmq_tracing && \
echo "ERLANGCOOKIE" > /var/lib/rabbitmq/.erlang.cookie && \
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie && \
chmod 400 /var/lib/rabbitmq/.erlang.cookie && \
chmod 755 ./*.sh

EXPOSE 5672 15672
CMD ["/run.sh"]
99 changes: 2 additions & 97 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,3 @@
tutum-docker-rabbitmq
=====================
# docker.nest.rabbitmq

**This image will be deprecated soon. Please use the docker official image:** https://hub.docker.com/_/rabbitmq/

[![Deploy to Tutum](https://s.tutum.co/deploy-to-tutum.svg)](https://dashboard.tutum.co/stack/deploy/)

Base docker image to run a RabbitMQ server


Usage
-----

To create the image `tutum/rabbitmq`, execute the following command on the tutum-rabbitmq folder:

sudo docker build -t tutum/rabbitmq .


Running the RabbitMQ server
---------------------------

Run the following command to start rabbitmq:

docker run -d -p 5672:5672 -p 15672:15672 tutum/rabbitmq

The first time that you run your container, a new random password will be set.
To get the password, check the logs of the container by running:

docker logs <CONTAINER_ID>

You will see an output like the following:

========================================================================
You can now connect to this RabbitMQ server using, for example:

curl --user admin:5elsT6KtjrqV http://<host>:<port>/api/vhosts

Please remember to change the above password as soon as possible!
========================================================================

In this case, `5elsT6KtjrqV` is the password set.
You can then connect to RabbitMQ:

curl --user admin:5elsT6KtjrqV http://<host>:<port>/api/vhosts

Done!


Setting a specific password for the admin account
-------------------------------------------------

If you want to use a preset password instead of a randomly generated one, you can
set the environment variable `RABBITMQ_PASS` to your specific password when running the container:

docker run -d -p 5672:5672 -p 15672:15672 -e RABBITMQ_PASS="mypass" tutum/rabbitmq

You can now test your new admin password:

curl --user admin:mypass http://<host>:<port>/api/vhosts


Running a RabbitMQ cluster
--------------------------

To run a cluster with all the DNS-Reachable Host, you have to set `RABBITMQ_USE_LONGNAME`
and `HOSTNAME` on first server :

```
docker run -d \
-p 5672:5672 -p 15672:15672 -p 35197:35197 -p 4369:4369 -p 25672:25672 \
-e HOSTNAME=node1.host.io \
-e RABBITMQ_USE_LONGNAME=true \
tutum/rabbitmq
```

And add `CLUSTER_WITH` for the others nodes :

```
docker run -d \
-p 5672:5672 -p 15672:15672 -p 35197:35197 -p 4369:4369 -p 25672:25672 \
-e HOSTNAME=node2.host.io \
-e RABBITMQ_USE_LONGNAME=true \
-e CLUSTER_WITH=node1.host.io \
tutum/rabbitmq
```
RabbitMQ cluster stack file with Tutum
------------------------------------

```
rabbitmq-master:
image: tutum/rabbitmq
rabbitmq-slave:
image: tutum/rabbitmq
environment:
- CLUSTER_WITH=rabbitmq-master-1
links:
- rabbitmq-master
```
A container used by Nester Develop for working on RabbitMQ development.
19 changes: 6 additions & 13 deletions set_rabbitmq_password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ if [ -f /.rabbitmq_password_set ]; then
exit 0
fi

PASS=${RABBITMQ_PASS:-$(pwgen -s 12 1)}
USER=${RABBITMQ_USER:-"admin"}
_word=$( [ ${RABBITMQ_PASS} ] && echo "preset" || echo "random" )
USER=${NEST_APP_TAG}
PASS=${NEST_SERVICES_PASSWORD}

_word=$( [ ${RABBITMQ_PASS} ] && echo "preset" )
echo "=> Securing RabbitMQ with a ${_word} password"
cat > /etc/rabbitmq/rabbitmq.config <<EOF
[
Expand All @@ -21,14 +22,6 @@ touch /.rabbitmq_password_set
echo "========================================================================"
echo "You can now connect to this RabbitMQ server using, for example:"
echo ""

if [ ${_word} == "random" ]; then
echo " curl --user $USER:$PASS http://<host>:<port>/api/vhosts"
echo ""
echo "Please remember to change the above password as soon as possible!"
else
echo " curl --user $USER:<RABBITMQ_PASS> http://<host>:<port>/api/vhosts"
echo ""
fi

echo " curl --user $USER:<RABBITMQ_PASS> http://<host>:<port>/api/vhosts"
echo ""
echo "========================================================================"
5 changes: 0 additions & 5 deletions tutum.yml

This file was deleted.