Building and running the MobileFirst Server container

Use the scripts that are provided to build and run your customized image. You can find the scripts in the MobileFirst Platform Foundation on IBM® Containers package installation directory under mfpf-server/scripts.

Before you begin

  • You have finished customizing the image.

About this task

Scripts can only be run from within the scripts folder. Do not modify the given folder structure.

The following methods are supported for passing parameters to the scripts:
  • Command-line arguments (Usage: [-command|--command] ARGUMENT)
  • Interactive method (By running the script with no command-line arguments.)
  • Properties files (By customizing the related args/*.properties files.)
    You can find information about the required and optional arguments in the properties files, such as the default values, input descriptions, and so forth. The script properties files are located in the following folders in the package_root/:
    • mfpf-analytics/scripts/args
    • mfpf-server/scripts/args

    Example command execution usage: args/


The first step describes how to retrieve the public IP address to be bound with the container, which is a required argument when you run the script (as described in step 2).

  1. Retrieve and take note of a public IP address to bind to the container.
    To get IP information, use Cloud Foundry CLI plug-in for IBM Containers (cf ic) commands.
    • To retrieve the list of IP addresses that are potentially available to you (based on user ID), run cf ic ip list.

      The IP addresses that are listed with no corresponding container ID are available for use.

      An IP address with a corresponding container ID indicates that the IP address is already in use. If all IP addresses are already in use, you can request a new IP address.

    • To request a new IP address, run cf ic ip request.
  2. Create a database service.
    Important: Complete this step before you run the, described in the next step.
    You can create a database service instance on Bluemix® in two ways:
    • Using the Bluemix dashboard.
    • Using the Cloud Foundry command line utility.

    Use one of the following methods to create a database service instance.

    Using the Bluemix dashboard:

    To create a service instance of dashDB, Cloudant® NoSQL DB or SQL Database on Bluemix, follow the next steps.

    1. Log in to Bluemix.
    2. Select the space name where you want to create the service instance (example: dev).
    3. Select Data & Analytics category.
    4. Click on the Get started now! icon, to go to the catalog for services under the Data & Analytics category.
    5. From the services catalog search for dashDB, Cloudant NoSQL DB or SQL Database.
    6. Click the desired service from the search result.
    7. Select a value of Leave unbound for the App field. Enter a name for the service instance in the Service name field. Select a suitable Plan for the service and click CREATE.
      Remember: If you choose to create dashDB service instance then select a suitable service Plan, which supports Online Transaction Processing (OLTP) workloads, in step g.

    Using the Cloud Foundry command line utility:

    1. Log in to Bluemix by using the following command:

      cf login [-a API_URL] [-u USERNAME] [-p PASSWORD] [-o ORG] [-s SPACE]

      -u user_name
      Your user name. This parameter is optional.
      -p password
      Your password.
      Security consideration: If you provide the password using the -p parameter, the password might be recorded in your command line history. If you do not want the password to be recorded, instead of using the -p parameter, consider entering the password when the command line interface prompts you, during the execution of the cf login command.
      -o organization_name
      The name of the organization that you want to log in to.
      -s space_name
      The name of the space that you want to log in to.
      -a https://api.DomainName
      The URL of the API endpoint of Bluemix. This parameter is optional.
    2. To create the service instance, run the following command:

      cf create-service service_name plan_name service_instance

      You can use one of the following examples:

      cf create-service dashDB EnterpriseTransactional2.8.500 mfpfdashdbservice

      cf create-service dashDB EnterpriseTransactional12.128.1400 mfpfdashdbservice

      cf create-service cloudantNoSQLDB Shared mfpfcloudantservice

      cf create-service sqldb sqldb_premium mfpfsqldbservice

      Note: The dashDB service instance can take a while before it's provisioning is completed and it is made available for use.
  3. Run the scripts in the order listed:
    This script logs in to the container service. You must run this script before you can run any subsequent scripts.
    Your Bluemix log-in credentials as well as the organization name and space name are required arguments.
    This script must be run once for the administrative database and once for every project or every run time.
    Your Bluemix database service instance name is a required argument.
    Important: If you use Cloudant NoSQL DB to store administration and runtime data, then do not use the Shared plan. Select one of the Cloudant NoSQL DB enterprise service plans, which provides the Cloudant cluster on dedicated hardware. If you use the dashDB service to store administration and runtime data, then you need to choose only a dashDB service plan that supports OLTP (Online Transaction Processing) workloads. Other dashDB service plans are not supported.
    If you are configuring a runtime database, the name of the runtime project to be deployed on the MobileFirst Server is required.
    You can optionally specify a database schema name. For an administrative database, the default schema name is WLADMIN. For a runtime database, the default schema name is the runtime name.
    Note: The Reports database has been deprecated and does not work with IBM MobileFirst™ Platform Foundation on IBM Containers. Instead, use a MobileFirst Operational Analytics container. Ensure that the project WAR files in your containers do not have any artifacts or configurations related to the deprecated Reports database.
    This script builds the server image with the mfp-server customizations and sends the image to IBM Containers.
    The MobileFirst Server image name is a required argument. Use the following format: BluemixRegistry/PrivateNamespace/ImageName:TagName. Example:
    The script runs the MobileFirst Server image as a stand-alone container.
    The MobileFirst Server image name, the container name, and the public IP address from which the container is started (from step 1) are required arguments for running the image as a container.
    Tip: If you are running a or script interactively and configuring an analytics image (by using MFPF_PROPERTIES), you must provide the configuration information every time the script is run, and for each runtime, to avoid losing the configuration. For example, if you provided an analytics configuration (such as, for the first runtime but did not provide it the next time that you ran the script for a different runtime, the configuration for the MobileFirst Server would be lost.
    The script runs the MobileFirst Server image as a container group.
    Required arguments include: the MobileFirst Server image name, the container group name, the minimum and maximum number of container instances within the group, and the host name to which the group must be mapped.