OpenShift Origin installation over Fedora 19 (Mega Tutorial) – Part 2

openshift-origin-logo

OpenShift Origin

Let’s continue with the tutorial and we’ll install MongoDB database which store all data about OpenShift infrastructure. After that we’ll install ActiveMQ messaging service who is responsible of communication between the broker and nodes. Finally let’s install MCollective client which is responsible of sending and receiving messages between the broker and nodes.

Let’s start.

MongoDB installation

  • Systems used : broker

With yum we’ll install mongodb-server, mongodb and libmongodb packages

yum install -y mongodb-server mongodb libmongodb

MongoDB uses /etc/mongodb.conf config file which must be modified in 2 times. First let’s disable temporary the authentication commenting out the directive auth=true. MongoDB uses a huge space in HDD, more than OpenShift requires, so we’ll add the directive smallfiles=true.

vim /et/mongodb.conf
bind_ip = 127.0.0.1
port = 27017
fork = true
pidfilepath = /var/run/mongodb/mongodb.pid
logpath = /var/log/mongodb/mongodb.log
dbpath =/var/lib/mongodb
journal = true
nohttpinterface = true
smallfiles=true
#auth=true

Now we’ll start th service and create OpenShift database user.

systemctl start mongod.service
mongo localhost/openshift_broker_dev --eval 'db.addUser("openshift", "mooo")'
mongo localhost/admin --eval 'db.addUser("openshift", "mooo")'

Let’s edit the config file again to enable authentication and to configure the directive  bind_ip to point to the external IP. Also we’ll configure firewall.

systemctl stop mongod.service
vim /etc/mongodb.conf
bind_ip = 127.0.0.1,10.10.10.2
port = 27017
fork = true
pidfilepath = /var/run/mongodb/mongodb.pid
logpath = /var/log/mongodb/mongodb.log
dbpath =/var/lib/mongodb
journal = true
nohttpinterface = true
smallfiles=true
auth=true
systemctl start mongod.service
lokkit --port=27017:tcp

We verify that MongoDB is working and let’s enable the service for system startup

mongo admin
>MongoDB shell version: 2.4.6
>connecting to: admin
>Welcome to the MongoDB shell.
>For interactive help, type "help".
>For more comprehensive documentation, see
>	http://docs.mongodb.org/
>Questions? Try the support group
>	http://groups.google.com/group/mongodb-user
db.auth('openshift',"mooo")
> 1
show dbs
> admin	0.0625GB
> local	0.03125GB
> openshift_broker_dev	0.0625GB
exit
systemctl enable mongod.service

ActiveMQ installation

  • Systems used : broker

To continue with the configuration, we need install ActiveMQ, which will install Java and other dependencies.Needed packages are activemq and activemq-client

yum install -y activemq activemq-client

The main config file is /etc/activemq/activemq.xml and we need to add  the configuration about queue and topic that OpenShift requires, but since this is a hard work, OpenShift offers us a preconfigured file to download here. Only we need to modify a few lines. Also we need to download the config file of the server in which ActiveMQ will be running, can be downloaded here.

curl -o /etc/activemq/activemq.xml https://raw.githubusercontent.com/openshift/origin-server/openshift-origin-release-3/documentation/files/activemq.xml
curl -o /etc/activemq/jetty.xml https://raw.githubusercontent.com/openshift/origin-server/openshift-origin-release-3/documentation/files/jetty.xml

First let’s change in activemq.xml this line

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="activemq.example.com" dataDirectory="${activemq.data}">

For this one, modifying brokerName.

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker.dmartin.es" dataDirectory="${activemq.data}">

Now is time for security. In next block, on bold, is what we must modify.

<simpleAuthenticationPlugin>
   <users>
     <authenticationUser username="mcollective" password="marionette" groups="mcollective,everyone"/>
     <authenticationUser username="admin" password="admin" groups="mcollective,admin,everyone"/>
   </users>
 </simpleAuthenticationPlugin>

We’ll configure the admin user access in  /etc/activemq/jetty-realm.properties file

admin: admin, admin

The web interface of ActiveMQ is only available through localhost but, it is optional, we can set it to be available in the public network interface modifying next block in /etc/activemq/jetty.xml file

<property name="connectors">
 <list>
    <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
       <property name="port" value="8161" />
       <property name="host" value="127.0.0.1" />
    </bean>

    <bean id="External-Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
       <property name="port" value="8161" />
       <property name="host" value="10.10.10.2" />
    </bean>

 </list>
</property>

ActiveMQ only works with SysV service management, so to work correctly with systemd, we must create a file to configure location where ActiveMQ can store temporary files

cat <<EOF >/etc/tmpfiles.d/activemq.conf
d /var/run/activemq 0755 activemq activemq -
EOF

Let’s configure the firewall, we’ll start and enable the service

lokkit --port=61613:tcp --port=8161:tcp
service activemq start
chkconfig activemq on

If there is any syntax error, we can watch the log in  /var/log/activemq/activemq.log
We’ll access to web console with broker IP http://10.10.10.2:8161, the user is admin and the password is admin.

ActiveMQ Web Console

ActiveMQ Web Console

MCollective client installation

  • Systems used : broker

Let’s install MCollective client with yum. The package is mcollective-client and we need toedit the config file /etc/mcollective/client.cfg for point to ActiveMQ server.

yum install -y mcollective-client
cat <<EOF > /etc/mcollective/client.cfg
topicprefix = /topic/
main_collective = mcollective
collectives = mcollective
libdir = /usr/libexec/mcollective
logfile = /var/log/openshift/broker/mcollective-client.log
loglevel = debug

# Plugins
securityprovider = psk
plugin.psk = unset

connector = activemq
plugin.activemq.pool.size = 1
plugin.activemq.pool.1.host = broker.dmartin.es
plugin.activemq.pool.1.port = 61613
plugin.activemq.pool.1.user = mcollective
plugin.activemq.pool.1.password = marionette
EOF

In the next post I’ll show you the OpenShift broker configuration.
It’s available from here.

See you soon.

One thought on “OpenShift Origin installation over Fedora 19 (Mega Tutorial) – Part 2

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.