---
title: "On-premise Guide for Message Broker Service Installation"
canonical: "https://docs.perspectium.com/space/earlierReleases/1442016/On-premise%20Guide%20for%20Message%20Broker%20Service%20Installation"
format: markdown
---
Perspectium Message Broker Service (MBS) is typically deployed on-premise in a   Docker   environment as containerized micro-services. This approach and environment was chosen to offer the most consistent and portable way to compose and deliver the multiple services required. Alternatively, you can refer to the following non container approach for an on-premise installation:   On-Premise Guide For HA Environment Setup . The alternative approach is deprecated and recommended only as documentation for the contents of the services. Prerequisites   Download and install the   Docker platform   into a server or virtual machine with the following minimal specification. Server or VM System Requirements Perspectium Containers The MBS service requires the running of these container services: RabbitMQ service MySQL service MBS Java service RabbitMQ Container https://hub.docker.com/_/rabbitmq/ MySQL Container https://hub.docker.com/_/mysql/ MBS Container The MBS container is built using a Perspectium published RPM image with the following Dockerfile and entrypoint.sh. To download the RPM, use the following command: wget http://[userid]:[password]@buildhost.perspectium.org/repo-prod/perspectium-mbs-X.XX.X.noarch.rpm Get the correct [userid], [password] and [X.XX.X] release version from   support@perspectium.com DockerFile See   https://docs.docker.com/engine/reference/builder/   for usage of this file. FROM centos:centos6
MAINTAINER Perspectium <support@perspectium.com>
ADD perspectium-mbs*.rpm /tmp/
ADD perspectium.repo /etc/yum.repos.d/
ADD mbs-entrypoint.sh /opt/perspectium/mbs/bin/

RUN yum update -y
RUN yum install -y \
  curl \
  java \
  mysql \
  /tmp/perspectium-mbs*.rpm
LABEL name="Perspectium MBS Docker Image" \
      vendor="Perspectium" \
      license="Proprietary/Commercial" 
EXPOSE 8080
ENTRYPOINT /opt/perspectium/mbs/bin/mbs-entrypoint.sh
HEALTHCHECK --interval=5s --timeout=5s --retries=3 \
  CMD curl -f http://localhost:8080/ui/flist.htm || exit 1 mbs-entrypoint.sh #!/bin/sh
# $Id: mbs-entrypoint.sh,v 1.5 2016/11/15 22:58:14 ivanb Exp $

trap "echo TRAPed signal; service perspectium-mbs stop ; service perspectium-headless-mbs stop" HUP INT QUIT TERM

CONF=/etc/opt/perspectium/mbs/conf/mbs.xml
# start service in background here
echo "Creating MBS configuration file in ${CONF}"
/opt/perspectium/mbs/bin/create-mbs-config
if [ "$1" == "debug" ]; then
  echo "Configuration file: ${CONF}"
  cat /etc/opt/perspectium/mbs/conf/mbs.xml
fi

HOST="${MYSQL_HOST}"
PORT="${MYSQL_PORT:-3306}"
USER="${MYSQL_USER:-root}"
PASS="${MYSQL_PASS:-xxxx}"
DB="${MYSQL_DB:-psp_db}"

for i in `seq 0 180`; do
  echo "MySQL: CREATE DATABASE IF NOT EXISTS ${DB} as ${USER}@${HOST}:${PORT} attempt ${i}"
  echo "CREATE DATABASE IF NOT EXISTS ${DB};" | mysql --host=${HOST} --port=${PORT} --user=${USER} --password=${PASS}
  if [ "$?" == "0" ]; then 
    break
  fi
  sleep 4
done

if [ "$i" == "180" ]; then
  echo "MySQL Error: MBS Cannot create ${USER}@${HOST}:${PORT}/psp_db"
  exit 1
fi

# release lock
echo "Releasing MySQL lock psp_db.upgraded"
echo "SELECT RELEASE_LOCK('psp_db.upgraded');" | mysql --host=${HOST} --port=${PORT} --user=${USER} --password=${PASS}
if [ "$?" != "0" ]; then
  echo "MySQL Error: Cannot release lock psp_db.upgraded on ${USER}@${HOST}:${PORT}/psp_db"
  exit 1
fi

if [ ! -d /var/opt/perspectium/mbs/logs ]; then
  mkdir -p /var/opt/perspectium/mbs/logs
  chown mbs:mbs /var/opt/perspectium/mbs/logs
fi
echo "starting Perspectium MBS"
echo "Starting MBS in Docker Container $( date )" > /var/opt/perspectium/mbs/logs/container-startup.log
chown mbs:mbs /var/opt/perspectium/mbs/logs/container-startup.log
service perspectium-mbs start && service perspectium-headless-mbs start 
sleep 2

tail -f /var/opt/perspectium/mbs/logs/*.log
#if [ "$1" == "debug" ]; then
#  tail -f /var/opt/perspectium/mbs/logs/*.log
#else
#  echo "[hit enter key to exit] or run 'docker stop <container>'"
#  read
#fi

# stop service and clean up here
echo "stopping Perspectium MBS"
service perspectium-mbs stop && service perspectium-headless-mbs stop

echo "exited $0"

 Procedure The following steps document how to automate the download and execution of the cluster using docker compose commands: