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 MOUNT /srv/rabbitmq/data var/lib/rabbitmq/mnesia
USER 5672 5672 USER 5672 5672
ENV HOME /usr/lib/rabbitmq
CMD /usr/sbin/rabbitmq-server CMD /usr/sbin/rabbitmq-server

View File

@ -1,13 +1,12 @@
#!/bin/sh #!/bin/sh
set -e set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/rabbitmq SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Build Docker container
docker build -t rabbitmq ${SOURCE_DIR}
cp ${SOURCE_DIR}/etc/init.d/rabbitmq /etc/init.d/rabbitmq
rc-update -u
# Create RabbitMQ directory structure # Create RabbitMQ directory structure
mkdir -p /srv/rabbitmq/data mkdir -p /srv/rabbitmq/data
chown 5672:5672 /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 #!/sbin/openrc-run
description="RabbitMQ docker container" description="RabbitMQ container"
depend() { depend() {
need docker need cgroups
} }
start() { start() {
/usr/bin/docker run -d --rm \ lxc-start rabbitmq
--name rabbitmq \
-h rabbitmq \
-v /srv/rabbitmq/data:/var/lib/rabbitmq/mnesia \
rabbitmq
} }
start_post() { 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() { stop() {
/usr/bin/docker stop rabbitmq lxc-stop rabbitmq
} }