Thursday, December 22, 2016

IBM MobileFirst Asymmetric deployment

Hi folk,

Today I'm going to post an overview of how to make a manual installation of IBM MobileFirston on WebSphere Application Server Network Deployment (WAS ND) using an asymmetric deployment.

Asymmetric deployment with runtimes and administration services in different server or cluster 

This topology is advantageous, because it enables the runtimes to be isolated from the administration components and from other runtimes.
 
It can be used to provide performance isolation, to isolate critical applications, and to enforce Service Level Agreement (SLA)







Characteristics of this topology
  • One or several administration components can be deployed in one or several servers or clusters of the cell. Each instance of MobileFirst Operations Console communicates with one administration service and one live update service
  • One or several runtimes can be deployed in other servers or clusters of the cell
  • One MobileFirst Operations Console manages several runtimes deployed in the other servers or clusters of the cell
  • One runtime is managed by only one MobileFirst Operations Console
  • Each administration service uses its own administration database schema
  • Each live update service uses its own live update database schema
  • Each runtime uses its own runtime database schema
Topology constraints
  • The deployment manager must be running while MobileFirst Server is running
  • The deployment manager is used for the JMX communication between the runtime and the administration service
  • The administration service and the live update service must be installed on the same application server
  • The runtime can be installed on different servers than the administration service, but it must be on the same cell
  • Start Order - The runtime application must start after the administration service application. You can set the order at Startup behavior section. For example, set the Startup Order to 1 for the administration service and 2 to the runtime
You can find the entire presentation in:

http://www.slideshare.net/JorgeIglesiasFernnde1/asymmetric-deployment-mfp

Cheers!!

Friday, December 16, 2016

Clone Cordova application using MobileFirst CLI

Hi folk,

Recently a customer asked me to help them creating a process of cloning configuration from mobile Cordova applications, from one version to another, using the IBM MobileFirst™ PlatformCommand Line Interface (CLI). The idea is to be able to automate the process in its continuous integration software development.

Currently the tool offers the cloning procedure from the operations console:





But MFP command-line does not have "clone" functionality today :/, who has said fear? :)

You can transfer an application configuration from a one server to another by using command-line tools or a REST API.

So, I have created a cloning functionality using nodejs-based program and mfpdev commands with the following business logic:

1) Pull the application descriptor JSON File:

Retrieves an existing app configuration from the server. The configuration includes the contents of the application descriptor, which uniquely identifies the app to the server and other information that is specific to the app. 
The configuration files are provided as compressed files (.zip format). 

2) Unzip artifacts zip file:

The .zip files are placed in the directory appName/mobilefirst and named as follows:
appID-platform-version-artifacts.zip

where:
appID is the application name,  
platform is one of android, ios, or windows
version is the version level of your app. 
For Cordova apps, a separate .zip file is created for each target platform.

3) Add version Application-Descriptor JSON File:

The application descriptor file is a JSON file that contains the description and configuration of your application. When you run an app that connects to a MobileFirst Server instance, the app must be registered with that server and configured.

4) Zip new artifacts zip file:
The .zip files are placed in the directory appName/mobilefirst and named as follows:
appID-platform-newversion-artifacts.zip

5) Modify the version in configuracion file (config.xml)

The Cordova configuration file is a mandatory XML file that contains application metadata, and is stored in the root directory of the app. The file is automatically generated when you create a Cordova application.

Information about this file in the Apache Cordova config.xml documentation.

6) Register application

Registers your app with a MobileFirst Server.

7) Push application

This command sends the .zip file to the MobileFirst Server. The client properties file myapp1/app/src/main/assets/mfpclient.properties is modified to reflect that the server that the app is registered.

Example - Clone version 1.0.1 to 2.0.0:

I have an app registered with the following versions:



In the app directory run following command:




$ node cloneApp.js local mfp jif.example.hellocordova android 1.0.1 2.0.0

When the process is finished, the new registered version must be displayed:



The source code can be downloaded from:
https://github.com/jorgeiglesiasfernandez/CloneApp
Note: Application authenticity and web resources will not be cloned. If you import an application that includes authenticity data, and if the application itself has been recompiled since the authenticity data was generated, you must refresh the authenticity data. For more information, see Configuring the application-authenticity security check.

Cheers!

Sunday, November 20, 2016

Cloud service models and IBM Cloud offerings


The traditional on-premises core IT has the benefits such fully customizable and few limitations among many others but the time commitment to set up and deploy can be weeks and the maintenance of this type of infrastructure can be expensive and difficult depending on the level of complexity.
IBM offers three types of services in the cloud in order to solve expenses and time in the development and maintenance of core IT: Iaas, PaaS and SaaS

IBM SoftLayer Infrastructure as a Service (IaaS)

IBM SoftLayer provides self-service deployment of virtual and dedicated bare metal servers in secure data centers around the world. It provides the hosting infrastructure used by IBM Bluemix Public and IBM Bluemix Dedicated services. 

IBM Bluemix Platform as a Service (PaaS)

IBM Bluemix Platform as a Service is built on Cloud Foundry open source technology. It makes application development easier by allowing developers to focus on code and data alone. Bluemix Platform as a Service handles managing middleware, operating systems, and hosting infrastructure automatically. 


Software as a Service (SaaS) and IBM Cloud Marketplace


The Software as a Service model provides business applications on a ready-to-use and self- service model. The IBM Cloud Marketplace is a place where enterprise cloud customers can discover, learn, try and buy cloud services from IBM and Business Partners.

And this is all!
Soon a little more detail about the capabilities of IBM Bluemix PaaS.

Tuesday, November 15, 2016

MobileFirst on Bluemix: Getting Started

Hi folk,

As I explained in previous post the IBM MobileFirst Platform is available as an on-premise server or on the IBM Bluemix cloud offering. In this example I'm going to focus on the MobileFirst for Bluemix cloud offering for creating a mobile application and then download to emulate in a test environment.

You’ll first need to sign into your Bluemix account. If you don’t already have one, you can create a trial account for free.

The steps are divided into::
Step 1 - Create the MobileFirst service to register the applications
Step 2 - Create an application
Step 3 - Download code and emulate

Step 1 - Create the MobileFirst service to register the applications

Procedure:
1. Login into IBM Bluemix dashboard
2. Click Catalog tag menu
3. Click Mobile option
 3. Click Mobile Foundation
4. You can find the different prices and rates. Create a developer instance for free. Change the default server name and click Create
5. The creation of the service allows you to parameterize advanced options. In this example I want to start the default basic server. Scroll down and click Star Basic Server
Note: Starting the server can take up to 10 minutes to complet.
6. Launch the administration console. Click Launch Console
Note: Copy the automatically generated password for the admin user

7. Login with admin user to MobileFirst Operations Console

 

Step 2 - Create an application

Procedure:
1. Go to IBM Bluemix Mobile project dashboard from menu App and select Mobile
2. Click Create Project
3. Select the Business Directory starter and click Create Project
4. Write the Project Name and click Create
5. Click Build Get Code
6. Select Android platform
Note: Generate Code can take up to 1 minutes to complet.

After the code has been generated, three options are displayed:

 

Step 3 - Download code and emulate

Procedure:
1. Click Download Code
2. Unzip the file
3. Open Android Studio and Open an existing Android Studio project
4. Select the folder unziped
Note: If an error occurs when synchronizing the project Gradle. Click Install and wait for the installation to finish
5.  Click Run to build and run the application in the emulator
In the emulator appears the application created in Bluemix !!
I just set up a development environment with an application created from a Bluemix template, wow!

Soon I will publish how the application is registered on the created MobileFirst service and how the application uses Bluemix services. Be Patient !!!

Cheers!

IBM MobileFirst Platform 8.0 - Developing Applications (Adding the MobileFirst SDK to Android Applications)

Folk, I'm still testing IBM MobileFirst Platform 8.0. Today it's time to add the MobileFirst SDK to Android Applications.

I will follow once again the guide documented in the development site of IBM MobileFirst Platform.

Hope that helps!

Let's go, the dependencies correspond to core functions and other functions:
  • IBMMobileFirstPlatformFoundation - Implements client-to-server connectivity, handles authentication and security aspects, resource requests, and other required core functions
  • IBMMobileFirstPlatformFoundationJSONStore - Contains the JSONStore framework
  • IBMMobileFirstPlatformFoundationPush - Contains the Push Notifications framework
Prerequisites:
  • Android Studio and MobileFirst CLI installed on the developer workstation
  • A local or remote instance of MobileFirst Server is running
  • Setting up your MobileFirst development environment and Setting up your Android development environment
Procedure:
1. Create an Android Studio project or use an existing one


2. In Android → Gradle Scripts, select the build.gradle (Module: app) file
3. Add the following lines after apply plugin: 'com.android.application': 
repositories{
     jcenter()
}

4. Add the following line inside the android section: 
packagingOptions {
     pickFirst 'META-INF/ASL2.0'
     pickFirst 'META-INF/LICENSE'
     pickFirst 'META-INF/NOTICE'
}

5. Add the following line inside the dependencies section:
compile 'com.ibm.mobile.foundation:ibmmobilefirstplatformfoundation:8.0.+'
6. In Android → app → manifests, open the AndroidManifest.xml file. Add the following permissions above the application element:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

7. Add the MobileFirst UI activity next to the existing activity element:
<activity android:name="com.worklight.wlclient.ui.UIActivity" />
Note: If a Gradle Sync request appears, accept it.

8. Registering the application to MobileFirst Server, go to project folder and run:
$ mfpdev app register
Verifying server configuration...
Registering to server:'http://###.###.###.###:9080' runtime:'mfp'
Registered app for platform: android


Note: To check the registration in the console, in this example I have installed the MobileFirst Server component in my local environment: http://localhost:9080/mfpconsole/login.html



9. Creating a WLClient instance, in this example, added in MainActivity class.
WLClient.createInstance(this);
Note: Creating a WLClient instance should happen only once in the entire application lifecycle. It is recommended to use the Android Application class to do it.

10. Run the app in Run → Run 'app'
Cheers!!!

Monday, November 14, 2016

IBM MobileFirst Platform 8.0 - Developing Applications (Adding the MobileFirst SDK to iOS Applications)


The MobileFirst Foundation SDK consists of a collection of pods that are available through CocoaPods and which you can add to your Xcode project:
  • IBMMobileFirstPlatformFoundation - Implements client-to-server connectivity, handles authentication and security aspects, resource requests, and other required core functions
  • IBMMobileFirstPlatformFoundationJSONStore - Contains the JSONStore framework
  • IBMMobileFirstPlatformFoundationPush - Contains the push notification framework
  • IBMMobileFirstPlatformFoundationWatchOS - Contains support for Apple WatchOS
Prerequisites:
  • Xcode and MobileFirst CLI installed on the developer workstation
  • A local or remote instance of MobileFirst Server is running
  • Support level
    • Xcode 7.1 and later
    • iOS 8 and later
Procedure:
1. Create an Xcode project or use an existing one (Swift or Objective-C). For example I have chosen Swift.
Note: Swift is a new programming language for iOS, macOS, watchOS, and tvOS apps that builds on the best of C and Objective-C, without the constraints of C compatibility. Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun. Swift’s clean slate, backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works. 




2. If CocoaPods is already installed in your development environment, skip to step 3.
Open a Command-line window and navigate to the root of the Xcode project and run:
Note: "pod setup" command might take several minutes to complete. Use a git process.

$ sudo gem install cocoapod
$ pod setup
Setting up CocoaPods master repo
Setup completed

3. This creates a Podfile
$ pod init

4. Edit the Podfile.
Comment out or delete the contents of the file.
Add the following lines and save the changes:

use_frameworks!

platform :ios, 8.0
target "MyHelloiOS" do
    pod 'IBMMobileFirstPlatformFoundation'
end

5. Back in the command-line window, run the commands. These command add the MobileFirst Native SDK files, add the mfpclient.plist file, and generate a Pod project.
Note: The commands might take several minutes to complete.

$ pod install
Analyzing dependencies
Downloading dependencies
Installing IBMMobileFirstPlatformFoundation (8.0.2016070718)

[!] Please close any current Xcode sessions and use `MyHelloiOS.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

$ pod update
Update all pods
Updating local specs repositories

CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1

Analyzing dependencies
Downloading dependencies
Using IBMMobileFirstPlatformFoundation (8.0.2016070718)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

6. Close Xcode and open Xcode MyHelloiOS.xcworkspace file


7. Registering the application to MobileFirst Server, go to project folder and run:
$ mfpdev app register 
Verifying server configuration...
Registering to server:'http://####.####.####.####:9080' runtime:'mfp'
? Enter your bundleId: jif.examples.helloios
To prevent future prompting for the bundle ID in iOS projects, update the '<string>' element that corresponds to the '<key>CFBundleIdentifier</key>' in your Info.plist file.
Registered app for platform: ios

8. In Xcode, right-click the project entry, click on Add Files To [ProjectName] and select the mfpclient.plist file, located at the root of the Xcode project.




 Cheers!!!

IBM MobileFirst Platform 8.0 - Developing Applications (Adding the MobileFirst SDK to Cordova Applications)

Hi folk, again back with new developments. I will start a series of post about the development of applications for mobile devices based on IBM MobileFirst Platform.

The idea is to learn new concepts about: MobileFirst-provided APIs for Native, Cordova and Web applications, such as JSONStore and WLResourceReuest.
The MobileFirst Cordova SDK is provided as a set of Cordova plug-ins, and is registered at NPM.
NPM is the package manager for JavaScript.

Available plug-ins are:
  • cordova-plugin-mfp - The core SDK plug-in
  • cordova-plugin-mfp-push - Provides push notifications support
  • cordova-plugin-mfp-jsonstore - Provides JSONStore support
  • cordova-plugin-mfp-fips - Android only. Provides FIPS support
  • cordova-plugin-mfp-encrypt-utils - iOS only. Provides support for encryption and decryption
The Cordova platform versions supported by the MobileFirst plug-ins, are:
  • cordova-ios: >= 4.1.1 and < 5.0
  • cordova-android: >= 5.1.1 and < 6.0
  • cordova-windows: >= 4.3.2 and < 5.0
Prerequisites:
  • Apache Cordova CLI 6.x and MobileFirst CLI installed on the developer workstation.
  • A local or remote instance of MobileFirst Server is running.
  • Setting up your Cordova development environment.
Before you start, make sure that the MobileFirst Server is running.

Procedure:

1. Check Cordova version
$ cordova -v
6.1.1

2. Create Cordova project
$ cordova create MyHelloCordova jif.example.hellocordova MyHelloCordova --template cordova-template-mfp
Creating a new cordova project.
Retrieving cordova-template-mfp using npm...


Note:
“MyHelloCordova” is the folder name of the application
“jif.example.hellocordova” is the ID of the application
“MyHelloCordova” is the Name of the application
--template modifies the application with MobileFirst-specific additions
Because the application was configured using the MobileFirst template, the MobileFirst core Cordova plug-in is added automatically.



3. Change directory to Cordova project:
$ cd MyHelloCordova

4. Add one or more supported platforms to the Cordova project by using the Cordova CLI command: cordova platform add ios|android|windows. For example:
$ cordova platform add android

5. Registering the application to MobileFirst Server
$ mfpdev app register
Verifying server configuration...
Registering to server:'http://####.####.####.####:9080' runtime:'mfp'
Updated config.xml file located at: /Users/jorge/Development/Mobile/mfp/workspace/MyHelloCordova/config.xml
Run 'cordova prepare' to propagate changes.
Registered app for platform: android


Note: You can also register applications from the MobileFirst Operations Console

6. Propagate changes and run the example
$ cordova prepare
$ cordova emulate


Monday, February 8, 2016

IBM MobileFirst Platform - Part II. Install the Mobile Test Workbench

Let's go! with the Mobile Test Workbench, if you have MobileFirst Studio installed (IBM MobileFirst Platform - Part I Install Developer Studio),  you can automate the functional testing of Android and iOS applications that were built with MobileFirst Studio.
  1. Start Eclipse, and then select Help > Eclipse Marketplace
  2. In the Find field, type MobileFirst Platform Test Workbench and click Go
  3. Click the Install button
  4. Select the features that you want to install, and then click Next.
  5. Click Next, and then review and accept the license terms, and then click Finish to begin the installation
  6. Follow the prompts to complete the installation
  7. Restart Eclipse IDE for the changes to take effect
Note: Testing Android applications with the Test Workbench requires a JDK. Be sure to add the path to the JDK in Eclipse under Window > Preferences > Java > Installed JREs, and set it as the default JRE by selecting its corresponding check box

When IBM MobileFirst Platform Test Workbench is installed, you can install the mobile test client for Android and the mobile test client for the iOS Simulator.

IBM MobileFirst Platform - Part I. Install Developer Studio

IBM MobileFirst Platform Studio is an Eclipse plug-in that helps you quickly build, run, and manage mobile web, hybrid, and native apps., allowing developers to perform all the coding and integration tasks that are required to develop a fully operational application ror a variety of mobile, tablet, desktop and web environments

I'll install the plug-in in my IBM Rational Software Architect Designer 9.5 based on Eclipse 4.4.2



Note: Ensure that your Eclipse workspace path does not contain any spaces, which can cause failures when apps are deployed to the internal development server, or when the MobileFirst Operations Console is started.
  1. Start Eclipse, and then select Help > Eclipse Marketplace.
  2. In the Find field, type MobileFirst Platform and click Go.
  3. Click the IBM MobileFirst Platform Studio Install button.
  4. IBM MobileFirst Platform Studio and all features are preselected. Confirm your selection and click Next.
    • Always select IBM MobileFirst Platform Studio
    • IBM Dojo Mobile Tools and IBM jQuery Mobile Tools are optional, select them based on your anticipated use 
  5. Review and accept the license terms, and then click Finish to begin the installation
  6. Follow the prompts to complete the installation
  7. Restart Eclipse IDE for the changes to take effect.
Note: If your Eclipse workbench has IBM Rational Team Concert™ V4.0 Eclipse Client already installed, you might need to clean the Eclipse environment before you use Studio.

First you have is the welcome page with some links to mobile features.

 
 Enjoy it and you can start to create mobile apps!