HowTo: Set Up an Offline IBM MobileFirst 8.0 Development Environment
Danny Cao October 11, 2017
MobileFirst_Platform Offline Setup Development_EnvironmentOverview
IBM MobileFirst Platform Foundation supports offline development, but requires modified installation steps as detailed below. For additional development tutorials and standard installation instructions refer to the IBM MobileFirst Platform Foundation 8.0 Tutorials. The following prerequisite programs will need an online connection to download before transferring to an offline development machine for installation.
Prerequisites
- Cordova
- cordova-cli (6.0.0+)
- Cordova Platforms
- cordova-android (6.1.2+)
- cordova-ios (4.1.1+)
- cordova-windows (4.3.2+)
- Java (JDK 1.7+): For running a local development server
- Maven (3.3.9+): For adapter development
- MobileFirst Developer Kit (V8.0+): Includes the MobileFirst Server & MobileFirst Operations Console, MobileFirst Developer Command-line Interface (CLI), MobileFirst client SDKs and MobileFirst adapter tooling.
- Node.js (0.12.0+): For the MobileFirst CLI and Cordova
For additional offline platform specific development prerequisites see the tutorial page for more instructions.
Cordova Preparation
The downloaded cordova-x.y.z.tgz file has third party dependencies that are not packaged with the archive and requires an online connection to first cache those dependencies before it can be moved to an offline machine for installation. See NPM issue #4210 for more information and suggested workarounds for offline npm installs or use npmbox. We suggest the following workaround:
While still online
- Install Node.js on the online machine
- Change directory to where you downloaded cordova-x.y.z.tgz and run
npm --cache ./.cache install cordova-x.y.z.tgz
to generate and cache the dependencies needed - Zip the new generated .cache folder and move this file along with the cordova-x.y.z.tgz file to the offline machine
On the offline machine
- Unzip the .cache folder
- Run
npm install --cache ./.cache cordova-x.y.z.tgz -g
to install cordova globally using the previously generated cache (Note: this may take a while)
The cordova command is now available for use. For any other packages that you may run into issues installing on an offline machine, the above caching method is viable as well.
Installation
Once all of the above files are downloaded, move them to an offline machine for installation. Cordova and the associated cordova platforms as well as the MobileFirst CLI will need to be installed after Node.js has been installed.
MobileFirst Operations Console
The MobileFirst Development Kit installer includes snapshot downloads for various development artifacts (listed above in Prerequisites) downloadable via the MobileFirst Operations Console downloads page.
See the MobileFirst Operations Console Tutorial for more information on accessing and navigating the console.
MobileFirst CLI
The MobileFirst CLI may also require an online connection to prepare the third-party dependencies for offline install. We suggest the above workaround with Cordova. First download the mfpdev-cli.tgz file from the MobileFirst Operations Console via the instructions above.
While still online
- Install Node.js on the online machine
- Change directory to where you downloaded mfpdev-cli.tgz and run
npm --cache ./.cache install mfpdev-cli.tgz
to generate and cache the dependencies needed - Zip the new generated .cache folder and move this file along with the mfpdev-cli.tgz file to the offline machine (or download it again from the Console on the offline machine)
On the offline machine
- Unzip the .cache folder
- Run
npm install --cache ./.cache mfpdev-cli.tgz -g
to install mfpdev globally using the previously generated cache (Note: this may take a while)
If you run into any installation errors on Windows regarding node-gyp, rerun the command with the --no-optional
flag as well.
Cordova Plugins and Platforms
When adding the MobileFirst Cordova SDK plugins to a cordova project, the plugins must first be added before platforms to ensure that the plugin does not search online for additional platform resources. The MobileFirst Cordova SDK plugins can be downloaded from the MobileFirst Operations Console via the instructions above and added by running cordova plugins add <path to unzipped mfp-cordova>/plugins/cordova-plugin-mfp
. Additionally the following plugins can be installed:
- cordova-plugin-mfp-fips
- cordova-plugin-mfp-jsonstore
- cordova-plugin-mfp-push
To add a platform to your cordova project, unzip the downloaded cordova-[android | ios | windows]-x.y.z.tgz platform archive and run cordova platforms add <path to unzipped platform>/package . You may want to set system environment variables for the plugins and platforms to avoid typing out the path each time (make sure where you download and unzip them to are permanent locations). |
For additional tutorials on Cordova development, see the IBM MobileFirst Platform Foundation 8.0 Cordova Tutorials or refer to the official Apache Cordova Documentation.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.