Installing Mobile Foundation with the Cloud Pak for Applications command-line interface (CLI)

You can use the Cloud Pak installer CLI mf-install command to install IBM Mobile Foundation.

Before you begin

Ensure that you have a connection to a Red Hat® OpenShift® Container Platform (OCP) cluster, and have cluster-admin permissions. You also need Docker installed to run the Cloud Pak installer. See Mobile Foundation prerequisites.

Prepare to run the Cloud Pak installer CLI

It is best to install Mobile Foundation on a new cluster. First, extract the installation configuration.

  1. Get a key to the entitled registry.
  2. Extract the installation configuration from the installer image on the entitled registry.

Installation steps

Step 1: Update the mobilefoundation.yaml file and review.

When you extract the installation configuration from an image, installer configuration files are added to the data directory. You must update the mobilefoundation.yaml file.

  1. Choose components to set up Mobile Foundation.

    Make sure the mobilefoundation.yaml is enabled with the necessary dependencies. By default, only mfpserver and mfppush are enabled. spec.global.dbinit.enabled is set to true by default. Set spec.mfpxxxx.enabled to true to enable other components like mfpliveupdate, mfpanalytics_recvr, mfpanalytics, and mfpappcenter.

    • Mobile Foundation Server: mfpserver, mfppush, mfpliveupdate
    • Mobile Foundation Analytics: mfpanalytics_recvr, mfpanalytics
    • Mobile Foundation Application Center: mfpappcenter

  2. Create database secrets for Server, Push, Live Update, and Application Center.

    Create the secrets by using the specified subcommands and provide the secret name in the database details within mobilefoundation.yaml.

    Run the following code snippet to create a database secret for Mobile Foundation server, Live Update and Application Center.

    # Example to encode the username (or) password
    
       echo -n mydb2password | base64
       bXlkYjJwYXNzd29yZA==      
    
     #
     # create mfpserver secret
     #
      cat <<EOF | kubectl apply -f -
      apiVersion: v1
      data:
        MFPF_ADMIN_DB_USERNAME: encoded_username
        MFPF_ADMIN_DB_PASSWORD: encoded_password
        MFPF_RUNTIME_DB_USERNAME: encoded_username
        MFPF_RUNTIME_DB_PASSWORD: encoded_password
        MFPF_PUSH_DB_USERNAME: encoded_ username
        MFPF_PUSH_DB_PASSWORD: encoded_password
      kind: Secret
      metadata:
        name: mobilefoundation-db-secret
      type: Opaque
      EOF
    
     #
     # create liveupdate secret
     #
      cat <<EOF | kubectl apply -f -
      apiVersion: v1
      data:
        LIVEUPDATE_DB_USERNAME: encoded_username
        LIVEUPDATE_DB_PASSWORD: encoded_password
      kind: Secret
      metadata:
        name: liveupdate-db-secret
      type: Opaque
      EOF
    
     #
     # create appcenter secret
     #
      cat <<EOF | kubectl apply -f -
      apiVersion: v1
      data:
        APPCNTR_DB_USERNAME: encoded_ username
        APPCNTR_DB_PASSWORD: encoded_password
      kind: Secret
      metadata:
        name: appcenter-db-secret
      type: Opaque
      EOF
    
  3. Ensure that the mobilefoundation.yaml file is updated with the database details by replacing the PLACEHOLDERs.

    The following example .yaml file shows the database details.

    db:
       type: "DB2"
       host: "mydb2host.domain.com"
       port: "50000"
       name: "BLUDB"
       secret: mobilefoundation-db-secret
       schema: "MFCUSTSCHEMA"
    

    Keep the following points in mind:

    • Database details are mandatory for deploying mfpserver, push, liveupdate, and appcenter components.
    • schema is created if it does not already exist. Avoid special characters in SCHEMA names.

  4. (Optional) Adjust the number of replicas of components based on your requirement.

  5. (Optional) Adjust the resource.requests and resource.limits for CPU and memory, if required.

  6. For customization of mobilefoundation.yaml, see Mobile Foundation Custom Resource configuration External link icon.

Step 2: Set the environment variables necessary for the Mobile Foundation installation.

Ensure needed Mobile Foundation environment variables are set from the terminal where you will run the mf-install command.

  1. Setting MFPF_PROJECT is optional. If not set, project mf is created to deploy Mobile Foundation.

    export MFPF_PROJECT=<project-name> # Optional
    
  2. If the database secrets are created, you can skip this step. If the database secrets are not created, then set the MFPF_DB_USERNAME and MFPF_DB_PASSWORD environment variables:

    export MFPF_DB_USERNAME=<db_userid>
    export MFPF_DB_PASSWORD=<db_password>
    

Step 3: Run the installer mf-install command.

  1. The installer requires a connection to your OCP cluster. You can provide the login information to the installer in two ways:

    • If you have the oc client installed, use the client to log in to your cluster.

      oc login https://<your_api_cluster_url> -u <username> -p <password>
      

      Note: To generate a login command with the correct URL and port number, log in to the OpenShift console, click your username, then click Copy Login Command. Paste the copied oc login command into your terminal.

    • If you do not have the oc client installed, you can use environment variables to pass in login information.

      • If you have a username and password, pass
        • -e OPENSHIFT_URL=https://<your_api_cluster_url> -e OPENSHIFT_USERNAME=<username> -e OPENSHIFT_PASSWORD=<password>
      • If you have a token, pass
        • -e OPENSHIFT_URL=https://<your_api_cluster_url> -e OPENSHIFT_TOKEN=<token>
  2. Run the installer mf-install command with either of the following commands to install Mobile Foundation.

    Case 1: When database secrets are not created manually for the Mobile Foundation components, pass the database credentials as environment variables in the command.

    docker run -v ~/.kube:/root/.kube:z -u 0 -t \
        -v $PWD/data:/installer/data:z \
        -e LICENSE=accept \
        -e ENTITLED_REGISTRY -e ENTITLED_REGISTRY_USER -e ENTITLED_REGISTRY_KEY \
        -e MFPF_PROJECT \
        -e MFPF_DB_USERNAME -e MFPF_DB_PASSWORD \
        "$ENTITLED_REGISTRY/cp/icpa/icpa-installer:4.1.1" mf-install
    

    Case 2: When database secrets are created manually for the Mobile Foundation components, run the following command.

    docker run -v ~/.kube:/root/.kube:z -u 0 -t \
        -v $PWD/data:/installer/data:z \
        -e LICENSE=accept \
        -e ENTITLED_REGISTRY -e ENTITLED_REGISTRY_USER -e ENTITLED_REGISTRY_KEY \
        -e MFPF_PROJECT \
        "$ENTITLED_REGISTRY/cp/icpa/icpa-installer:4.1.1" mf-install
    

    The -e MFPF_DB_USERNAME and -e MFPF_DB_PASSWORD environment variables supply the database credentials for Mobile Foundation to store its data.

    The installer displays progress messages and adds the messages to the mf-install.log.<timestamp> file in the logs directory. If you encounter problems during installation, see Troubleshooting Mobile Foundation.

What to do next

To learn about getting started on the installed Mobile Foundation, see the documentation External link icon.

To uninstall Mobile Foundation, run the Cloud Pak installer mf-uninstall command to remove Mobile Foundation from your environment.