You are here: Manual Installation > Installation > Installing Moab Web Services

2.5 Installing Moab Web Services

You must deploy Moab Web Services on the same host as Moab Server (Moab Server Host). If using Viewpoint, this shared host must have a Red Hat-based OS; regardless of whether Viewpoint is also installed on that host. For documentation clarity, these instructions refer to the shared host for Moab Server and MWS as the MWS Server Host.

This topic contains instructions on how to install Moab Web Services (MWS).

In this topic:

2.5.1 Open Necessary Ports

If your site is running firewall software on its hosts, you will need to configure the firewall to allow connections to the necessary ports.

Location Ports Functions When Needed
MWS Server Host 8080 Tomcat Server Port Always
MWS Database Host 27017 MWS MongoDB Server Port If you will be installing the MWS Database on a different host from the MWS Server

See 2.11 Opening Ports in a Firewall for general instructions and an example of how to open ports in the firewall.

2.5.2 Install Dependencies, Packages, or Clients

In this section:

2.5.2.A Install Java

Install the Linux x64 RPM version of Oracle® Java® 8 Runtime Environment.

Oracle Java 8 Runtime Environment is the recommended Java environment, but Oracle Java 7 is also supported. All other versions of Java, including OpenJDK/IcedTea, GNU Compiler for Java, and so on cannot run MWS.

On the MWS Server Host, do the following:

  1. Install the Linux x64 RPM version of Oracle Java SE 8 JRE.
    1. Go to the to the Oracle Java download page.
    2. Copy the URL for the Linux x64 RPM version, and run the following command:
      [root]# rpm -Uh <URL>

2.5.2.B Install Tomcat

Install Tomcat 7.

Tomcat 7 is required to run MWS 9.0 and after. MWS 9.0 will not run on Tomcat 6.

On the MWS Server Host, do the following:

[root]# yum install tomcat

If installing on RHEL 6, tomcat may not be found in the standard RHEL distribution repositories.

One way to overcome this problem is to install the missing dependencies from EPEL or other reputable repositories. For example (for the current RHEL 6 repositories):

[root]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root]# yum install yum-utils
[root]# yum-config-manager --disable epel
[root]# yum install --enablerepo=epel tomcat

2.5.2.C Install MongoDB

On the MWS MongoDB Database Host, do the following:

  1. Add the MongoDB Repository.

    [root]# cat > /etc/yum.repos.d/mongodb-org-3.2.repo <<'EOF'
    [mongodb-org-3.2]
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
    EOF
  2. Install MongoDB.

    [root]# yum install -y mongodb-org
  3. Enable and start MongoDB.

    [root]# chkconfig mongod on
    [root]# service mongod start
  1. Add the required MongoDB users.

    The passwords used below (secret1, secret2, and secret3) are examples. Choose your own passwords for these users.

    [root]# mongo
    > use admin
    > db.createUser({"user": "admin_user", "pwd": "secret1", "roles": ["root"]})
    
    > use moab
    > db.createUser({"user": "moab_user", "pwd": "secret2", "roles": ["dbOwner"]})
    > db.createUser({"user": "mws_user", "pwd": "secret3", "roles": ["read"]})
    
    > use mws
    > db.createUser({"user": "mws_user", "pwd": "secret3", "roles": ["dbOwner"]})
    							
    > exit

    Because the admin_user has read and write rights to the admin database, it also has read and write rights to all other databases. See Control Access to MongoDB Instances with Authentication for more information.

  1. Set MongoDB Configuration Options.

    By default, /etc/mongod.conf sets net.bindIp to 127.0.0.1. You will need to change this setting if the MongoDB server needs to be accessible from other hosts or from other interfaces besides loopback. See https://docs.mongodb.com/manual/reference/configuration-options/#net-options for more information.

    # Sample /etc/mongod.conf file
    net:
      port: 27017
      # bindIp: 127.0.0.1
    processManagement:
      fork: true
      pidFilePath: /var/run/mongodb/mongod.pid
    security:
      authorization: enabled
    storage:
      dbPath: /var/lib/mongo
      journal:
        enabled: true
    systemLog:
      destination: file
      logAppend: true
      path: /var/log/mongodb/mongod.log
  2. Restart MongoDB.

    [root]# service mongod restart

2.5.3 Install MWS Server

You must complete the tasks to install the dependencies, packages, or clients before installing MWS Server. See 2.5.2 Install Dependencies, Packages, or Clients.

If your configuration uses firewalls, you must also open the necessary ports before installing the MWS Server. See 2.5.1 Open Necessary Ports .

On the MWS Server Host, do the following:

  1. Verify Moab Server is installed and configured as desired (for details, see 2.3 Installing Moab Workload Manager).
  2. Start Moab.
  3. [root]# service moab start
  4. Create the MWS home directory and subdirectories.

    For more information, see Configuration in the Moab Web Services Reference Guide.

    The default location for the MWS home directory is /opt/mws. These instructions assume the default location.

    Do the following:

    [root]# mkdir -p \
        /opt/mws/etc/mws.d \
        /opt/mws/hooks \
        /opt/mws/log \
        /opt/mws/plugins \
        /opt/mws/spool/hooks \
        /opt/mws/utils
    [root]# chown -R tomcat:tomcat /opt/mws
    [root]# chmod -R 555 /opt/mws
    [root]# chmod u+w \
        /opt/mws/log \
        /opt/mws/plugins \
        /opt/mws/spool \
        /opt/mws/spool/hooks \
        /opt/mws/utils
  5. Download the latest MWS build from the Adaptive Computing website.
  6. Extract the contents of the MWS download tarball into a temporary directory. For example:
  7. [root]# mkdir /tmp/mws-install
    [root]# cd /tmp/mws-install
    [root]# tar xvzf $HOME/Downloads/mws-9.1.0.tar.gz
  8. Copy the extracted utility files to the utility directory created in the previous step and give the tomcat user ownership of the directory.

    [root]# cd /tmp/mws-install/mws-9.1.0/utils
    [root]# cp * /opt/mws/utils
    [root]# chown tomcat:tomcat /opt/mws/utils/*
  9. Connect Moab to MongoDB.

    The USEDATABASE parameter is unrelated to the MongoDB configuration.

    1. Set the MONGOSERVER parameter in /opt/moab/etc/moab.cfg to the MongoDB server hostname. Use localhost as the hostname if Moab and MongoDB are hosted on the same server.
      MONGOSERVER <host>[:<port>]

      If your MONGOSERVER host is set to anything other than localhost, edit the /etc/mongod.conf file on the MongoDB server host and either comment out any bind_ip parameter or set it to the correct IP address.

      # Listen to local interface only. Comment out to listen on all interfaces.
      #bind_ip=127.0.0.1
    2. In the /opt/moab/etc/moab-private.cfg file, set the MONGOUSER and MONGOPASSWORD parameters to the MongoDB moab_user credentials you set. See 2.5.2.C Install MongoDB.
      MONGOUSER     moab_user
      MONGOPASSWORD secret2
    3. Verify that Moab is able to connect to MongoDB.
      [root]# service moab restart
      [root]# mdiag -S | grep Mongo
      
      Mongo connection (localhost) is up (credentials are set)
  10. Secure communication using secret keys.

    1. (Required) Moab and MWS use Message Authentication Codes (MAC) to ensure messages have not been altered or corrupted in transit. Generate a key and store the result in /opt/moab/etc/.moab.key.
      [root]# service moab stop
      [root]# dd if=/dev/urandom count=24 bs=1 2>/dev/null | base64 > /opt/moab/etc/.moab.key
      [root]# chown root:root /opt/moab/etc/.moab.key
      [root]# chmod 400 /opt/moab/etc/.moab.key
      [root]# service moab start
    2. (Optional) Moab supports message queue security using AES. This feature requires a Base64-encoded 16-byte (128-bit) shared secret. Do the following:
      1. Generate a key and append the result to /opt/moab/etc/moab-private.cfg
        [root]# service moab stop
        [root]# echo "MESSAGEQUEUESECRETKEY $(dd if=/dev/urandom count=16 bs=1 2>/dev/null | base64)" >> /opt/moab/etc/moab-private.cfg
        [root]# service moab start
      2. Verify that encryption is on for the ZeroMQ connection.
        [root]# mdiag -S|grep 'ZeroMQ MWS'
        
         ZeroMQ MWS connection is bound on port 5570 (encryption is on)
  11. Set up the MWS configuration files. In the extracted directory are several configuration files.

    1. Copy the configuration files into place and grant the tomcat user ownership.

      [root]# cd /tmp/mws-install/mws-9.1.0
      [root]# cp mws-config.groovy /opt/mws/etc
      [root]# cp mws-config-hpc.groovy /opt/mws/etc/mws.d
      [root]# chown tomcat:tomcat /opt/mws/etc/mws-config.groovy /opt/mws/etc/mws.d/mws-config-hpc.groovy
    2. In the /opt/mws/etc/mws-config.groovy file, change these settings:
      • moab.secretKey: Must match the Moab secret key you generated earlier (contained in /opt/moab/etc/.moab.key).
      • auth.defaultUser.username: Any value you like, or leave as is.
      • auth.defaultUser.password: Any value you like, but choose a strong password.
      • moab.messageQueue.secretKey: If you opted to configure a message queue security key in MWS, this parameter value should match exactly that key specified in /opt/moab/etc/moab-private.cfg for the MESSAGEQUEUESECRETKEY Moab configuration parameter you generated earlier.
      • If MWS is configured to encrypt the message queue and Moab is not (or vice versa), then the messages from Moab will be ignored. Furthermore, all attempts to access the MWS service resource will fail.

      [root]# vi /opt/mws/etc/mws-config.groovy							
      
      // Change these to be whatever you like.
      auth.defaultUser.username = "moab-admin"
      auth.defaultUser.password = "changeme!"
      
      
      // Replace <ENTER-KEY-HERE> with the contents of /opt/moab/etc/.moab.key.				
      moab.secretKey = "<ENTER-KEY-HERE>"
      moab.server = "localhost"
      moab.port = 42559
      moab.messageDigestAlgorithm = "SHA-1"
      									
      
      ...
      						
      // Replace <ENTER-KEY-HERE> with the value of MESSAGEQUEUESECRETKEY in /opt/moab/etc/moab-private.cfg.
      moab.messageQueue.secretKey = "<ENTER-KEY-HERE>"
      

      If you do not change auth.defaultUser.password, your MWS will not be secure (because anyone reading these instructions would be able to log into your MWS). Here are some tips for choosing a good password.

    3. Do one of the following:
      • You can configure only one authentication method in /opt/mws/etc/mws-config.groovy—LDAP or PAM, but not both. If you have configured both LDAP and PAM, MWS defaults to using LDAP.

        If you need multiple authentication methods, you must add them to your local PAM configuration. See your distribution documentation for details.

      • If you are configuring an MWS connection to your LDAP server, add the following parameters to the /opt/mws/etc/mws-config.groovy file:
      • ldap.server  = "192.168.0.5"
        ldap.port = 389
        ldap.baseDNs = ["dc=acme,dc=com"]
        ldap.bindUser = "cn=Manager,dc=acme,dc=com"
        ldap.password = "*****"
        ldap.directory.type = "OpenLDAP Using InetOrgPerson Schema"

        This is just an example LDAP connection. Be sure to use the appropriate domain controllers (dc) and common names (cn) for your environment.

        If you followed the Adaptive Computing tutorial, Setting Up OpenLDAP on CentOS 6, your ldap.directory.type should be set to "OpenLDAP Using InetOrgPerson Schema." However, the use of other schemas is supported. For more information see LDAP Configuration Using /opt/mws/etc/mws-config.groovy.

        To see how to configure a secure connection to the LDAP server, see Securing the LDAP Connection.

      • If you are configuring MWS to use PAM, add the the pam.configuration.service parameter to the /opt/mws/etc/mws-config.groovy file. For example:
      • pam.configuration.service = "login"

        This is just an example PAM configuration file name. Make sure you specify the name of the configuration file you want MWS to use.

        If you configure MWS to authenticate via PAM using local files or NIS, you need to run Tomcat as root. This configuration is highly discouraged and is not supported by Adaptive Computing. The recommended approach is to configure PAM and NSS to authenticate against LDAP.

        For more information about PAM configuration with MWS, see PAM (Pluggable Authentication Module) Configuration Using /opt/mws/etc/mws-config.groovy.

    4. Add the grails.mongo.username and grails.mongo.password parameters to the /opt/mws/etc/mws-config.groovy file. Use the MWS credentials you added to MongoDB in the Preparing for Manual Installation section.
    5. ...
      grails.mongo.username = "mws_user"
      grails.mongo.password = "secret3"
    6. Make the MWS configuration files read-only.
      [root]# chmod 400 /opt/mws/etc/mws-config.groovy /opt/mws/etc/mws.d/mws-config-hpc.groovy
  12. Configure Tomcat

    Add the following lines to the end of /etc/tomcat/tomcat.conf.

    CATALINA_OPTS="-DMWS_HOME=/opt/mws -Xms256m -Xmx3g -XX:MaxPermSize=384m -Dfile.encoding=UTF8"
    JAVA_HOME="/usr/java/latest"

    MaxPermSize is ignored using Java 8; and therefore can be omitted.

  13. Deploy the mws.war file and start Tomcat.
    [root]# chkconfig tomcat on
    [root]# service tomcat stop
    [root]# cp /tmp/mws-install/mws-9.1.0/mws.war /usr/share/tomcat/webapps
    [root]# service tomcat start
  14. Navigate to http://<server>:8080/mws/ in a web browser to verify that MWS is running (you will see some sample queries and a few other actions).
  15. Log in to MWS to verify that your credentials are working. (Your login credentials are the auth.defaultUser.username and auth.defaultUser.password values you set in the /opt/mws/etc/mws-config.groovy file.)
  16. Click to enlarge

    If you encounter problems, or if the application does not seem to be running, see the steps in 5.3 Moab Web Services Issues.

Related Topics 

© 2016 Adaptive Computing