OMTracker_HowToRunAsDevelopers - tsgrp/OpenMigrate GitHub Wiki

Prerequisites

  • node >= 8.9.4
  • npm >= 4.0.5
  • @angular/cli >= 1.4.2

How to install different versions of Node/Npm on Windows

We recommend using Nodist. It is a natural NodeJS and Npm version manager for windows. It is highly recommended to uninstall all existing NodeJS & Npm before installing Nodist.

How to install AngularCLI

After you have node and npm, please run npm install -g @angular/cli in console. Above command does not just install angular itself, it also install all other Angular related and must-have dependencies such as Webpack and angular compiler.

Installing Dependencies

After checking out the code, remember to first run npm install to install all the dependencies before doing anything.

Enabling authentication

The tracker uses OpenContent to authenticate the user; therefore, be sure to deploy OpenContent. There are a couple steps to enable authentication.

  • Add a key value pair of AUTH_ENABLED: true to your overlay file at the path /projects/{COMP_NAME}/overlay/{COMP_NAME}/{COMP_NAME}.ts. This enables routing to the login page on the frontend.
  • We must also enable proper authentication validation on the backend. If you have not done so already, in /projects/{COMP_NAME}/overlay/{COMP_NAME}/ext-properties, create a file called omservice-overrides.properties. You may override any of the values in omservice-defaults.properties here. Place this file in your {TOMCAT_HOME}/shared/classes folder. Below is an example of how to enable authentication for those in the admin group only:
auth.enabled=true
auth.adminOnly=true

For an example of an overlay file and override file enabling authentication, look at /projects/rkarim-P53-0820.

How to run the app for local development

Run npm run start for a dev server. Electron application window will be opened automatically. The app will also automatically reload if you change any of the source files.

Consult the package.json file to run the Electron server under specific project/env configurations.

How to build the app as a website (war) for Tomcat

Run npm run build to build the project. The WAR file (omtracker.war) will be stored in the dist/ directory.

Consult the package.json file to run the Electron server under specific project/env configurations.

How to build the app as an EXE (executable file) for Windows users

First run npm run build to build the project into the dist folder. Then for Windows, you can run npm run package:win to build the exe file. After it's done, you will see a new folder which called "packages", above command will build both 32 and 64 bit version of the application.

For example, you will see a folder called "omtracker-1.1.1-win32-x64" for the 64 bit version. The WHOLE folder is a must-have if you want to share this app with others. Please zip up the whole folder when sharing, e.g. omtracker-1.1.1-win32-x64.zip. Inside the folder, you will find a exe file, e.g. omtracker-1.1.1.exe. Simply double click on it, the app will be opened as a Windows application.

If you are seeing errors during the build process. Your laptop might be missing 1) Microsoft .NET Framework and 2) Microsoft Visual C++ since they are needed bindery for building app on Windows. Please contact TSG for more detail.

P.S. Building the app for Mac and Linux users is also supported but it is not tested yet.

How to access pre build WAR and EXE files

If you do not want to spend time on setting up your environment, you can also get the pre build 1) WAR under the war folder, and 2) EXE (zip) under the release\VERSIONNUMBER\ folder for easy deployment.

P.S. Please keep in mind that pre build files might not include the latest code.

How to connect the tracker when running on a remote server (not as a WAR)

Add this environment variable: OM_TRACKER_REMOTE_ENABLED=true and then you should be able run the OM Tracker EXE from a different machine than where OM is running and connect remotely.

OM Tracker - Standalone Mode

Running the OpenMigrate tracker in standalone mode means that ALL components required to run OpenMigrate and the tracker are packaged together in a single ZIP distribution. Note that standalone mode is currently only supported for 64-bit Windows. This distribution includes the following:

  • JRE
  • Jetty Server
  • Tracker services WAR file (om-tracker.war)
  • OpenMigrate binaries (OM_HOME)
  • Pre-build OpenMigrate configurations for pre-built migrations (OM_CONFIG)
  • OM Tracker Executable

How to package the OM Tracker for standalone mode deployment

Building OM Tracker for standalone deployment is a multi-step process, but no files/folders should have to be moved manually.

  1. Build OpenMigrate distributable (om.zip) and deploy om-tracker\install location

    • Open a command prompt to OpenMigrate\code\projects\tsg\tracker-standalone
    • Ensure that Gradle and the JDK are on your classpath. You may need to create and run a setenv.bat to configure your environment
    • Execute the command gradle clean trackerDeploy
    • The gradle process will build OpenMigrate and package OM_HOME and OM_CONFIG into om.zip and copy to the Tracker build location OpenMigrate\om-tracker\install. If your Tracker code is in a different location, the path can be overridden in gradle.properties using property name trackerPath.
  2. Build OM Tracker in standalone mode

    • Ensure that all environment setup prerequisites listed above have been performed (node, npm, angular, etc.)
    • Ensure that Gradle and the JDK are on your classpath. You may need to create and run a setenv.bat to configure your environment
    • Open a command prompt to OpenMigrate\om-tracker
    • Execute the command npm run build:standalone
    • Note that Gradle is run as a sub-process to build om-tracker.war. The WAR will be built and copied to OpenMigrate\om-tracker\war
  3. Build the OM Tracker standalone distributable

    • If you have run the app for local development, you will need to clean up some folders to avoid including unnecessary files in the distributable package. Prior to building, delete these folders if they exist:
      • OpenMigrate\om-tracker\jre
      • OpenMigrate\om-tracker\jetty
      • OpenMigrate\om-tracker\OM_CONFIG
      • OpenMigrate\om-tracker\OM_HOME
    • Open a command prompt to OpenMigrate\om-tracker
    • Execute the command npm run package:win
    • The Windows distributable will be written to OpenMigrate\om-tracker\packages\omtracker-<version>-win32-x64. It's recommended to ZIP this folder for distribution.

How to run the OM Tracker app for local development in standalone mode

  • Open a command prompt to OpenMigrate\om-tracker
  • Run npm run start:standalone for a local DEV server. The Electron application window will be opened automatically. The app will also automatically reload if you change any of the source files.

Application Development

Code scaffolding (AngularCLI blueprint)

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|module NAMEYOUWANT for other Angular elements.

You can append --dry-run at the end for each command, the console would print out files that will be created by your comment. After you make sure it looks good, you can remove the --dry-run and run it. It is the best way to test out your blueprint before apply it.

Running unit tests

Run npm run test to execute the unit tests via Karma.

Running end-to-end tests

Run npm run e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

⚠️ **GitHub.com Fallback** ⚠️