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

Enable RabbitMQ mirrored queues #1226

Merged
merged 21 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
894975e
Added definitions.json file to define and set RabbitMQ policies for HA
vincenzodnp Sep 5, 2019
dcd1824
- Changed RabbitMQ default ha-policy to "exactly" instead of "all"
vincenzodnp Sep 5, 2019
d81f8e3
Merge branch 'master' into 1098-rabbitmq-mirrored-queues
vincenzodnp Sep 5, 2019
a80cc57
Update Dockerfile
vincenzodnp Sep 6, 2019
644f46b
Added REPLACE_VHOST replace patter for vhosts variable
vincenzodnp Sep 6, 2019
6bd1652
New ENV variables logic
vincenzodnp Sep 6, 2019
dc5d8aa
RabbitMQ image consistent ENTRYPOINT
vincenzodnp Sep 6, 2019
a75127c
Protect variables with single ticks and copy /bin/ep from commons
vincenzodnp Sep 6, 2019
5df283d
Removed RABBITMQ_DEFAULT_VHOST variable (keep default value)
vincenzodnp Sep 6, 2019
91e204f
Removed unused binaries
vincenzodnp Sep 6, 2019
d4fc1dd
Added fix-permissions binary
vincenzodnp Sep 6, 2019
69b5c5d
Run fix-permissions instead of chgrp and chown
vincenzodnp Sep 6, 2019
080f80d
Update images/rabbitmq/Dockerfile
Schnitzel Sep 7, 2019
ace564a
Added RabbitMQ image documentation
vincenzodnp Sep 9, 2019
8644f4b
Fix typos and amazee.io references
vincenzodnp Sep 9, 2019
4cd1db6
Merge branch 'master' into 1098-rabbitmq-mirrored-queues
Schnitzel Sep 19, 2019
64803fe
Merge branch 'master' into 1098-rabbitmq-mirrored-queues
Schnitzel Sep 20, 2019
1b57816
Added `ARG IMAGE_REPO` to fix image test
vincenzodnp Sep 23, 2019
cd9e17f
Merge branch 'master' into 1098-rabbitmq-mirrored-queues
Schnitzel Sep 24, 2019
aad15ce
Merge branch 'master' into 1098-rabbitmq-mirrored-queues
Schnitzel Sep 24, 2019
7dd5b43
Merge branch 'master' into 1098-rabbitmq-mirrored-queues
Schnitzel Sep 25, 2019
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
7 changes: 7 additions & 0 deletions images/rabbitmq-cluster/cluster-rabbit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ echo NODENAME=rabbit@${HOSTNAME}.${SERVICE_NAME}-headless.${POD_NAMESPACE}.svc.c
echo cluster_formation.k8s.hostname_suffix=.${SERVICE_NAME}-headless.${POD_NAMESPACE}.svc.cluster.local >> /etc/rabbitmq/rabbitmq.conf
echo cluster_formation.k8s.service_name=${SERVICE_NAME}-headless >> /etc/rabbitmq/rabbitmq.conf

# Replace placeholders with ENV values and copy file to rabbitmq conf directory
if [ -e /etc/rabbitmq/definitions.json ]; then
sed -i -e "s/REPLACE_USERNAME/${RABBITMQ_DEFAULT_USER}/g" \
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved
-e "s/REPLACE_PASSWORD/${RABBITMQ_DEFAULT_PASS}/g" \
-e "s/REPLACE_QUEUE_PATTERN/${RABBITMQ_DEFAULT_HA_PATTERN}/g" /etc/rabbitmq/definitions.json
fi

# start the server
docker-entrypoint.sh rabbitmq-server
17 changes: 14 additions & 3 deletions images/rabbitmq/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ FROM rabbitmq:3-management
ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION

COPY rabbitmq_delayed_message_exchange-3.7.0.ez /plugins
ENV RABBITMQ_DEFAULT_USER=guest \
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved
RABBITMQ_DEFAULT_PASS="guest"\
RABBITMQ_DEFAULT_HA_PATTERN='^lagoon-'
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved


COPY rabbitmq_delayed_message_exchange-3.7.0.ez /plugins
RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange;

ENV RABBITMQ_DEFAULT_USER=guest \
RABBITMQ_DEFAULT_PASS="guest"
# Copy startup schema with vhost, users, permissions and policies
COPY definitions.json /etc/rabbitmq/definitions.json
RUN chgrp 0 /etc/rabbitmq/definitions.json; chmod g+rw /etc/rabbitmq/definitions.json
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved

# Copy a custom entrypoint
ADD cluster-rabbit.sh /
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved
RUN chgrp 0 /cluster-rabbit.sh; chmod +x /cluster-rabbit.sh
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved

ENTRYPOINT /cluster-rabbit.sh
11 changes: 11 additions & 0 deletions images/rabbitmq/cluster-rabbit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# Replace placeholders with ENV values and copy file to rabbitmq conf directory from ConfigMap
if [ -e /etc/rabbitmq/definitions.json ]; then
sed -i -e "s/REPLACE_USERNAME/${RABBITMQ_DEFAULT_USER}/g" \
-e "s/REPLACE_PASSWORD/${RABBITMQ_DEFAULT_PASS}/g" \
-e "s/REPLACE_QUEUE_PATTERN/${RABBITMQ_DEFAULT_HA_PATTERN}/g" /etc/rabbitmq/definitions.json
fi

# start the server
docker-entrypoint.sh rabbitmq-server
14 changes: 14 additions & 0 deletions images/rabbitmq/definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"vhosts":[
{"name": "/"}
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved
],
"users": [
{ "name": "REPLACE_USERNAME", "password": "REPLACE_PASSWORD", "tags": "administrator" }
],
"permissions":[
{ "user": "REPLACE_USERNAME", "vhost": "/", "configure": ".*", "write": ".*", "read": ".*" }
],
"policies":[
{"vhost":"/","name":"lagoon-ha","pattern":"REPLACE_QUEUE_PATTERN", "definition":{"ha-mode":"exactly","ha-params":2,"ha-sync-mode":"automatic","ha-sync-batch-size":5}}
]
}
2 changes: 2 additions & 0 deletions services/broker/.lagoon.app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ objects:
key: RABBITMQ_PASSWORD
- name: RABBITMQ_USE_LONGNAME
value: "true"
- name: RABBITMQ_DEFAULT_HA_PATTERN
value: "^lagoon-"
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved
- name: POD_NAMESPACE
valueFrom:
fieldRef:
Expand Down