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 1 commit
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
34 changes: 34 additions & 0 deletions docs/using_lagoon/docker_images/rabbitmq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# rabbitmq Image
amazee.io RabbitMQ Dockerfile with management plugin installed, based on the official rabbitmq:3-management image at [docker-hub](https://hub.docker.com/_/rabbitmq).
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved

This Dockerfile is intended to be used to setup a standalone RabbitMQ queue broker as well as base image to setup a cluster with HA queues support by default ([Mirrored queues](https://www.rabbitmq.com/ha.html)).
By default the RabbitMQ broker is started as single node. If you want to start a cluster, you need to use the [`rabbitmq-cluster`](https://github.com/amazeeio/lagoon/blob/master/images/rabbitmq-cluster/Dockerfile) Docker image, based on `rabbitmq` image plus the `rabbitmq_peer_discovery_k8s` plugin.

## amazee.io & OpenShift adaptions
This image is prepared to be used on amazee.io which leverages OpenShift. There are therefore some things already done:

- Folder permissions are automatically adapted with [`fix-permissions`](https://github.com/sclorg/s2i-base-container/blob/master/core/root/usr/bin/fix-permissions) so this image will work with a random user and therefore also on OpenShift.
- The file `/etc/rabbitmq/definitions.json` is parsed through [envplate](https://github.com/kreuzwerker/envplate) with an container-entrypoint.

## Included RabbitMQ default schema (definitions.json)
To enable the support for Mirrored Queues, at least one [`policy`](https://www.rabbitmq.com/parameters.html#policies) must exists.
Into the `definitions.json` schema file, are definied the minimal entities to let the container running: virtualhost (vhost), username and password to access management UI, permissions and policies.

By default a policy called `lagoon-ha` is created at startup but it is not active because it doesn't match any queue's name pattern (see default [Environment Variables](#environment-variables)).
```
"policies":[
{"vhost":"${RABBITMQ_DEFAULT_VHOST}","name":"lagoon-ha","pattern":"${RABBITMQ_DEFAULT_HA_PATTERN}", "definition":{"ha-mode":"exactly","ha-params":2,"ha-sync-mode":"automatic","ha-sync-batch-size":5}}
]
```
By default, the `ha-mode` is set to `exactly` which controls the exact number of mirroring nodes for a queue (mirrors). The number of nodes, is controller by `ha-params`.
For furhter and custom configuration, please refer to [official RabbitMQ documentation](https://www.rabbitmq.com/ha.html).
vincenzodnp marked this conversation as resolved.
Show resolved Hide resolved

## Environment Variables
Environment variables defined in RabbitMQ base image

| Environment Variable | Default | Description |
| --------------------------------- | --------- | ---------------------------------------------- |
| `RABBITMQ_DEFAULT_USER` | guest | Username for management UI access |
| `RABBITMQ_DEFAULT_PASS` | guest | Password for management UI access |
| `RABBITMQ_DEFAULT_VHOST` | / | RabbitMQ main virtualhost|
| `RABBITMQ_DEFAULT_HA_PATTERN` | ^$ | Regular expression to match for mirrored queues|
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pages:
- Docker Images:
- PHP-FPM: using_lagoon/docker_images/php-fpm.md
- Nginx: using_lagoon/docker_images/nginx.md
- RabbitMQ: using_lagoon/docker_images/rabbitmq.md
- Workflows: using_lagoon/workflows.md
- Backups: using_lagoon/backups.md
- Logging: using_lagoon/logging.md
Expand Down