diff --git a/rabbitmq/lxcfile b/rabbitmq/lxcfile index 6327476..12a71d7 100644 --- a/rabbitmq/lxcfile +++ b/rabbitmq/lxcfile @@ -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 diff --git a/rabbitmq/setup.sh b/rabbitmq/setup.sh index 7a01a9e..ea002f0 100755 --- a/rabbitmq/setup.sh +++ b/rabbitmq/setup.sh @@ -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 diff --git a/rabbitmq/setup/etc/init.d/rabbitmq b/rabbitmq/setup/etc/init.d/rabbitmq index 2e54e58..8c901c0 100755 --- a/rabbitmq/setup/etc/init.d/rabbitmq +++ b/rabbitmq/setup/etc/init.d/rabbitmq @@ -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 }