LXCize RabbitMQ setup

This commit is contained in:
Disassembler 2018-09-13 16:05:13 +02:00
parent 677ac1bc4c
commit 0fda481317
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
3 changed files with 11 additions and 15 deletions

View File

@ -17,4 +17,5 @@ EOF
MOUNT /srv/rabbitmq/data var/lib/rabbitmq/mnesia
USER 5672 5672
ENV HOME /usr/lib/rabbitmq
CMD /usr/sbin/rabbitmq-server

View File

@ -1,13 +1,12 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/rabbitmq
# Build Docker container
docker build -t rabbitmq ${SOURCE_DIR}
cp ${SOURCE_DIR}/etc/init.d/rabbitmq /etc/init.d/rabbitmq
rc-update -u
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Create RabbitMQ directory structure
mkdir -p /srv/rabbitmq/data
chown 5672:5672 /srv/rabbitmq/data
# Install service
cp ${SOURCE_DIR}/etc/init.d/rabbitmq /etc/init.d/rabbitmq
rc-update -u

View File

@ -1,23 +1,19 @@
#!/sbin/openrc-run
description="RabbitMQ docker container"
description="RabbitMQ container"
depend() {
need docker
need cgroups
}
start() {
/usr/bin/docker run -d --rm \
--name rabbitmq \
-h rabbitmq \
-v /srv/rabbitmq/data:/var/lib/rabbitmq/mnesia \
rabbitmq
lxc-start rabbitmq
}
start_post() {
timeout -t 60 docker exec rabbitmq sh -c 'until grep -q "Server startup complete" /var/log/rabbitmq/rabbit@rabbitmq.log 2>/dev/null ; do usleep 50000; done'
timeout -t 60 sh -c 'until grep -q "Server startup complete" /var/lib/lxc/rabbitmq/delta0/var/log/rabbitmq/rabbit@rabbitmq.log 2>/dev/null; do usleep 50000; done'
}
stop() {
/usr/bin/docker stop rabbitmq
lxc-stop rabbitmq
}